Results 1 to 12 of 12
  1. #1
    c0elh0 is offline Member
    Join Date
    Oct 2008
    Location
    Lisbon, Portugal
    Posts
    14
    Rep Power
    0

    Default [SOLVED] Resizable applet

    Hi all, I'm new here and this is my 1st post. Hope you can help me, and I'll do the same if I can...

    I was wondering why JApplet's don't have the method setResizable(boolean)?
    I want to make it setResizable(false)... Anyone can tell me why I can't do it?

    My 1st applet project so.. :)

    Thanks
    c0elh0

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,395
    Rep Power
    25

    Default

    Are you talking about changing the size (WIDTH & HEIGHT in the <APPLET tag) in the HTML that the applet is being displayed in?
    I'm not sure you can do that without recreating the HTML with the new values. Or at least you couldn't a couple of years ago.

  4. #4
    c0elh0 is offline Member
    Join Date
    Oct 2008
    Location
    Lisbon, Portugal
    Posts
    14
    Rep Power
    0

    Default

    I have this code for this JApplet.
    Java Code:
    this. getContentPane().setLayout(new BorderLayout());
            areaScreen.setEditable(false);
            areaScreen.setFont(new Font("", Font.BOLD, 60));
            areaScreen.setForeground(Color.DARK_GRAY);
            areaScreen.setText("eTraveler Demonstrator");
            areaScreen.setBackground(Color.BLACK);
    
            upperPanel.setLayout(new BorderLayout());
            upperPanel.add(areaScreen,BorderLayout.CENTER);
            upperPanel.setBackground(Color.BLACK);
    
            BtnNext.setText("Biographic Data");
            BtnNext.addActionListener(this);
    
            BtnPrevious.setText("Back");
            BtnPrevious.addActionListener(this);
            BtnPrevious.setVisible(false);
    
            BtnAction.setText("Capture");
            BtnAction.addActionListener(this);
            BtnAction.setVisible(false);
    
            BtnClose.setText("Close");
            BtnClose.addActionListener(this);
            BtnClose.setVisible(true);
    
       
            midPanel.setLayout(new BorderLayout());
            midPanel.setBackground(Color.BLACK);
            lowerPanel.setBackground(Color.BLACK);
    
            lowerPanel.add(BtnPrevious);
            lowerPanel.add(BtnAction);
            lowerPanel.add(BtnNext);
            lowerPanel.add(BtnClose);
    
            getContentPane().add(upperPanel,BorderLayout.NORTH);
            getContentPane().add(midPanel,BorderLayout.CENTER);
            getContentPane().add(lowerPanel,BorderLayout.SOUTH);
    
            Dimension scSize = Toolkit.getDefaultToolkit().getScreenSize();
            Dimension aux = new Dimension(scSize.width,scSize.height-110);
            this.setSize(aux);
            this.getContentPane().setVisible(true);
    The problem is, I can't see any method like this.setResizable(false).
    Is that a feature of Applet's??

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    I think he is talking about the applet viewer. Actually on the applet viewer too, you cannot do that. But you can change the size, width and height.

  6. #6
    c0elh0 is offline Member
    Join Date
    Oct 2008
    Location
    Lisbon, Portugal
    Posts
    14
    Rep Power
    0

    Default

    Like JFrame has a method setResizable(boolean), I was thinking that applet could have the same method...

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by c0elh0 View Post
    The problem is, I can't see any method like this.setResizable(false).
    Is that a feature of Applet's??
    On the applet viewer you cannot do that. I think you are talking about the applet viewer, is that right?

  8. #8
    c0elh0 is offline Member
    Join Date
    Oct 2008
    Location
    Lisbon, Portugal
    Posts
    14
    Rep Power
    0

    Default

    Do you know why that can't be done? just to know... I'll try to find another solution to my situation.
    Thanks

  9. #9
    c0elh0 is offline Member
    Join Date
    Oct 2008
    Location
    Lisbon, Portugal
    Posts
    14
    Rep Power
    0

    Default

    yes, that's it

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Reason is, applets are embedded with HTML pages. Once you define the size of the applet you cannot change anyway. Basically it's all about Encapsulation, no need to allow unwanted methods for users.

  11. #11
    c0elh0 is offline Member
    Join Date
    Oct 2008
    Location
    Lisbon, Portugal
    Posts
    14
    Rep Power
    0

    Default

    I get it, in fact it's very logical.
    Thanks a lot.

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Not-resizable (J)dialog showing Maximize Menu !!!
    By playwin2 in forum AWT / Swing
    Replies: 7
    Last Post: 09-08-2008, 12:51 AM
  2. Applet in a GUI
    By serfster in forum New To Java
    Replies: 1
    Last Post: 06-12-2008, 11:09 PM
  3. applet
    By amith in forum AWT / Swing
    Replies: 1
    Last Post: 05-16-2008, 03:24 AM
  4. First Applet HELP????
    By nvidia in forum New To Java
    Replies: 0
    Last Post: 08-13-2007, 10:11 PM
  5. Replies: 4
    Last Post: 06-08-2007, 06:15 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
  •