# HG changeset patch # User František Kučera # Date 1293553445 -3600 # Node ID c25305af796816624415e223785db1c8915e6b5f # Parent 984cba2864e544980a5951f2d99313d2d62b56d8 JTable: zjednodušení. diff -r 984cba2864e5 -r c25305af7968 java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/gui/Panel.form --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/gui/Panel.form Tue Dec 28 17:02:08 2010 +0100 +++ b/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/gui/Panel.form Tue Dec 28 17:24:05 2010 +0100 @@ -47,23 +47,6 @@ - - - - - - - - - -
-
- - - -
-
-
diff -r 984cba2864e5 -r c25305af7968 java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/gui/Panel.java --- a/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/gui/Panel.java Tue Dec 28 17:02:08 2010 +0100 +++ b/java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/gui/Panel.java Tue Dec 28 17:24:05 2010 +0100 @@ -6,6 +6,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; +import javax.swing.JTable; +import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -19,12 +21,16 @@ private static final ResourceBundle překlady = ResourceBundle.getBundle("cz.frantovo.rozsireneAtributy.Překlady"); private Model model; private Atribut vybranýAtribut; + private JTable tabulka; public Panel(Model model) { this.model = model; initComponents(); - tabulka.setModel(model); - + + tabulka = new JTable(model); + tabulka.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + posuvnýPanel.setViewportView(tabulka); + /** Výběr aktuálního atributu v tabulce */ tabulka.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @@ -55,25 +61,10 @@ private void initComponents() { posuvnýPanel = new javax.swing.JScrollPane(); - tabulka = new javax.swing.JTable(); tlačítkoPřidat = new javax.swing.JButton(); tlačítkoSmazat = new javax.swing.JButton(); tlačítkoZnovuNačíst = new javax.swing.JButton(); - tabulka.setModel(new javax.swing.table.DefaultTableModel( - new Object [][] { - {null, null, null, null}, - {null, null, null, null}, - {null, null, null, null}, - {null, null, null, null} - }, - new String [] { - "Title 1", "Title 2", "Title 3", "Title 4" - } - )); - tabulka.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - posuvnýPanel.setViewportView(tabulka); - tlačítkoPřidat.setMnemonic('p'); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("cz/frantovo/rozsireneAtributy/Překlady"); // NOI18N tlačítkoPřidat.setText(bundle.getString("přidatAtribut")); // NOI18N @@ -148,7 +139,6 @@ }//GEN-LAST:event_tlačítkoZnovuNačístActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JScrollPane posuvnýPanel; - private javax.swing.JTable tabulka; private javax.swing.JButton tlačítkoPřidat; private javax.swing.JButton tlačítkoSmazat; private javax.swing.JButton tlačítkoZnovuNačíst;