JApplet problem

I m having a JApplet which has the following needs,
import org.uhm.entities.Person;
import org.uhm.entities.DrawInfo;
import org.uhm.entities.Course;
import org.uhm.utils.*;
and the JApplet runs well on an IDE.. but in a browser, iftstarts and i m not seeing anything.. my HTML code is,
<html>
<applet code =" org.uhmath.gui.StudentGUIApplet.class" width =" 100%" height =" 100%">
</applet>
</html>
am not including Person.class, DrawInfo.class, Course.class.. in my HTML.. is that a problem?? if it is then what shall I do??

Am still working on it and this thing is killing me.
My code generates like 11 .class files:
StudentApplet.class
StudentApplet$1.class
StudentApplet$2.class
StudentApplet$3.class
StudentApplet$4.class
StudentApplet$5.class
StudentApplet$6.class
StudentApplet$7.class
StudentApplet$8.class
StudentApplet$DrawPanel.class
StudentApplet$Receiver.class
It works fine on an IDE (Eclipse) but when I try to run it on a browser, it says the applet has started but i m not seeing anything after that. When i open the java console both in IE and Firefox there is no error message.
This is my HTML source
<html>
<head>
<title>ABCD</title>
</head>
<body>
<applet code = "org.uhmath.gui.StudentApplet.class" width = "100%" height = "100%"
archive = "gui.jar">
</applet>
</body>
</html>gui.jar contains all the above .class files and a few images. My source is StudentApplet.java which contains two inner classes DrawPanel and Receiver. My source is like 900 lines thats why i could not post it here.
I would be extremely pleased if someone can help me with this,
Thanks in advance.

