Need Help with Null Pointer Exception!!!
"Ajay Pandey" <[email protected]> Wed, 16 Jun 2004 19:17:56 +0530
| Newsgroups | gmane.comp.java.luxor-xul.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm using luxor for UI development. While generating the UI for textfield,
I'm getting Null Pointer exception. Can anyone figure it for me.
The respective codes are
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++
Test.xul
+++++++++
<xul>
<hbox id="test">
<vbox>
<hbox>
<textfield id="display1" data="value1" enabled="false"/>
</hbox>
<hbox>
<textfield id="display2" data="value2" enabled="false"/>
</hbox>
<hbox>
<button label="swap" command="show" style="width: 100px"/>
</hbox>
</vbox>
</hbox>
</xul>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++
TestForm.java
+++++++++++++
package org.luxor.test;
import javax.swing.JTextField;
import luxor.XulForm;
import luxor.XulInput;
public class TestForm extends XulForm {
XulInput _display1;
XulInput _display2;
public TestForm() {
super("test");
setup();
}
public void init() {
_display1 = new XulInput(this, "display1");
_display2 = new XulInput(this, "display2");
new ClickBtn(this,"swap");
}
public void postInit() {
System.out.println(_display1);
System.out.println(_display2);
JTextField jdisplay1 = (JTextField) _display1.getJComponent();
jdisplay1.setHorizontalAlignment(JTextField.RIGHT);
JTextField jdisplay2 = (JTextField) _display2.getJComponent();
jdisplay2.setHorizontalAlignment(JTextField.RIGHT);
}
public void setValue() {
String value;
value=_display1.getText();
_display2.setText(value);
}
}
Here when i'm doing JTextField jdisplay1 = (JTextField)
_display1.getJComponent();
the _display.getJComponent() is returning null.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++
Can anyone figure out the error for me.
Regards
Ajay
-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND