Closed GoogleCodeExporter closed 9 years ago
Hmm... why would you want to set the content pane to a button?
Original comment by kenneth....@gmail.com
on 31 Jul 2009 at 11:54
Adding a button is just the easiest way to show what happens. If I add a panel
with other components on it, the
same thing happens, ie. nothing is displayed.
Maybe this is not a bug after all, but a human error. If I am not supposed to
add for example a panel as a content
pane, what is supposed to go there?
Original comment by makkbe@gmail.com
on 1 Aug 2009 at 2:29
You should be adding to the content pane, not replacing it:
hudWindow.getContentPane().add(new JButton("Hello World");
Original comment by kenneth....@gmail.com
on 1 Aug 2009 at 5:54
I tried that method as well, but the results are the same. I still don't have
any components visible on my HUD
windows.
Original comment by makkbe@gmail.com
on 1 Aug 2009 at 8:54
I've now tried the following code using both Windows Vista and Mac OS X. I've
also
tried both Java 1.5 and 1.6 on OS X with the same results.
HudWindow hud = new HudWindow("foo");
hud.getJDialog().setSize(200,200);
hud.getJDialog().setVisible(true);
hud.getContentPane().add(HudWidgetFactory.createHudButton("bar"));
In OS X, an empty HUD window is displayed. In Vista, the button is added as it
should.
Original comment by makkbe@gmail.com
on 1 Aug 2009 at 9:29
Attachments:
What happens if you use Java 1.5? I don't have access to 10.5.7 yet, so I won't
be able to look into this until it's
released in September.
Original comment by kenneth....@gmail.com
on 2 Aug 2009 at 10:28
No improvements when using Java 1.5.
Original comment by makkbe@gmail.com
on 3 Aug 2009 at 7:21
It seems as though the order in which the HudWindow is initialised is
important. If I for example do like this,
it works also in OS X:
HudWindow hud = new HudWindow("foo");
hud.getContentPane().add(new JButton("bar"));
hud.getJDialog().setSize(200,200);
hud.getJDialog().setVisible(true);
Thus, if the JButton is added to the content pane before the HudWindow is set
visible, it works just fine. If
howerver the line hud.getContentPane().add(new JButton("bar")); is moved to the
bottom, no button is
displayed.
This is a workaround that I personally can live with for now.
Original comment by makkbe@gmail.com
on 3 Aug 2009 at 9:21
Do you observe the same behavior with a regular JDialog? If so, I'll close this
issue. Also, make sure your creating
your UI on the EDT.
Original comment by kenneth....@gmail.com
on 3 Aug 2009 at 10:36
No, with a regular JDialog, contents can be added after the initialization.
Original comment by makkbe@gmail.com
on 4 Aug 2009 at 7:47
Are you sure you ran this against JDK 1.5? I just ran into a bug at work
involving this same issue when running
against JDK 6.
Original comment by kenneth....@gmail.com
on 5 Aug 2009 at 1:21
Yes, positive. I tried it with both JDK 1.5 and 1.6 just to be sure, and the
same thing happened.
Original comment by makkbe@gmail.com
on 5 Aug 2009 at 1:47
I've experienced the same issues when developing with the HUD window.
I'm talking about 1.6 not 1.5.
The order is important, there is a hack around it to change the contents whilst
the
HUD is showing so long as you don't want to change the size of the HUD (if you
do
then you get the flicker bug on Mac). At work at the minute, can post code when
I get
back home.
Original comment by johnatha...@gmail.com
on 5 Aug 2009 at 2:00
This is not a Mac Widgets for Java issue, but a standard Swing issue. You have
two options:
1) Add your components to your window before you display them
2) Add you components to your window after you display them and then call:
window.validate();
window.repaint();
Original comment by kenneth....@gmail.com
on 21 Aug 2009 at 10:53
Original issue reported on code.google.com by
makkbe@gmail.com
on 31 Jul 2009 at 1:38Attachments: