Blank Applet Screen


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Blank Applet Screen

  1. #1
    Join Date
    May 2006
    Posts
    2

    Question Blank Applet Screen

    Hi, I'm new to these boards. I am currently working on a java applet (stand alone - no html stuff) and I'm having a little problem. When I run the following code, nothing appears on the applet until i resize the frame while it's running (and then it works just fine):

    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.font.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    import java.util.Date;
    import static java.awt.BorderLayout.*;


    public class WidgetStore extends JApplet implements ActionListener
    {
    //declare variables and images
    ImageIcon introScreen = new ImageIcon("IntroScreen.gif");
    JLabel introScreenLabel = new JLabel(introScreen);

    //construct components and containers
    JButton proceedButton = new JButton("Enter");

    Container c = getContentPane();
    JPanel topIntroPanel = new JPanel();
    JPanel bottomIntroPanel = new JPanel();

    public void paint(Graphics g)
    {
    }

    public void init()
    {
    //set frame properties
    setSize(350,325);

    //create panels and add or change various components
    c.setLayout(new BorderLayout());
    topIntroPanel.setLayout(new FlowLayout());
    bottomIntroPanel.setLayout(new FlowLayout());
    c.add(topIntroPanel, NORTH);
    c.add(bottomIntroPanel, CENTER);

    topIntroPanel.add(introScreenLabel);
    topIntroPanel.setBackground(Color.black);

    bottomIntroPanel.add(proceedButton);
    bottomIntroPanel.setBackground(Color.black);
    }

    public void actionPerformed(ActionEvent e)
    {
    }
    }

    I don't understand what's causing the applet to not display anything until a resizing of the frame occurs....moving the frame around doesn't do anything either.

    All help appreciated! Thanks!

  2. #2
    Join Date
    May 2006
    Posts
    2
    Nevermind, I solved it.

Similar Threads

  1. JavaMail applet problem
    By Tataroz T. in forum Java
    Replies: 1
    Last Post: 10-20-2005, 07:19 AM
  2. AWT Applet: Copying a screen area/portion
    By jeynergilcaga in forum Java
    Replies: 3
    Last Post: 08-18-2005, 11:07 PM
  3. Blank Screen after resume
    By STSC in forum .NET
    Replies: 0
    Last Post: 03-07-2005, 04:24 PM
  4. Replies: 3
    Last Post: 08-23-2001, 12:01 PM
  5. Applet Loader Splash Screen
    By Rocco Balsamo in forum Java
    Replies: 1
    Last Post: 07-27-2000, 01:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center