1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
public class Main
{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
String [][] Data ;
Data = new String[4][2];
String[] ColumnNames = {"Reversal Point [V/mm]","Rate [V/mm*s]"};
final JTable ManualTable = new JTable();
TableModel model = new DefaultTableModel(Data, ColumnNames)
{
@Override
public boolean isCellEditable(int row, int column)
{ boolean result = false;
// premiere cellule de la deuxieme colonne
if ( row == 0 && column == 1 )
{ result = true; }
return result;
}
};
ManualTable.setModel(model);
JScrollPane scroll = new JScrollPane(ManualTable,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
frame.getContentPane().add(scroll);
frame.pack();
frame.setVisible(true);
}
} |
Partager