Skip to main content

applet problem

4 replies [Last post]
manojtyagi
Offline
Joined: 2006-02-17

hi all,
i have called JFrame in JApplet by the following method.
htmlFrame h=new htmlFrame();
my applet runs in webbrowser.
if i refresh the page runtime exception(null pointer exception)is throws in htmlFrame class.
what the reason behind it

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Andrei V. Dmitriev

Hi manoj,

where this exception occur? Could you please post the output of your
applet? Which JDK do you use? :)

Thanks,
-Andrei

swing-feedback@javadesktop.org wrote:

>hi all,
>i have called JFrame in JApplet by the following method.
>htmlFrame h=new htmlFrame();
>my applet runs in webbrowser.
>if i refresh the page runtime exception(null pointer exception)is throws in htmlFrame class.
>what the reason behind it
>---
>[Message sent by forum member 'manojtyagi' (manoj)]
>
>http://www.javadesktop.org/forums/thread.jspa?messageID=53701
>
>

manojtyagi
Offline
Joined: 2006-02-17

hi andrei,

JRE version 1.4.2_04 Java HotSpot(TM) Client VM
and exception s ----
changer applet stoped
changer applet destroyed

java.lang.NullPointerException

at HTMLEditor.HTMLChanger.makeActionsPretty(HTMLChanger.java:160)

at HTMLEditor.HTMLChanger.(HTMLChanger.java:72)

at HTMLEditor.changer.start(changer.java:45)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Actually i am calling internal frame in applet and i add it on the applet using JDesktopPane.
on internal frame i have added JEditorPane.
internalframe class constructor calls a method makeActionsPretty().Null pointer exception occurs in the makeActionsPretty()in the line :-
a=getTextComponent().getActionMap().get(HTMLEditorKit.cutAction);
a.putValue(Action.NAME,"Cut");

how can i avoid this?

Andrei V. Dmitriev

Hi manoj,

its hard to understand the situation in full but there is nothing
impossible :)
We should find the variable that currently null.
Try to watch the results of each actions in line 160. This would look
something like this:

a = getTextComponent();
System.out.println("getTextComponent()="+a); //null?
b = getTextComponent().getActionMap();
System.out.println("getTextComponent().getActionMap()="+b); //null?

Some of expressions above will return null instead of needed result(not nulls?). :)
Now you will need to find the reasond why this is null rather then other value.

Thanks,
--Andrei

swing-feedback@javadesktop.org wrote:

>hi andrei,
>
>JRE version 1.4.2_04 Java HotSpot(TM) Client VM
> and exception s ----
>changer applet stoped
>changer applet destroyed
>
>java.lang.NullPointerException
>
> at HTMLEditor.HTMLChanger.makeActionsPretty(HTMLChanger.java:160)
>
> at HTMLEditor.HTMLChanger.(HTMLChanger.java:72)
>
> at HTMLEditor.changer.start(changer.java:45)
>
> at sun.applet.AppletPanel.run(Unknown Source)
>
> at java.lang.Thread.run(Unknown Source)
>
>Actually i am calling internal frame in applet and i add it on the applet using JDesktopPane.
>on internal frame i have added JEditorPane.
>internalframe class constructor calls a method makeActionsPretty().Null pointer exception occurs in the makeActionsPretty()in the line :-
>a=getTextComponent().getActionMap().get(HTMLEditorKit.cutAction);
> a.putValue(Action.NAME,"Cut");
>
>how can i avoid this?
>---
>[Message sent by forum member 'manojtyagi' (manoj)]
>
>http://www.javadesktop.org/forums/thread.jspa?messageID=54021
>
>

chusir
Offline
Joined: 2005-05-26

Hi,

I encountered the same problem?
do you have any findings?