Replace « JTree « Java Swing Q&A





1. How to replace a JTree component in Java Swing?    stackoverflow.com

I am wondering how to make the following code in replacing the JTree component working. Currently I am getting a java.lang.NullPointerException

at RandomJTree$1.keyPressed(RandomJTree.java:64)
at java.awt.Component.processKeyEvent(Component.java:6221)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2801)
at java.awt.Component.processEvent(Component.java:6040)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:704)
at ...

2. Replacing an existing JTree    coderanch.com