Solved

Make an applet fill the browser window

Posted on 2004-09-22
9
238 Views
Last Modified: 2012-08-14
I have an applet, and I want it to fill all the browser window. To do this, I have this HTML, which works fine (note the 100%):

<applet
  width    = "100%"
  height   = "100%"
  codebase = "."
  code     = "servidor.AppletWrapper.class"
  archive  = "servidor.jar"
  name     = "TestApplet"
>

But, although the applet area of the web page fills the browser window, the actual window inside it, my app's window, does not fill all the area, and I don't know why.
The only thing my applet class does is to crate an instance of a JPanel derived class and add it to itself. This is done in the constructor of the applet:

    MyPanel panel = new MyPanel();
    public AppletWrapper()
    {
        add(panel);
    }

The JPanel derived class contains all the controls, and has BorderLayout.
If you need more info please ask.
0
Comment
Question by:pulupul
  • 4
  • 3
9 Comments
 
LVL 4

Expert Comment

by:funnyveryfunny
ID: 12128104
have a look at this site:
http://www.javaworld.com/javaworld/javatips/jw-javatip80.html

Javascript plays important part here.
0
 
LVL 3

Author Comment

by:pulupul
ID: 12128433
Thanks for the answer, but I'm starting to suspect that the problem has nothing to do with applets or browsers, because I have created an application wrapper for the applet (in order to run it standalone) and I have the same problem, when I maximize the window, the JPanel doesn't fill all of it.
0
 
LVL 3

Author Comment

by:pulupul
ID: 12128543
Forget it, I solved it by using a BorderLayout
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 4

Expert Comment

by:funnyveryfunny
ID: 12128566
try something like this:

 MyPanel panel = new MyPanel();
 
 public AppletWrapper implements ComponentListener()
    {
        add(panel);
        addComponentListener(this);
    }

   public void componentResized(ComponentEvent e){
       panel.resize(this.getWidth(),this.getHeight());
   }

  ...leave other methods empty


0
 
LVL 4

Expert Comment

by:funnyveryfunny
ID: 12128579
ok :)
0
 
LVL 3

Author Comment

by:pulupul
ID: 12132044
It was not an applet or browser issue, as I had first suspected. I solved it by using a BorderLayout layout manager in the JPanel, and putting everything in the center of it. Thanks for your time.
0
 
LVL 4

Expert Comment

by:funnyveryfunny
ID: 12137039
do proceed...no problem
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12155645
Closed, 300 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java stored proc example 9 46
Configure a Bean in an XML file 4 42
How to determine if a string is a valid SHA value 7 35
Eclipse Java import and method not resolved 4 51
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question