Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #9616 > unrolled thread
| Started by | Thomas Richter <thor@math.tu-berlin.de> |
|---|---|
| First post | 2011-11-05 22:23 +0100 |
| Last post | 2011-11-06 07:13 -0800 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.java.programmer
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
| From | Thomas Richter <thor@math.tu-berlin.de> |
|---|---|
| Date | 2011-11-05 22:23 +0100 |
| Subject | JFrame stays unusably small in applet |
| Message-ID | <j949fr$d0j$1@news.belwue.de> |
Hi folks,
a very strange problem with a program of mine - unfortunately not
reproducible on my machine, but only on the one of the customer. The
code is part of a (signed) applet and opens a JFrame. It simply looks as
follows:
frame = new JFrame("The Title");
frame.setLocationRelativeTo(this);
frame.setSize(800,64);
frame.setVisible(true);
where "this" is the instance of the JApplet. Now, on my machine(s) this
works correctly - opens a JFrame over the JApplet of the correct size.
On the customer's machine, the JFrame remains tiny, so tiny that only
the tile bar is visible, but nothing inside it. As the code is so
incredibly simple, I wonder what might have been gone wrong here.
I'm running a Debian Squeeze with firefox 3.5.16 and java 6 update 29, I
also tested on Windows XP with firefox 3.6.20 and the same java version,
works absolutely perfect, no problem.
Not so on the customer's machine, which is also an XP (but a UK
edition), the same version of firefox (3.6.20), and java 6 update 26 (if
I remember correctly).
I really wonder what is going on here - I'm out of ideas how to debug or
identify the problem. The JFrame is not touched afterwards at all, it is
not resized, not reused etc, the above code is really the only one that
creates and modifies it.
Hope anyone has an idea how to solve this mystery, or at least how to
identify the cause of the problem.
Is there any specific setting of Java or the firefox I should be aware of?
Greetings,
Thomas
[toc] | [next] | [standalone]
| From | Knute Johnson <nospam@knutejohnson.com> |
|---|---|
| Date | 2011-11-05 15:20 -0700 |
| Message-ID | <j94cr8$mm7$1@dont-email.me> |
| In reply to | #9616 |
On 11/5/2011 2:23 PM, Thomas Richter wrote:
> Hi folks,
>
> a very strange problem with a program of mine - unfortunately not
> reproducible on my machine, but only on the one of the customer. The
> code is part of a (signed) applet and opens a JFrame. It simply looks as
> follows:
>
> frame = new JFrame("The Title");
> frame.setLocationRelativeTo(this);
> frame.setSize(800,64);
> frame.setVisible(true);
>
> where "this" is the instance of the JApplet. Now, on my machine(s) this
> works correctly - opens a JFrame over the JApplet of the correct size.
> On the customer's machine, the JFrame remains tiny, so tiny that only
> the tile bar is visible, but nothing inside it. As the code is so
> incredibly simple, I wonder what might have been gone wrong here.
>
> I'm running a Debian Squeeze with firefox 3.5.16 and java 6 update 29, I
> also tested on Windows XP with firefox 3.6.20 and the same java version,
> works absolutely perfect, no problem.
>
> Not so on the customer's machine, which is also an XP (but a UK
> edition), the same version of firefox (3.6.20), and java 6 update 26 (if
> I remember correctly).
>
> I really wonder what is going on here - I'm out of ideas how to debug or
> identify the problem. The JFrame is not touched afterwards at all, it is
> not resized, not reused etc, the above code is really the only one that
> creates and modifies it.
>
> Hope anyone has an idea how to solve this mystery, or at least how to
> identify the cause of the problem.
>
> Is there any specific setting of Java or the firefox I should be aware of?
>
> Greetings,
> Thomas
I think you have to set the size before you call
setLocationRelativeTo(). The only other possibility I can think of is
that it is too small with whatever font the customer is using and it
won't size correctly. Try just calling pack() and see if that solves it
or pack it, check the size and adjust from there.
--
Knute Johnson
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2011-11-06 03:00 -0800 |
| Message-ID | <20qcb7tm6dtlmn17f7enisj855jnacu1ik@4ax.com> |
| In reply to | #9616 |
On Sat, 05 Nov 2011 22:23:05 +0100, Thomas Richter
<thor@math.tu-berlin.de> wrote, quoted or indirectly quoted someone
who said :
> frame = new JFrame("The Title");
> frame.setLocationRelativeTo(this);
> frame.setSize(800,64);
> frame.setVisible(true);
I use JDialog for pop-up not JFrame. It may just be that you are in
uncharted territory that has not been properly debugged.
see http://mindprod.com/jgloss/jdialog.html
You might be able to track it down by extending JFrame and putting
some instrumentation in setSize and brethren to find out who is
shrinking you.
--
Roedy Green Canadian Mind Products
http://mindprod.com
Capitalism has spurred the competition that makes CPUs faster and
faster each year, but the focus on money makes software manufacturers
do some peculiar things like deliberately leaving bugs and deficiencies
in the software so they can soak the customers for upgrades later.
Whether software is easy to use, or never loses data, when the company
has a near monopoly, is almost irrelevant to profits, and therefore
ignored. The manufacturer focuses on cheap gimicks like dancing paper
clips to dazzle naive first-time buyers. The needs of existing
experienced users are almost irrelevant. I see software rental as the
best remedy.
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2011-11-06 03:02 -0800 |
| Message-ID | <67qcb7dpu8cobr0ip32pagie2nf5v3nb68@4ax.com> |
| In reply to | #9616 |
On Sat, 05 Nov 2011 22:23:05 +0100, Thomas Richter <thor@math.tu-berlin.de> wrote, quoted or indirectly quoted someone who said : > frame.setSize(800,64); a pack would shrink it. What kind of layout do you have inside the JFrame? Is it something that would survive a pack? when use absolute positioning, remember to setLayout(null). -- Roedy Green Canadian Mind Products http://mindprod.com Capitalism has spurred the competition that makes CPUs faster and faster each year, but the focus on money makes software manufacturers do some peculiar things like deliberately leaving bugs and deficiencies in the software so they can soak the customers for upgrades later. Whether software is easy to use, or never loses data, when the company has a near monopoly, is almost irrelevant to profits, and therefore ignored. The manufacturer focuses on cheap gimicks like dancing paper clips to dazzle naive first-time buyers. The needs of existing experienced users are almost irrelevant. I see software rental as the best remedy.
[toc] | [prev] | [next] | [standalone]
| From | Thomas Richter <thor@math.tu-berlin.de> |
|---|---|
| Date | 2011-11-06 14:22 +0100 |
| Message-ID | <j961m4$4mc$1@news.belwue.de> |
| In reply to | #9646 |
On 06.11.2011 12:02, Roedy Green wrote: > On Sat, 05 Nov 2011 22:23:05 +0100, Thomas Richter > <thor@math.tu-berlin.de> wrote, quoted or indirectly quoted someone > who said : > >> frame.setSize(800,64); > > a pack would shrink it. What kind of layout do you have inside the > JFrame? Is it something that would survive a pack? > when use absolute positioning, remember to setLayout(null). 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). So long, Thomas
[toc] | [prev] | [next] | [standalone]
| From | markspace <-@.> |
|---|---|
| Date | 2011-11-06 07:13 -0800 |
| Message-ID | <j9687d$4ab$1@dont-email.me> |
| In reply to | #9650 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web