/*
* Copyright (C) 2004 TiongHiang Lee
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Email: thlee@onemindsoft.org
*/
package org.onemind.swingweb.demo;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/**
* Demo for swing tree
* @author TiongHiang Lee (thlee@onemindsoft.org)
* @version $Id: SwingTreeExample.java,v 1.4 2007/04/23 04:11:02 thlee Exp $ $Name: $
*/
public class SwingTreeExample extends javax.swing.JFrame
{
/** Creates new form SwingTreeExample */
public SwingTreeExample()
{
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.
*/
private void initComponents()
{//GEN-BEGIN:initComponents
jTree1 = new javax.swing.JTree();
addWindowListener(new java.awt.event.WindowAdapter()
{
public void windowClosing(java.awt.event.WindowEvent evt)
{
exitForm(evt);
}
});
jTree1.addMouseListener(new MouseListener()
{
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() >= 2)
{
System.out.println("Click twice on " + e.getSource());
}
}
public void mouseEntered(MouseEvent e)
{
// TODO Auto-generated method stub
}
public void mouseExited(MouseEvent e)
{
// TODO Auto-generated method stub
}
public void mousePressed(MouseEvent e)
{
// TODO Auto-generated method stub
}
public void mouseReleased(MouseEvent e)
{
// TODO Auto-generated method stub
}
});
getContentPane().add(jTree1, java.awt.BorderLayout.CENTER);
pack();
}//GEN-END:initComponents
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt)
{//GEN-FIRST:event_exitForm
System.exit(0);
}//GEN-LAST:event_exitForm
/**
* @param args the command line arguments
*/
public static void main(String args[])
{
new SwingTreeExample().show();
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTree jTree1;
// End of variables declaration//GEN-END:variables
}