Results 1 to 2 of 2
  1. #1
    mitra is offline Member
    Join Date
    Jun 2011
    Rep Power

    Default JApplet GUI problem

    Hi everybody..........

    I need some help.

    Java Code:
    import javax.swing.JApplet;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    public class JAppletDemo extends JApplet {
        JPanel panel;
        JButton btn;
        public void init(){
            this.setLayout(new BorderLayout());
            panel = new JPanel();
            btn = new JButton("CLICK !");

    When I run this program through appletviewer it shows only the JApplet and JPanel within it.
    It can't show the button at first time when its loaded. But if I change the size of the window by mouse then it shows everything on it.

    I can't understand why it does?

    suggest me please.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    On vacation
    Rep Power


    What HTML are you using to load the applet?
    The applet shows a red background and a button with this HTML

    XML Code:
    <applet code=JAppletDemo height=200 width=200></applet>

Similar Threads

  1. problem in setMnemonic for JMenu in JApplet
    By doron70 in forum AWT / Swing
    Replies: 2
    Last Post: 05-24-2011, 09:40 AM
  2. Problem with JApplet painting
    By Fuzzier in forum Java Applets
    Replies: 5
    Last Post: 07-29-2010, 08:54 PM
  3. JApplet display problem
    By Darrarski in forum New To Java
    Replies: 10
    Last Post: 06-05-2010, 07:02 AM
  4. JApplet Problem
    By tanmoy.b81 in forum AWT / Swing
    Replies: 2
    Last Post: 07-28-2008, 06:56 AM
  5. Another problem in JApplet :S
    By juju in forum Java Applets
    Replies: 2
    Last Post: 12-30-2007, 08:46 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts