Solved

Make an applet fill the browser window

Posted on 2004-09-22
9
235 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
Comment Utility
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
Comment Utility
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
Comment Utility
Forget it, I solved it by using a BorderLayout
0
 
LVL 4

Expert Comment

by:funnyveryfunny
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 4

Expert Comment

by:funnyveryfunny
Comment Utility
ok :)
0
 
LVL 3

Author Comment

by:pulupul
Comment Utility
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
Comment Utility
do proceed...no problem
0
 

Accepted Solution

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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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 …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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 …

762 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now