test.InfiniteBrowserTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Quaqua Show documentation
Show all versions of Quaqua Show documentation
A Mavenisation of the Quaqua Mac OSX Swing Look and Feel (Java library)
Quaqua Look and Feel (C) 2003-2010, Werner Randelshofer.
Mavenisation by Matt Gumbley, DevZendo.org - for problems with
Mavenisation, see Matt; for issues with Quaqua, see the Quaqua home page.
For full license details, see http://randelshofer.ch/quaqua/license.html
The newest version!
/*
* @(#)InfiniteBrowserTest.java 1.0 2010-05-06
*
* Copyright (c) 2010 Werner Randelshofer, Immensee, Switzerland.
* All rights reserved.
*
* You may not use, copy or modify this file, except in compliance with the
* license agreement you entered into with Werner Randelshofer.
* For details see accompanying license terms.
*/
package test;
import ch.randelshofer.quaqua.QuaquaManager;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
/**
* InfiniteBrowserTest.
*
* @author Werner Randelshofer
* @version 1.0 2010-05-06 Created.
*/
public class InfiniteBrowserTest extends javax.swing.JPanel {
/** Creates new form InfiniteBrowserTest */
public InfiniteBrowserTest() {
initComponents();
browser.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
private int counter;
@Override
public void valueChanged(TreeSelectionEvent e) {
DefaultTreeModel treeModel = (DefaultTreeModel) browser.getModel();
DefaultMutableTreeNode node = (DefaultMutableTreeNode) (e.getPath()).getLastPathComponent();
DefaultMutableTreeNode nuevo = new DefaultMutableTreeNode("TEST "+(++counter));
treeModel.insertNodeInto(nuevo, node, node.getChildCount());
}
});
}
public static void main(String args[]) {
try {
UIManager.setLookAndFeel(QuaquaManager.getLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
JFrame f = new JFrame("Infinite Tree");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(new InfiniteBrowserTest());
f.pack();
f.setVisible(true);
}
/** 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.
*/
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
private void initComponents() {
scrollPane = new javax.swing.JScrollPane();
browser = new ch.randelshofer.quaqua.JBrowser();
setLayout(new java.awt.BorderLayout());
scrollPane.setViewportView(browser);
add(scrollPane, java.awt.BorderLayout.CENTER);
}// //GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private ch.randelshofer.quaqua.JBrowser browser;
private javax.swing.JScrollPane scrollPane;
// End of variables declaration//GEN-END:variables
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy