File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes setBounds & setSize bug?  Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "setBounds & setSize bug?  " Watch "setBounds & setSize bug?  " New topic
Author

setBounds & setSize bug?

Chinh Tran Nam
Ranch Hand

Joined: Nov 08, 2004
Posts: 35
Hi All,

I have a strange problem with my applet, it sometimes does not fully display (Only display half or 1/3 of its height).

I tried to add setBounds and setSize calls, I even called to resize using Javascript but the applet still does not display full height. It's strange that if I manually resize the browser window containing the applet, then it displays correctly.

I use JRE_1.5.0_15.

Please advice?

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35250
    
    7
The applet size can't be affected by any of the methods you describe. It is determined by the width and height attributes of the applet tags.

What do you mean by "does not fully display" - is there an empty area where the lower half of the applet should be, or is the applet's area actually smaller than what you specify in the height attribute?


Android appsImageJ pluginsJava web charts
Chinh Tran Nam
Ranch Hand

Joined: Nov 08, 2004
Posts: 35
Ulf,

Thanks for your answer.


The applet size can't be affected by any of the methods you describe. It is determined by the width and height attributes of the applet tags.


Both width and height attributes are set to "100%".


What do you mean by "does not fully display" - is there an empty area where the lower half of the applet should be, or is the applet's area actually smaller than what you specify in the height attribute?


"does not fully display" means it only displayed the upper half of the applet, the lower half appeared to be blank (in gray, actually).

Please advice?

Thanks,
Chinh
Chinh Tran Nam
Ranch Hand

Joined: Nov 08, 2004
Posts: 35
When that issue happened, I've even tried to call applet resize(width, height) from javascript but the applet still did not display all. It only displayed correctly when I dragged the mouse to resize the browser window.

Thanks,
Chinh
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35250
    
    7
Both width and height attributes are set to "100%".

Width and height are given in pixels, not percentages.

I've even tried to call applet resize(width, height) from javascript but the applet still did not display all.

An applet can't be resized, not from within the Java code, nor from the outside using JavaScript.
[ March 19, 2008: Message edited by: Ulf Dittmer ]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: setBounds & setSize bug?
 
Similar Threads
How to resize the component
Do you always need setVisible?
applet resise not happening on drag by user
how to override width and height params in applet tag
Adding a JComponent to JDesktopPane