Results 1 to 5 of 5
  1. #1
    wikidjeff is offline Member
    Join Date
    Oct 2010
    Posts
    3
    Rep Power
    0

    Default Java Applet Gets Cut Off

    My java applet is getting cut off on the bottom. I'm trying to use setSize to display the whole thing, but to no avail. I'll attach a screenshot and post the code below.

    Java Code:
    package testapplet;
    
    import java.awt.*;
    import java.applet.*;
    
    /**
     *
     * @author jeffrey
     */
    public class NewJApplet extends Applet {
    
        Button[][] boxes;
        /**
         * Initialization method that will be called after the applet is loaded
         * into the browser.
         */
        public void init() {
            setLayout(null);
            setSize(300, 300);
    
            boxes = new Button[10][10];
            for(int i = 0; i < 10; i++) {
                for(int j = 0; j < 10; j++) {
                    boxes[i][j] = new Button("A");
    
                    boxes[i][j].setBounds(i*30, j*30, 30, 30);
    
                    add(boxes[i][j]);
                }
            }
    
        }
    
        // TODO overwrite start(), stop() and destroy() methods
    
    }
    Attached Thumbnails Attached Thumbnails Java Applet Gets Cut Off-screenshot-applet-viewer-testapplet-newjapplet.class.jpg  

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

  3. #3
    wikidjeff is offline Member
    Join Date
    Oct 2010
    Posts
    3
    Rep Power
    0

    Default

    Right now I'm just using the appletviewer though, it's not embedded in HTML.

  4. #4
    wikidjeff is offline Member
    Join Date
    Oct 2010
    Posts
    3
    Rep Power
    0

    Default

    It turns out NetBeans does use an html file to display applets. I modified this file's height and width parameters and now it works fine.

    Thank you.

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. applet class inside java.applet.* or java.awt.*
    By Manish87 in forum Java Applets
    Replies: 1
    Last Post: 09-27-2010, 03:15 PM
  2. Help with java applet
    By ketann in forum Java Applets
    Replies: 0
    Last Post: 03-22-2010, 02:06 AM
  3. How do i fix this Java applet ??????
    By danielmessick in forum Advanced Java
    Replies: 6
    Last Post: 03-08-2010, 06:52 AM
  4. How do i fix this Java applet ??????
    By danielmessick in forum JCreator
    Replies: 1
    Last Post: 03-07-2010, 01:55 PM
  5. Replies: 3
    Last Post: 07-23-2008, 09:07 AM

Posting Permissions

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