Similar Messages

  • JApplet Problem PLS help

    I have a JApplet in which im putting a Panel and inside that 3 more panels. In one of the panel's when a user clicks a button I have to hide that panel and open another one HOW DO I DO THAT???
    This is what i tried but its not working????
    jContentPane=null;
    jContentPane.add(getJPanel2(), getJPanel2().getName());
    setVisible(true);
    Pleas help.

    Hi,
    when you want to replace a panel by another one int a container, you just have to do
       container.remove(oldpanel);
       container.add(newpanel);   
       // or perhaps container.add(newpanel, constraints);
       // or perhaps container.add(newpanel, index);

  • Need help for JApplet problems

    Moderator please delete this topic- I've managed to solve my problems, ironically.
    Edited by: CyberNetic on Feb 3, 2008 4:02 AM

    Well you need to uninstall the audigy drivers then boot into bios enable onboard sound again. Boot to OS uninstall Nvidia "AUDIO" driver reboot back to bios and disable onboard sound, Boot To OS and reinstall the audigy card.  Just becasue that onboard sound is disabled in bios does not mean anything when windows doing that just disables the hardware part not the software (drivers).  You can uninstall drivers easy in Device manager

  • Swing layout/size problem with JFrame and JApplet.

    I have a class that extends a JFrame, the classes layout is BorderLayout. I then have a class that extend JApplet, this classes layout is GridBagLayout (this class has a JTabbedPane - which contains JPanels). The problem I'm having is no matter how big I make the size of the applet or frame (using setSize), the applet/frame stays the same size - no matter how large I make it.
    Can anyone please help?
    Thanks,
    dosteov

    Here is the basic code:
    Thanks in advance,
    dosteov
    public class EADAdm extends JApplet
    EADAdmFrame theFrame = new EADAdmFrame(this);
         public void init()
              // Take out this line if you don't use symantec.itools.net.RelativeURL or symantec.itools.awt.util.StatusScroller
    //          symantec.itools.lang.Context.setApplet(this);
              // This line prevents the "Swing: checked access to system event queue" message seen in some browsers.
              getRootPane().putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
              // This code is automatically generated by Visual Cafe when you add
              // components to the visual environment. It instantiates and initializes
              // the components. To modify the code, only use code syntax that matches
              // what Visual Cafe can generate, or Visual Cafe may be unable to back
              // parse your Java file into its visual environment.
              //{{INIT_CONTROLS
              getContentPane().setLayout(new GridBagLayout());
              setEnabled(false);
              getContentPane().setBackground(java.awt.Color.lightGray);
              setSize(800,800);
              getContentPane().add(AdmTab, new com.symantec.itools.awt.GridBagConstraintsD(0,1,2,1,0.5,0.5,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.HORIZONTAL,new Insets(3,12,4,14),120,120));
              AdmTab.setFont(new Font("Dialog", Font.PLAIN, 12));
              titleLbl.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
              titleLbl.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
              titleLbl.setText("EAD Administration");
              getContentPane().add(titleLbl, new com.symantec.itools.awt.GridBagConstraintsD(0,0,1,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(12,36,0,0),307,15));
              titleLbl.setForeground(java.awt.Color.blue);
              titleLbl.setFont(new Font("Dialog", Font.BOLD, 15));
              exitBtn.setText("Exit EAD Administration");
              exitBtn.setActionCommand("Exit EAD Administration");
              getContentPane().add(exitBtn, new com.symantec.itools.awt.GridBagConstraintsD(0,2,2,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(6,371,10,14),66,8));
              exitBtn.setFont(new Font("Dialog", Font.PLAIN, 12));
         //theFrame.setVisible(false);
         login();
         AdmTab.addTab("Administration", new LogoPanel() );
         userPanel = createUserPanel();
         AdmTab.addTab("Edit Users", userPanel );
         fpoPanel = createFPOPanel();
         AdmTab.addTab("Edit FPO", fpoPanel );
         regulationPanel = createRegulationPanel();
         AdmTab.addTab("Edit Regulations", regulationPanel );
         rolloverPanel = createRolloverPanel();
         AdmTab.addTab("Rollover", rolloverPanel );           
              //{{REGISTER_LISTENERS
         SymMouse aSymMouse = new SymMouse();
              this.addMouseListener(aSymMouse);
              SymAction lSymAction = new SymAction();
              exitBtn.addActionListener(lSymAction);
              SymKey aSymKey = new SymKey();
              this.addKeyListener(aSymKey);
         theFrame.getContentPane().add(this);
    public class EADAdmFrame extends JFrame
    EADAdm theApplet;
    public EADAdmFrame(EADAdm theMainApplet)
              //{{INIT_CONTROLS
         //     theApplet = theMainApplet;
         //     this.getContentPane().add(theApplet);
              getContentPane().setLayout(new BorderLayout(0,0));
              getContentPane().setBackground(java.awt.Color.lightGray);
              setSize(1000,1000);
              setVisible(false);
         theApplet = theMainApplet;
              //{{REGISTER_LISTENERS
              SymWindow aSymWindow = new SymWindow();
              this.addWindowListener(aSymWindow);
              SymComponent aSymComponent = new SymComponent();
              this.addComponentListener(aSymComponent);

  • Problem with Thread in JApplet

    Hi,
    I am working on a project on pseudo random functions, and for that matter I have written a problem. Now I am working on a user interface (JApplet) for my program. Because some heavy calculations can occur, I want to keep track of the progress, and show that in my JApplet. To do so, I start a Thread in which the calculations take place. In my JApplet I want to show every second how far the proces is done. The strange thing is, that the status JLabel only appears when the whole proces is done, and the start button keeps pressed during the proces. If I run this in the applet viewer, I can see the status every second in my command box. You can see the applet here : applet
    The code concerning the start button's actionlistener (entire appletcode: [applet code|http://www.josroseboom.nl/PseudoRandomClusteringApplet.java]) :
              if(e.getSource()==start)
                   int[][] randomFuncties = new int[current+1][5];
                   int puntenHuidige, g, q, y, m, f;
                   boolean done;
                   Kern k;
                   for(int i = 0;i<=current;i++)
                        randomFuncties[i] = functies.getValues();
                   invoer.remove(knopjes);
                   startTijd = System.currentTimeMillis();
                   proces.setBounds(25,(current+4)*25, 2*this.getWidth()/3,75);
                   invoer.add(proces);
                   this.validate();
                   this.repaint();
                   for(int i = 0;i<=current;i++)
                        puntenHuidige = 0;
                        f = randomFuncties[i][0]; // important for instantiation of k, which is cut out here
                        done = false;
                        k.start();     // k is a Thread where heavy calculations are done
                        ((JLabel)(proces.getComponent(2))).setText("points done of current (" + q + ")");
                        this.repaint();
                        while(!done)
                             ((JLabel)(proces.getComponent(1))).setText("" + convertTime(System.currentTimeMillis() - startTijd));
                             ((JLabel)(proces.getComponent(3))).setText("" + k.getPuntenGehad()); // get the point done so far
                             ((JLabel)(proces.getComponent(5))).setText("" + ((100*k.getPuntenGehad())/q) + "%");
                             debug("q: " + q);
                             debug("point done: " + k.getPuntenGehad());
                             if(k.getPuntenGehad()==q)     //if all points are considered
                                  done=true;
                             this.validate();
                             this.repaint();
                             try
                                  Thread.sleep(1000);
                             catch(InterruptedException exception)
                                  debug("foutje met slapen: InterruptedException");
                             catch(IllegalMonitorStateException exception)
                                  debug("foutje met wachten: IllegalMonitorStateException");
                             debug("IN APPLET: yet another loop walk");
                        stringResultaten.add(k.geefResultaat());
                   klaarLabel.setBounds(this.getWidth()/4,(current+8)*25, this.getWidth()/2,25);
                   naarResultaat.setBounds(25+this.getWidth()/4,(current+9)*25, this.getWidth()/4,25);
                   invoer.add(klaarLabel);
                   invoer.add(naarResultaat);
                   this.validate();
                   this.repaint();
    Edited by: Jos on Sep 19, 2007 1:22 AM

    Never do anything that takes more than a fraction of a second in an actionPerformed method or similar GUI callback.
    The GUI stuff is all handled by a single thread called the "AWT Dispatcher" thread. That includes code in such callbacks. While it's executing your callback it can't do any kind of screen updating or response to other user events.
    Instead your actionPerformed should work with a separater "worker" thread, either it should launch a new thread, or release one you create (using wait and notify). Then, it returns without waiting. When the worker thread wants to update the GUI it uses EventQueue.invokeLater() or invokeAndWait() to run some (fast) code on the Dispatcher thread.

  • Weird problem with JApplet

    I'm having a weird problem with JApplet. So first I create an Applet with this code
    public class japp extends JApplet {
         public void init() {
              Container content=getContentPane();
              JButton jb=new JButton("Hello");
              content.add(jb);
    }and with this in the .html file;
    <html>
    <body>
    <APPLET CODE="japp.class" WIDTH="650" HEIGHT="500"></APPLET>
    </body>
    </html>
    And opened it in Firefox, it worked as expected. However, when I change the code in any way, i.e.
    public class japp extends JApplet {
         public void init() {
              Container content=getContentPane();
              JButton jb=new JButton("Goodbye");
              content.add(jb);
    }and compile it, it still shows the old button that displays "Hello". I've tried deleting the .class file from before and recompiling, that doesn't work. What am I doing wrong?
    Thanks.

    Reloading the page usually doesn't work. You will need to open the Java Console and clear classloader cache (x). You can also use appletviewer for testing purposes.

  • Problem while loading a JApplet ( which uses JAI ) on Netscape across ssl

    Hi Folks...
    I m having some problem in applet.. can any1 of u guys help me???? My problem is as follows..
    I m having 2 JApplets (Swing applet) one of the applet is using JAI (Java Advance Imaging APIs). I m trying 2 load both the applets in IE as well as in Netscape across SSL (ie thru https protocol) .Both the applet can be loaded on IE across SSL. but when i m trying to load the applet on Netscape, one of the applet which is using JAI is not getting loaded across SSL. The other applet which is not using JAI is running fine across SSL on Netscape also.
    I m getting some exception.. Is this exception comming bcoz JAI is not compatible with Netscape r bcoz of somethinf else??? If it is bcoz of the fact that Netscape does'nt have any support for JAI across SSL. then watz the possible solution 4 that. How can i overcome by this problem. Its very urgent.. i need to do it any how... Plz plz help me out if u guys have any idea abt this.. any help is most welcome..
    My ids r
    [email protected]
    [email protected]
    tks...
    Jameel

    Exactly what exception are you getting? That will really help in determining the problem. Also, do you have the same problems when going over a regular connection (i.e. not over SSL)?
    Kate

  • Strange JScrollPane problem in JApplet

    I've got a JApplet which is giving me a strange problem with the scrollbar of a JScrollPane. The JScrollPane is populated with a JList whose ListModel is a DefaultListModel. I specify to always show the vertical and never show the horizonatal scroll bars.
    Once the JList content goes beyond the visible range of the viewport, it seems to be working as usual - the scrollbar reflects the amount of content. However, if I click on the scroll arrows, nothing happens. And, if I click on the scroll bar itself, it disables. Basically, the scrolling portion of the component dies. I don't get any exceptions during runtime or problems compiling the code.
    I've tried making the ListModel and JList as dynamic elements (i.e. not members of the class). I've tried adding .validate(). I've tried everything of which I can think. I'm at a loss. The most troubling part of this is that if the project is set up as an application instead of an applet, it works fine.
    I'm using J2 1.6.
    Here's sample code that reproduces the problem:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ScrollTest extends JApplet
      private DefaultListModel exOddLM;
      private JList            exOddJL;
      private JScrollPane      exOddSP;
      private JButton          click;
      public ScrollTest() {
        this.setup();
      public void init() {
        this.setup();
      public void setup() {
        this.setLayout(null);
        this.setSize(400, 442);
        this.exOddLM = new DefaultListModel();
        this.exOddJL = new JList(this.exOddLM);
        this.exOddSP = new JScrollPane(this.exOddJL);
        this.exOddSP.setBounds(0, 0, 200, 200);
        this.exOddSP.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        this.exOddSP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        this.click   = new JButton("add more");
        this.click.addMouseListener(new MouseAdapter() {
          public void mouseClicked(MouseEvent me) { addMore(); }
        this.click.setBounds(0, 200, 200, 18);
        this.add(this.exOddSP);
        this.add(this.click);
      private void addMore() {
        for(int x = 0; x < 5; x++) {
          this.exOddLM.addElement(Integer.toString(x));
    }

    It had to be something simple, didn't it? (=
    Thanks!
    I guess I was thinking that an applet wouldn't call the constructor. Don't know why I would have thought that. After removing the double call, it works great.
    Thanks again Rodney!!!
    You know, this actually explains a good deal of other problems I was having with the actual program (a homework assignment). One of them, I had added a KeyListener to an entry field on the form, and it was giving me all sorts of weird double-letter posts and letter-delete problems.
    This also explains why it was working well as an application.

  • Problems with JApplet, jar-Archive, packages and IE5

    Hello!
    I have a problem with a JApplet and Internet Explorer 5. I made a jar archive of my classes. The classes are
    members of a package. The jar archive also contains images.
    The structure of the archive:
    com/mycomp/myapp/DemoApplication.class
    com/mycomp/myapp/DemoApplet.class
    <more classes>
    com/mycomp/myapp/images/hp_logo.gif
    com/mycomp/myapp/images/test.gif
    <more images>
    The archive is stored locally in a directory which contains also the html file.
    I used the sdk 1.3.1 to compile the classes.
    My problem: when I start the html file on NT with IE5, I get the error message below:
    I try to create a label containing an icon with:
    topLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("images"+fs+"hp_logo.gif")));It works on Sun with Netscape 4.67 and SDK 1.3.1 installed.
    Should I move the images directory inside the jar archive to another place or is the html code not correct?
    The error message:
    java.lang.NullPointerException
         at javax.swing.ImageIcon.<init>(Unknown Source)
         at com.mycomp.myapp.DemoApplication.initComponents(DemoApplication.java:158)
         at com.mycomp.myapp.DemoApplication.<init>(DemoApplication.java:55)
         at com.mycomp.myapp.DemoApplet.<init>(DemoApplet.java:24)
         at java.lang.Class.newInstance0(Native Method)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)The html file:
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
    <html>
      <head>
        <title>DemoApplet</title>
      </head>
      <body>
    <BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#37a1a7">
          <h1>DemoApplet</h1>
          <!--"CONVERTED_APPLET"-->
    <!-- HTML CONVERTER -->
    <SCRIPT LANGUAGE="JavaScript"><!--
        var _info = navigator.userAgent; var _ns = false; var _ns6 = false;
        var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
    //--></SCRIPT>
    <COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
        var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0)));
        var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
    //--></SCRIPT></COMMENT>
    <SCRIPT LANGUAGE="JavaScript"><!--
        if (_ie == true) document.writeln('<OBJECT classid="clsid:CAFEEFAC-0013-0001-0000-ABCDEFFEDCBA" WIDTH = 695 HEIGHT = 525  codebase="http://java.sun.com/products/plugin/1.3.1/jinstall-131-win32.cab#Version=1,3,1,0"><NOEMBED><XMP>');
        else if (_ns == true && _ns6 == false) document.writeln('<EMBED type="application/x-java-applet;jpi-version=1.3.1"  CODE = com.mycomp.myapp.DemoApplet CODEBASE = "." ARCHIVE = "DemoApplet.jar,classes12.zip" WIDTH = 800 HEIGHT = 600  scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3.1/plugin-install.html"><NOEMBED><XMP>');
    //--></SCRIPT>
    <APPLET  CODE = com.mycomp.myapp.DemoApplet CODEBASE = "." ARCHIVE = "DemoApplet.jar,classes12.zip" WIDTH = 695 HEIGHT = 525></XMP>
    <PARAM NAME = CODE VALUE = com.mycomp.myapp.DemoApplet >
    <PARAM NAME = CODEBASE VALUE = "." >
    <PARAM NAME = ARCHIVE VALUE = "DemoApplet.jar,classes12.zip" >
    <PARAM NAME="type" VALUE="application/x-java-applet;jpi-version=1.3.1">
    <PARAM NAME="scriptable" VALUE="false">
    </APPLET>
    </NOEMBED></EMBED></OBJECT>
    <!--
    <APPLET CODE = DemoApplet CODEBASE = "." ARCHIVE = "DemoApplet.jar,classes12.zip" WIDTH = 695 HEIGHT = 525>
    </APPLET>
    -->
    <!--"END_CONVERTED_APPLET"-->
      </body>
    </html>Thank you for your help!
    Gruesse,
    Torsten

    seems like it couldn't find the image file... try to give it the absolute path to the file first to see if this is the root of the problem... and then try to find alternative ways to not give it the absolute path...

  • JApplet debugging problem

    Hi there all:
    I'm having a problem with debugging a JApplet. I created a new workspace, project and applet and didn't make any changes to anything. When I try to debug the applet, I get these messages:
    System Error: java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup )
    System Error: java.lang.Object java.lang.Class.newInstance0()
    System Error: java.lang.Object java.lang.Class.newInstance()
    System Error: java.applet.Applet sun.applet.AppletPanel.createApplet(sun.applet.AppletClassLoader)
    System Error: void sun.applet.AppletPanel.runLoader()
    System Error: void sun.applet.AppletPa
    System Error: nel.run()
    System Error: void java.lang.Thread.run()
    If I change the object from a JApplet class to an Applet class, I can debug just fine.
    Anyone know what's going on here?
    Thanks
    Jeff

    Me again. Was doing some searching on the net about this one since I've gotten no response.
    Found this at Inprise (Borland) about a debugging problem with JBuilder3 (I assume that the base of jdev is still JBuilder).
    http://community.borland.com/article/0,1410,19739,00.html
    To quote from their document--------
    Question:
    I can't seem to debug Applets with JBuilder3 Standard. If I attempt to debug my Applet
    I recieve the following error:
    java.security.AccessControlException: access denied (java.lang.RuntimePermission
    modifyThreadGroup )
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:195)
    at java.security.AccessController.checkPermission(AccessController.java:403)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
    Why?
    Answer:
    In a nutshell this is an installation problem with JBuilder3 Standard edition.
    The install for JBuilder3 Standard did not provide the file 'DebugApplet.policy'.
    To resolve this problem download the file from the following URL:
    http://www.borland.com/devsupport/jbuilder/downloads/DebugApplet.policy
    After you have downloaded the file, copy the file to your JBuilder3\bin directory.
    This will fix the problem.
    You can also cut and paste the following:
    (NOTE: create the file DebugApplet.policy in your JBuilder3\bin directory)
    //DebugApplet.policy
    // These policy permissions are needed for the AppletViewer used by sun.tools.debug.
    grant {
    permission java.lang.RuntimePermission "accessClassInPackage.*";
    permission java.lang.RuntimePermission "modifyThread";
    permission java.lang.RuntimePermission "modifyThreadGroup";
    permission java.net.SocketPermission "*", "accept, connect, listen, resolve";
    permission java.util.PropertyPermission "appletviewer.version", "read";
    permission java.io.FilePermission "<>", "read";
    permission java.security.AllPermission;
    Could this be a problem in JDev3 too?
    Jeff
    null

  • JApplet to HTML conversion problems

    Hello,
    I am facing the following problem:
    I built a Swing based GUI application in a package and when I convert it to HTML the system cannot find the appropriate images. Here is a simplified version
    package mypackage;
    import javax.swing.JApplet;
    import javax.swing.*;
    import java.awt.*;
    public class MyApplet extends JApplet
    public void init() {
    getContentPane().add(new JLabel("Hello",new ImageIcon("images/myimage.gif"),
    JLabel.CENTER));
    Images are in the ../mypackage/images directory and the SunJavaConsole shows always the following error
    java.security.AccessControlException: access denied (java.io.FilePermission images/myimage.gif read)
    I would like to say that the above sample code is working without the newImageIcon reference.
    I appreciate any suggestion or help
    Christos

    crosspost http://forum.java.sun.com/thread.jsp?forum=31&thread=492978&tstart=0&trange=30

  • JTextField focus problems in JApplet

    I have a JApplet like this:
    public class AppletLogin extends JApplet {
    public void init() {
    this.setSize(new Dimension(400,300));
    this.getContentPane().setLayout(new FlowLayout());
    this.getContentPane().add(new JTextField(12));
    this.getContentPane().add(new JTextField(12));
    The first problem I have is that both JTextField don't show the cursor if you click in them, they also don't show selected text. If you select another window and then you select back the browser, the cursor appears.
    The second problem is that sometimes, if the cursor appears in the first JTextField and with the TAB or with the mouse you set the focus on the second JTextField, then you can't focus back to the first JTextField. This second problem disappears if you add "this.requestFocus()" in init.
    This behaviour is shown in Windows NT 4.0 and 98 with Netscape 4.7 and 6.2.
    I don't have this problem in Windows 2000 - Netscape 4.7 / 6.2 and Linux - Netscape 6.2.
    The Plugin is 1.3.1_01a and 1.3.1_02.
    I think I have the same problem explained in bug 4186928 but with a JApplet. I have tried the "dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_ACTIVATED))" workaround, using the 'SwingUtilities.getWindowAncestor(this)' Window, but it doesn't
    work.
    Any suggestions to solve the first problem? Should I submit a bug?

    Of course. Here is the original code. I have only removed 'imports' from other classes of the project used for localization and image loading.
    If you want me to translate for you the Spanish comments to English, please tell me.
    This is the code as is now. I have already tried 'requestFocus' and 'grabFocus' even inside a MouseListener attached to 'usuario' (user) and 'clave' (passwd), with no success.
    This code works fine with 1.2.2 plug-in on any OS and with 1.3.1_02 plug-in on Windows 2000 and Linux.
    But with 1.3.1_02 plug-in under Windows 98/NT4.0 and Netscape 4.7/6.2 the focus is crazy. Our customer uses Windows NT 4.0.
    This panel is for user and passwd validation. We use it attached to an JApplet. It has some methods to attach ActionListener to it. It also has a KeyListener to capture 'intro' events. Thats all.
    package project.pkg
    import java.util.TooManyListenersException;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyEvent;
    import java.awt.event.ComponentAdapter;
    import java.awt.event.ComponentEvent;
    import javax.swing.border.EmptyBorder;
    // import of other.project.pkg
    // import of other.project.pkg
    import javax.swing.*;
    import java.awt.*;
      * Panel de acceso a la aplicaci�n.
      * @version  $Revision: 1.8 $
    public class PanelAcceso extends JRootPane {
       // Marca de revision. ///////////////////////////////
       private final static String VERSION = "@(#) $Id: PanelAcceso.java,v 1.8 2001/05/08 15:55:46 user Exp $";
       /** Campo usuario */
       private JTextField usuario;
       /** Campo clave */
       private JTextField clave;
       /** Panel de los controles */
       private JPanel controles;
       /** Panel auxiliar marco para controles. */
       private JPanel marco;
       /** ActionListener para notificaci�n de intro. de usuario y passwd */
       private ActionListener entrarActionListener = null;
        * Construye un panel de acceso.
       public PanelAcceso() {
         JLabel portada = new JLabel(/*HERE goes an ImageIcon*/);
         portada.setHorizontalAlignment( SwingUtilities.CENTER);
         portada.setVerticalAlignment( SwingUtilities.CENTER);
         getContentPane().setLayout( new BorderLayout());
         getContentPane().add( portada, BorderLayout.CENTER);
         getContentPane().setBackground( Color.white);
         controles = new JPanel();
         controles.setLayout(new GridLayout(4,2,5,5));
         controles.setOpaque(false);
         controles.add( new JLabel("Ver. 2.5.1"));
         controles.add(Box.createHorizontalGlue());
         controles.add(Box.createHorizontalGlue());
         controles.add(Box.createHorizontalGlue());
         controles.add( new JLabel("User") );
         usuario = new JTextField( 12);
         usuario.addKeyListener(keyListener);
         controles.add( usuario);
         controles.add( new JLabel("Passwd") );
         clave = new JPasswordField( 12);
         clave.addKeyListener(keyListener);
         controles.add( clave);
         // Panel auxiliar marco para controles.
         marco = new JPanel(new FlowLayout(FlowLayout.RIGHT));
         marco.setOpaque(false);
         marco.add(controles);
         setGlassPane(marco);
         // Listener para fijar el borde de marco seg�n cambie de
         // tama�o el panel.
         marco.addComponentListener( new ComponentAdapter() {
           public void componentResized(ComponentEvent e) {
             changeEmptyBorder();
           public void componentShown(ComponentEvent e) {
             changeEmptyBorder();
         marco.setVisible(true);
        * Devuelve el usuario introducido.
       public String getUser() {
         return usuario.getText();
        * Devuelve la contrase�a introducida.
       public String getPasswd() {
         return clave.getText();
        * Limpia el panel de acceso.
       public void limpiar() {
         clave.setText("");
         usuario.setText("");
        * A�ade un listiener a los eventos de
        * petici�n de acceso dado un usuario y
        * una contrase�a.
        * @throws TooManyListenersException si ya se ha a�adido un listener.
       public void addEntrarListener(ActionListener l) throws TooManyListenersException {
         if ((entrarActionListener != null) && (entrarActionListener != l))
           throw new TooManyListenersException("Solo se admite un listener");
         else
           entrarActionListener = l;
        * Borra un listener.
       public void removeEntrarListener(ActionListener l) {
         if (entrarActionListener == l)
           entrarActionListener = null;
         else
           throw new IllegalArgumentException("Intento de borrar un listener no a�adido");
        * Borra todos los listeners.
       public void removeEntrarListeners() {
         entrarActionListener = null;
        * Instancia privada de KeyListener para capturar
        * los 'enter' en los campos de usuario y passwd.
       private KeyListener keyListener = new KeyListener() {
          * Method to handle events for the KeyListener interface.
          * @param e KeyEvent
         public void keyPressed(KeyEvent e) {
           if (e.getKeyCode() != KeyEvent.VK_ENTER)
             return;
           if ((e.getSource() == usuario) )
             clave.requestFocus();
           else {
             requestFocus(); // Se evitan varias pulsaciones seguidas.
             if (entrarActionListener != null)
               entrarActionListener.actionPerformed(new ActionEvent(this, 0, ConstantesXigus.ACCION_ENTRAR));
         /** Method to handle events for the KeyListener interface. */
         public void keyReleased(KeyEvent e) {}
         /** Method to handle events for the KeyListener interface. */
         public void keyTyped(KeyEvent e) {}
        * Ajusta el borde del marco de controles para que aparezcan centrados.
       private void changeEmptyBorder() {
         Dimension dimMarco   = marco.getSize();
         Dimension dimInterno = controles.getPreferredSize();
         int altoBorde  = dimMarco.height - dimInterno.height;
         int anchoBorde = (dimMarco.width - dimInterno.width)/2;
         marco.setBorder( new EmptyBorder( (int)(altoBorde * 0.75), anchoBorde, (int)(altoBorde * 0.25), anchoBorde));
    }Thank you very much for your help

  • JApplet initialization problem

    I am experiencing a problem with a JApplet that has me perplexed... I wrote the JApplet to act as a front end to a servlet. I am using the Jakarta Tomcat server to execute both the servlet and to serve the web page which contains the applet. The html page containing the applet has been configure to load the latest JRE plugin into a users browser, if need be, and that works OK. When I run the applet from a browser on my own system, I don't have any problems, but when I tried to load the applet over the internet, at a friends house, I get the following walkback... Seems to be complaining about a "no proxy"... Can anyone tell me what this means? The applet does use Swing components, but my understanding is that is OK so long as the latest JRE plugin is installed. My server is up an down a lot, as I develop this application, but you are free to give the applet a try and let me know what you see... The URL is http://www.marcchamberlin.com/control.htm and don't be surprised that it is slow to respond, that is done on purpose so give it a minute... Any help would be much appreciated... ;-)
    Opening http://www.marcchamberlin.com/javax/swing/JApplet.class no proxy
    load: class DisplayStarChart.class not found.
    java.lang.ClassNotFoundException: DisplayStarChart
    at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:385)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:462)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:395)
    at sun.applet.AppletPanel.run(Compiled Code)
    at java.lang.Thread.run(Thread.java:474)
    P.S. What are Duke Dollars???? Seems to be a lack of documentation about them ;-)

    Seems to work OK for me. I got the applet, no problem, and the star-chart was a grey area with the text "star chart goes here". Eventually, the real star-chart appeared (and mighty cool iot looked, too ;-). Here's the output from my Java console:
    Servlet URL = http://www.marcchamberlin.com/servlet/StarChartServlet
    Servlet URL = http://www.marcchamberlin.com/servlet/StarChartServlet
    Attempting to connect to Star Chart Servlet
    Attempting to connect to Star Chart Servlet
    Connection to servlet has succeeded!
    Servlet URL = http://www.marcchamberlin.com/servlet/StarChartServlet?user=userIdent&move=RA%3A+19h30m00.00sDEC%3A+%2B0%B00%270.0%22FOV%3A%2B20%B000%2700%22&date=2001-6-1T10%3A54%3A11
    Attempting to connect to Star Chart Servlet
    Connection to servlet has succeeded!
    Maybe the "no proxy" thing on your friend's system is because he/she is behind some kind of "difficult"' firewall, or the ISP has some strange proxy setup or something?? (I'm using a router as a firewall, and have no proxy set up). Anyway, I get the impression that it's the hardware, not your software, that is the problem. Maybe try it from somewhere else (the local library?!?)

  • JApplet focussing problem

    I have a JApplet in which i have a JTabbedPane. My problem is that in Internet Explorer the focus does not stay on the applet and i have to click on the applet to activate it first and then i can use it. Can anyone tell me how to set the focus on the applet when it loads.

    does using requestFocusInWindow have some pre conditions. It did not workNo.
    post a sample program that we can compile and run
    just the gui stuff, that way we can see how you're adding what to where
    Message was edited by:
    Michael_Dunn
    I said no, but yes, the component has to be displayable/ visible etc
    as per the api docs
    the timer should overcome that, but if the timer didn't work,
    then posting your code would quicken a solution

  • (Another) problem with custom painting using JApplet and JPanel

    Hi all,
    I posted regarding this sort of issue yesterday (http://forums.sun.com/message.jspa?messageID=10883107). I fixed the issue I was having, but have run into another issue. I've tried solving this myself to no avail.
    Basically I'm working on creating the GUI for my JApplet and it has a few different JPanels which I will be painting to, hence I'm using custom painting. My problem is that the custom painting works fine on the mainGUI() class, but not on the rightGUI() class. My code is below:
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.imageio.*;
    public class TetrisClone extends JApplet {
         public void init() {
              setSize( 450, 500 );
              Container content = getContentPane();
              content.add( new mainGUI(), BorderLayout.CENTER );
              content.add( new rightGUI() , BorderLayout.LINE_END );
    class mainGUI extends JPanel {
         // Main bit where blocks fall
         public mainGUI() {
              setBackground( new Color(68,75,142) );
              setPreferredSize( new Dimension( 325, 500 ) );
              validate();
         public Dimension getPreferredSize() {
              return new Dimension( 450, 500 );
         public void paintComponent( Graphics g ) {
              super.paintComponent(g);
              // As a test. This shows up fine.
              g.setColor( Color.black );
              g.fillRect(10,10,100,100);
              g.setColor( Color.white );
              g.drawString("Main",45,55);
    class rightGUI extends JPanel {
         BufferedImage img = null;
         int currentLevel = 0;
         int currentScore = 0;
         int currentLines = 0;
         public rightGUI() {
              // The right panel. Has quite a few bits. Starts here..
              FlowLayout flow = new FlowLayout();
              flow.setVgap( 20 );
              setLayout( flow );
              setPreferredSize( new Dimension( 125, 500 ) );
              setBackground( new Color(27,34,97) );
              setBorder( BorderFactory.createMatteBorder(0,2,0,0,Color.black) );
              // Next block bit
              JPanel rightNext = new JPanel();
              rightNext.setPreferredSize( new Dimension( 100, 100 ) );
              //rightNext.setBackground( new Color(130,136,189) );
              rightNext.setOpaque( false );
              rightNext.setBorder( BorderFactory.createEtchedBorder(EtchedBorder.LOWERED) );
              Font rightFont = new Font( "Courier", Font.BOLD, 18 );
              // The player's playing details
              JLabel rightLevel = new JLabel("Level: " + currentLevel, JLabel.LEFT );
              rightLevel.setFont( rightFont );
              rightLevel.setForeground( Color.white );
              JLabel rightScore = new JLabel("Score: " + currentScore, JLabel.LEFT );
              rightScore.setFont( rightFont );
              rightScore.setForeground( Color.white );
              JLabel rightLines = new JLabel("Lines: " + currentLines, JLabel.LEFT );
              rightLines.setFont( rightFont );
              rightLines.setForeground( Color.white );
              JPanel margin = new JPanel();
              margin.setPreferredSize( new Dimension( 100, 50 ) );
              margin.setBackground( new Color(27,34,97) );
              JButton rightPause = new JButton("Pause");
              try {
                  img = ImageIO.read(new File("MadeBy.gif"));
              catch (IOException e) { }
              add( rightNext );
              add( rightLevel );
              add( rightScore );
              add( rightLines );
              add( margin );
              add( rightPause );
              validate();
         public Dimension getPreferredSize() {
                   return new Dimension( 125, 500 );
         public void paintComponent( Graphics g ) {
              super.paintComponent(g);
              g.setColor( Color.black );
              g.drawString( "blah", 425, 475 ); // Doesn't show up
              g.drawImage( img, 400, 400, null ); // Nor this!
              System.out.println( "This bit gets called fine" );
    }Any help would be greatly appreciated. I've read loads of swing and custom painting tutorials and code samples but am still running into problems.
    Thanks,
    Tristan Perry

    Many thanks for reminding me about the error catching - I've added a System.out.println() call now. Anywhoo, the catch block never gets run; the image get call works fine.
    My problem was/is:
    "My problem is that the custom painting works fine on the mainGUI() class, but not on the rightGUI() class. My code is below:"
    I guess I should have expanded on that. Basically whatever I try to output in the public void paintComponent( Graphics g ) method of the rightGUI class doesn't get output.
    So this doesn't output anything:
    g.drawString( "blah", 425, 475 ); // Doesn't show up
    g.drawImage( img, 400, 400, null ); // Nor this!
    I've checked and experimented with setOpaque(false), however this doesn't seem to be caused by any over-lapping JPanels or anything.
    Let me know if I can expand on this :)
    Many thanks,
    Tristan Perry
    Edited by: TristanPerry on Dec 10, 2009 8:40 AM

Maybe you are looking for

  • How to get the pop up of Down Payment Clearing while posting an Invoice using MIRO tcode

    Hi, I am having a requirement where I need to display the Down Payment Clearing pop up. Scenario: While posting an Invoice, user have to check whether he had done any downpayment for the Purchase Order, if so, then there will be a Information display

  • How to read the contents of an object?

    A method returns a collection of objects. I used Iterator to read an Object from Collection. Then I used Object.toString() to read the object. The output I get is something like this: com.regis.resp.RegistryError@1683e80[message=Parameter value polic

  • How to not display radio buttons in the select many shuttle component

    Hi all, af:selectManyShuttle is a true nice component. For business / UI ergo reasons I've decided to not display the radio buttons before each item. There's no option to do that. Is it possible ? How ? Regards Luc-

  • JSP and PHP together?

    hi all, can we use an utility developed in php in our jsp web application. thanks yashvant

  • Java plug-in not working in Lion!?!

    Websites that run with a Java plug-in aren't working now with Lion. I've tried all the different browsers, and nothing works. Coupon sites and others don't work. No updates found. Would really appreciate some help!!