Home arrow static arrow Java Programming [Archive] - how to let JCheckBox show always and in middle of cell?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - how to let JCheckBox show always and in middle of cell?
This topic has 1 reply on 1 page.

Posts:260
Registered: 4/8/04
how to let JCheckBox show always and in middle of cell?  
Jul 3, 2004 9:54 PM



 
how to let JCheckBox show always and in middle of cell?

import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
public class TestTable extends JFrame{
String[] columnNames={"fruits","remain"};
Object[][] data={{"Applets",null},{"Oranges",null}};
JTable table=null; DefaultCellEditor cell=null;
JCheckBox chekBx=new JCheckBox();
public TestTable(){
table=new JTable(data,columnNames);
JScrollPane scroll=new JScrollPane(table);
cell=new DefaultCellEditor(chekBx);
cell.setClickCountToStart(-1);
table.getColumnModel().getColumn(1).setCellEditor(cell);
Container cp=getContentPane();
cp.add(scroll);
this.setSize(300, 200);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
public static void main(String[] args){ new TestTable();
}
}
 

Posts:70
Registered: 16/9/03
Re: how to let JCheckBox show always and in middle of cell?  
Jul 3, 2004 10:27 PM (reply 1 of 1)



 
Please don't cross-post, or multi-post
 
This topic has 1 reply on 1 page.