|
From: Márcio V. d. S. <mv...@us...> - 2007-10-08 22:49:09
|
Update of /cvsroot/tail/TailS/src/java/net/sf/tails/swing/frame/autocomplete In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv28777/src/java/net/sf/tails/swing/frame/autocomplete Added Files: AutoCompleteForm.java Log Message: --- NEW FILE: AutoCompleteForm.java --- package net.sf.tails.swing.frame.autocomplete; import java.awt.event.MouseEvent; import java.util.ResourceBundle; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class AutoCompleteForm extends javax.swing.JFrame { /** * */ private javax.swing.JTable reportTable; private static final long serialVersionUID = 8339682604292292370L; private static String[] rubyKeyWords; private static String[] tailKeyWords; static{ ResourceBundle bundle = ResourceBundle.getBundle("net.sf.tails.i18n.DSL_IDE"); rubyKeyWords = bundle.getString("RUBY_KEYWORDS").split(" "); tailKeyWords = bundle.getString("TAIL_KEYWORDS").split(" "); } /** Creates new form AutoCompleteForm */ public AutoCompleteForm() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code "> private void initComponents() { DefaultTableModel dtm = new DefaultTableModel(0,1); for (String s : tailKeyWords) { dtm.addRow(new Object[]{s}); } for (String s : rubyKeyWords) { dtm.addRow(new Object[]{s}); } reportTable = new JTable(dtm); jScrollPane1 = new javax.swing.JScrollPane(); jScrollPane1.setViewportView(reportTable); reportTable.addMouseListener( new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jScrollPane1MouseClicked(evt); } }); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jScrollPane1.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jScrollPane1KeyPressed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE) .addContainerGap()) ); pack(); }// </editor-fold> private void jScrollPane1KeyPressed(java.awt.event.KeyEvent evt) { // TODO add your handling code here: } private void jScrollPane1MouseClicked(MouseEvent evt) { JTable jt = (JTable)evt.getSource(); System.out.println(jt.getValueAt(jt.getSelectedRow(), jt.getSelectedColumn())); } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new AutoCompleteForm().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JScrollPane jScrollPane1; // End of variables declaration } |