Package: javax.swing.* |
Product: Swing |
Release: 1.0.3 |
Related Links: |
ComboBox
JDialog
JFileChooser
JFrame
JOptionPane
JProgressBar
JScrollPane
JTable
General
JTree
JWindow
KeyStroke
LayeredPane
UIDefaults
|
Comment: |
int selRow = getJTree1().getRowForLocation(arg1.getX(), arg1.getY()); TreePath selPath = getJTree1().getPathForLocation(arg1.getX(), arg1.getY()); if (selRow != -1) { if (arg1.getClickCount() == 2) { //mySingleClick(selRow, selPath); System.out.println("DoubleClick: " + selPath); } else if (arg1.getClickCount() == 1) { System.out.println("SingleClick: " + selPath); System.out.println("SingleClick: " + selPath); System.out.println("SingleClick: " + getJTree1().getSelectionCount()); DefaultMutableTreeNode dtm = (DefaultMutableTreeNode) selPath.getLastPathComponent(); SampleData userObject = (SampleData) dtm.getUserObject(); System.out.println("SingleClick: " + userObject); if (userObject.getType().getClass() == Schip.class) { System.out.println("Is schip:"); Schip s = (Schip) userObject.getType(); getJTextField1().setText( s.naam ); // user code end getJScrollPane2().setViewportView(getJPanel2()); // user code begin {2} repaint(); validate(); } else { getJScrollPane2().setViewportView(null); repaint(); validate(); //myDoubleClick(selRow, selPath); } } |