Results 1 to 3 of 3
  1. #1
    CrashWave is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default JApplet only drawing 1/5 of my app and then greying out

    I have recently been programming an app for my first real java job, I am currently a student, and I've recently encountered a problem. I have been running the application using JFrame as my root component, but recently have been asked by my employer to make it available for a web application. I began the transition to JApplet and created a new class to manage my new root component. Unfortunately when I run the application as a JApplet it only draws 1/5 of my window and the rest is a grey box. When I ran it as a JFrame, it worked perfectly. Here is the code for my applet class:

    Java Code:
    import java.awt.Dimension;
    import javax.swing.*;
    public class RegApplet extends JApplet {
        public void init() {
            try {
                SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
            } catch (Exception e) { 
                System.err.println("createGUI didn't complete successfully");
        private void createGUI() {
            //Create and set up the content pane.
            RegAnalysis newContentPane = new RegAnalysis();
            newContentPane.setSize(new Dimension(750,550));

    And attached is a screenshot of the drawing problem. I would appreciate any and all input
    Last edited by Fubarable; 04-09-2011 at 09:11 PM. Reason: code tags added

  2. #2
    CrashWave is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default Attachment

    Whoops I forgot the it is.
    Attached Thumbnails Attached Thumbnails JApplet only drawing 1/5 of my app and then greying out-screenshot.jpg  

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    Moderator Edit: Code tags added to the post above.

    To the OP, in the future, to do this yourself, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.

    Another way to do this is to manually place the tags into your code by placing the tag
    Java Code:
     above your pasted code and the tag
    below your pasted code like so:

    Java Code:
      // your code goes here
      // notice how the top and bottom tags are different

    As for your problem,
    I don't see any obvious problems in the code you've posted, except perhaps your setting the size of the contentPane. The applet size is determined by the HTML code, as far as I understand it.

    Best of luck

Similar Threads

  1. disable a java.awt.Button but not greying it out
    By alinaqvi90 in forum AWT / Swing
    Replies: 4
    Last Post: 10-18-2010, 01:08 PM
  2. Add Canvas to JApplet
    By coiner in forum Java Applets
    Replies: 7
    Last Post: 01-05-2010, 12:38 AM
  3. JApplet on MAC
    By ld_pvl in forum Java Applets
    Replies: 0
    Last Post: 08-23-2009, 01:40 PM
  4. JFrame to JApplet or JApplet to JApplet
    By ramesh.8189 in forum AWT / Swing
    Replies: 13
    Last Post: 02-08-2009, 07:14 AM
  5. JApplet problems
    By Rgfirefly24 in forum New To Java
    Replies: 2
    Last Post: 04-24-2008, 07:36 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