#267 run as applet doesn't seem to work with javax.swing

open
nobody
5
2011-01-12
2011-01-12
No

Hi.. I have been using Dr Java to teach my daughter the rudiments of programming. Everything worked fine using simple examples based around java.awt. However we cannot get applets to run properly if they include javax.swing and JApplet etc.. they compile ok.. (I am using jdk 1.6.0 in the Dr Java ide) but when we 'run as applet ' they don't work. The applet viewer comes up and has the applet content dumped on top of the background eg the dr java ide screen. The same programs run fine embedded in html page and run at the command line so the problem seems to be in dr java 'run as applet'. I would appreciate any help you could give me to resolve this as dr Java is a nice straightforward ide for her to start programming. Thank you.

Discussion

  • Mathias Ricken

    Mathias Ricken - 2011-01-12

    We need to know a little bit more about your system to help you. Please go to "Help -> About" on the menu and click on "System Properties". Then, click the "Copy System Properties" button and paste the results here in a new comment.

    Thanks,
    The DrJava Team

     
  • Mathias Ricken

    Mathias Ricken - 2011-01-12

    Please zip up the source files you are using and attach them to this website (or email them to drjava@rice.edu).

     
  • Mathias Ricken

    Mathias Ricken - 2011-01-14

    its basically as I said: Any code however brief with javax.swing doesn' 'Run as Applet' properly.. the applet runs on top of the background screen.
    Eg:
    import java.awt.*;
    import javax.swing.*;
    public class First extends JApplet
    {

    String text = "Hello Everybody this works ok.";
    public void paint(Graphics g)
    {

    g.drawString(text,15,20);
    g.drawString(text,15,50);
    }
    }
    Here is system information:
    OS Name Microsoft Windows XP Professional
    Version 5.1.2600 Service Pack 2 Build 2600
    OS Manufacturer Microsoft Corporation
    System Name VAIO_AG
    System Manufacturer Sony Corporation
    System Model VGN-BX61MN
    System Type X86-based PC
    Processor x86 Family 6 Model 15 Stepping 13 GenuineIntel ~1396 Mhz
    Processor x86 Family 6 Model 15 Stepping 13 GenuineIntel ~1396 Mhz
    BIOS Version/Date Phoenix Technologies LTD R0210X9, 20/11/2007
    SMBIOS Version 2.4
    Windows Directory C:\WINDOWS
    System Directory C:\WINDOWS\system32
    Boot Device \Device\HarddiskVolume2
    Locale United Kingdom
    Hardware Abstraction Layer Version = "5.1.2600.2765 (xpsp.050928-1517)"
    User Name VAIO_AG\AG
    Time Zone GMT Standard Time
    Total Physical Memory 1,024.00 MB
    Available Physical Memory 322.05 MB
    Total Virtual Memory 2.00 GB
    Available Virtual Memory 1.96 GB
    Page File Space 2.38 GB
    Page File C:\pagefile.sys

     
  • Mathias Ricken

    Mathias Ricken - 2011-01-14

    I don't understand what you mean by "the applet runs on top of the
    background screen". What is "the background screen" and what is it
    supposed to do?

    I compiled and ran the source code below, and it's doing what I expect
    it would do. Please take a look at the attached screenshot. What are
    DrJava and the applet doing when you run it?

    Could you also please provide me with the DrJava system properties,
    which contains more information about DrJava internals. Please go to
    "Help -> About" on the menu and click on "System Properties". Then,
    click the "Copy System Properties" button and include the results in
    your email reply.

    Thanks!

     

Log in to post a comment.