javax.swing.JTable.getRowCount()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(247)

本文整理了Java中javax.swing.JTable.getRowCount()方法的一些代码示例,展示了JTable.getRowCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.getRowCount()方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:getRowCount

JTable.getRowCount介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

tc.setHeaderRenderer(new SelectAllHeader(table, BOOLEAN_COL));
JFrame f = new JFrame();
f.add(new JScrollPane(table));
f.pack();
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
  boolean state = e.getStateChange() == ItemEvent.SELECTED;
  setText((state) ? NONE : ALL);
  for (int r = 0; r < table.getRowCount(); r++) {
    table.setValueAt(state, r, viewColumn);

代码示例来源:origin: stackoverflow.com

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
for (int row = 0; row < jTable.getRowCount(); row++) {
  int maxHeight = 0;
  for (int column = 0; column < jTable.getColumnCount(); column++) {
width = comp.getPreferredSize().width;
for (int r = 0; r < table.getRowCount(); r++) {
  renderer = table.getCellRenderer(r, column);
  comp = renderer.getTableCellRendererComponent(table, table.getValueAt(r, column), false, false, r, column);

代码示例来源:origin: stackoverflow.com

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container cp = frame.getContentPane();
cp.setLayout(new FlowLayout());
cp.add(tbl);
cp.add(new JButton(new AbstractAction("click")
    for (int i = 0; i < tbl.getRowCount(); i++)
      colValues.add((String) tbl.getValueAt(0, i));

代码示例来源:origin: stackoverflow.com

JScrollPane scroll = new JScrollPane ( table )
    for ( int i = 0; i < table.getRowCount (); i++ )
frame.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE );
frame.pack ();
frame.setLocationRelativeTo ( null );

代码示例来源:origin: jpos/jPOS

table.getColumnModel().getColumn(0).setPreferredWidth(10);
table.setPreferredScrollableViewportSize(
  new Dimension (500,table.getRowCount()*table.getRowHeight()));
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
return new JScrollPane(table);

代码示例来源:origin: stackoverflow.com

for (int row = 0; row < getRowCount(); row++)
JScrollPane scrollPane = new JScrollPane( table );
getContentPane().add( scrollPane );
getContentPane().add( buttonPanel, BorderLayout.SOUTH );
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setVisible(true);

代码示例来源:origin: stackoverflow.com

private JButton button = new JButton("+");
private JButton button_1 = new JButton("-");
private JScrollPane scrollPane = new JScrollPane();
private List<String> list = new ArrayList<String>();
    public void actionPerformed(ActionEvent arg0) {
      String selectedItem = (String) comboBox.getSelectedItem();
      for (int i = 0; i < table.getRowCount(); i++) {
        String tableItem = (String) table.getValueAt(i, 0);
        int count = (Integer) table.getValueAt(i, 1)+1;
    public void actionPerformed(ActionEvent arg0) {
      String selectedItem = (String) comboBox.getSelectedItem();
      for (int i = 0; i < table.getRowCount(); i++) {
        String tableItem = (String) table.getValueAt(i, 0);
        int count = (Integer) table.getValueAt(i, 1)-1;

代码示例来源:origin: stackoverflow.com

frame.add(createUI());
    frame.pack();
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
width = comp.getPreferredSize().width;
for (int r = 0; r < table.getRowCount(); r++) {
  renderer = table.getCellRenderer(r, column);
  comp = renderer.getTableCellRendererComponent(

代码示例来源:origin: stackoverflow.com

for (int row = 0; row < getRowCount(); row++) 
sorter.sort();
JScrollPane scrollPane = new JScrollPane( table );
getContentPane().add( scrollPane );
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible(true);

代码示例来源:origin: stackoverflow.com

model.insertRow(table.getRowCount(),new Object[]{"Sushil","600"});
frame.setSize(600,600);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

代码示例来源:origin: stackoverflow.com

for (int i = 0; i < table.getRowCount(); i++) {
  table.setValueAt(i, i, 0);
    return table.getRowCount();
for (int i = 0; i < table.getRowCount(); i++) {
  headerTable.setValueAt("Row " + (i + 1), i, 0);
scrollPane = new JScrollPane(table);
scrollPane.setRowHeaderView(headerTable);
table.setPreferredScrollableViewportSize(table.getPreferredSize());
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.add(scrollPane);
frame.add(new JButton(new AbstractAction("Toggle filter") {
frame.pack();
frame.setLocation(150, 150);
frame.setVisible(true);

代码示例来源:origin: stackoverflow.com

JScrollPane scrollPane = new JScrollPane( table );
add( scrollPane );
System.out.println(table.getRowCount());
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setVisible(true);

代码示例来源:origin: stackoverflow.com

List colData = new ArrayList(table.getRowCount());
for (int i = 0; i < table.getRowCount(); i++) {
 row = (Vector) data.elementAt(i);
 colData.add(row.get(mColIndex));
f.add(new JScrollPane(table));
f.setVisible(true);

代码示例来源:origin: stackoverflow.com

for (int row = 0; row < getRowCount(); row++) {
      Object o = getValueAt(row, column);
JScrollPane scrollPane = new JScrollPane(table);
add(scrollPane);
add(buttonPanel, BorderLayout.SOUTH);
  public void run() {
    JFrame frame = new JFrame("any");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);

代码示例来源:origin: stackoverflow.com

table.setIgnoreRepaint(false);
JScrollPane scrollPane = new JScrollPane( table );
getContentPane().add( scrollPane );
getContentPane().add(button, BorderLayout.SOUTH );
  final int row = random.nextInt( table.getRowCount() );
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setVisible(true);

代码示例来源:origin: stackoverflow.com

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new JScrollPane(myTable));
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
  public void actionPerformed(ActionEvent arg0) {
   highlightedRow++;
   int rowCount = myTable.getRowCount();
   highlightedRow %= rowCount;
   myTable.repaint();

代码示例来源:origin: stackoverflow.com

button.addActionListener(this);
this.add(table);
this.add(button);
this.setVisible(true);
this.setSize(300,200);
this.setDefaultCloseOperation(3);
this.setLayout(new FlowLayout());
int i= table.getRowCount()-1;
int j= table.getColumnCount();
Object [] value = new Object[j];

代码示例来源:origin: stackoverflow.com

for (int row = 0; row < getRowCount(); row++)
JScrollPane scrollPane = new JScrollPane( table );
add( scrollPane );
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add( new TableBasic() );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible( true );

代码示例来源:origin: stackoverflow.com

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 init();
 pack();
 setVisible(true);
t1.getSelectionModel().addListSelectionListener(getListener());
t1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
add(t1);
   public void valueChanged(ListSelectionEvent e) {
     if(t1.getSelectedRow() == notSelectable){
       if(notSelectable+1 == t1.getRowCount()){
         t1.getSelectionModel().setSelectionInterval(0, 0);
       } else {

代码示例来源:origin: stackoverflow.com

public void run() {
  JFrame frame = new JFrame("Custom Cell Renderer");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      );
      if(row == 0 && table.getRowCount() > 1) {
        c.setBackground(Color.YELLOW);
        c.setForeground(Color.BLACK);
  bar.add(btn);
  content.add(bar, BorderLayout.NORTH);
  content.add(new JScrollPane(table), BorderLayout.CENTER);
  frame.setVisible(true);
  int nextRow = table.getRowCount();
  DefaultTableModel model = (DefaultTableModel)table.getModel();
  model.addRow(new Object[] { "NAME" + nextRow, "SPORT" + nextRow });

相关文章

JTable类方法