Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #9657

Re: JFrame stays unusably small in applet

From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: JFrame stays unusably small in applet
Date 2011-11-06 07:13 -0800
Organization A noiseless patient Spider
Message-ID <j9687d$4ab$1@dont-email.me> (permalink)
References <j949fr$d0j$1@news.belwue.de> <67qcb7dpu8cobr0ip32pagie2nf5v3nb68@4ax.com> <j961m4$4mc$1@news.belwue.de>

Show all headers | View raw


On 11/6/2011 5:22 AM, Thomas Richter wrote:
> There is absolutely no layout within at all. All I do is to get the
> graphics and render some text. I do not call "pack" - there is beyond
> the text output nothing else that happens there...
>
> Are there any known settings in firefox or windows or java that would
> prevent JFrames from opening the indicated size (yes, the size does fit
> onto the monitor of the customer, checked that).


Oh... yes, I think there are.  FireFox itself can call various methods 
on the applet to resize it.  Even if you don't normally see it, I'd 
assume that the applet is calling some public methods (like pack()) to 
try to resize the window.

With no layout, the JFrame might become confused and assume it has a 
size of "0,0".  That would sure explain the behavior you are seeing.

Can you modify the JFrame to have a layout, and add a subcomponent 
that's fixed to the size you want?  The normal way to do this is to make 
a JPanel subclass, and then to override the JPanel::getPreferredSize() 
method to always return the size you want.  Within the JPanel you can 
use any absolute layout you want.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

JFrame stays unusably small in applet Thomas Richter <thor@math.tu-berlin.de> - 2011-11-05 22:23 +0100
  Re: JFrame stays unusably small in applet Knute Johnson <nospam@knutejohnson.com> - 2011-11-05 15:20 -0700
  Re: JFrame stays unusably small in applet Roedy Green <see_website@mindprod.com.invalid> - 2011-11-06 03:00 -0800
  Re: JFrame stays unusably small in applet Roedy Green <see_website@mindprod.com.invalid> - 2011-11-06 03:02 -0800
    Re: JFrame stays unusably small in applet Thomas Richter <thor@math.tu-berlin.de> - 2011-11-06 14:22 +0100
      Re: JFrame stays unusably small in applet markspace <-@.> - 2011-11-06 07:13 -0800

csiph-web