UnifiedToolBar buttons

18 views
Skip to first unread message

gurjeet

unread,
Jul 8, 2009, 6:42:27 PM7/8/09
to Mac Widgets for Java
Hi,

I am trying to create a UnifiedToolBar with buttons which look
'correct'. I am trying:

JButton prefButton = new JButton("Preferences");
prefButton.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().getImage
("NSImage://NSPreferencesGeneral")));
prefButton = (JButton) MacButtonFactory.makeUnifiedToolBarButton
(prefButton);

toolBar.addComponentToCenter(prefButton);

Should this work as is or am I missing something ?

Gurjeet

Ken Orr

unread,
Jul 8, 2009, 7:55:25 PM7/8/09
to mac-widget...@googlegroups.com
It looks like it should work... what platform are you running on? It will only work on a Mac.

gurjeet

unread,
Jul 8, 2009, 8:20:17 PM7/8/09
to Mac Widgets for Java
I am running this on a mac. Why will it only work on a mac ? (due to
the NSImages ?)

If the NSImage is the reason, then I can always replace it with a
static png. If not, what is the reason for it only working on a mac ?

The problem with this approach is that once in every 4 tries, the
'button bar' has a different color than the 'title bar'. Is this
expected ?

Gurjeet

Ken Orr

unread,
Jul 9, 2009, 8:08:41 AM7/9/09
to mac-widget...@googlegroups.com
The call to Toolkit.getDefaultToolkit().getImage("NSImage://NSPreferencesGeneral")) will only work on a Mac as it's pulling in native Mac images.

Could you send a screen shot of the issue you're seeing? Are you creating your UI on the EDT?

-Ken

gurjeet

unread,
Jul 9, 2009, 6:39:12 PM7/9/09
to Mac Widgets for Java
Okay, I had planned on replacing the NSImage call anyway, so that's
not a problem.

About the GUI, I am creating the UI on the EDT. A screenshot is at :
http://www.twitpic.com/9tudj

I should note that if I switch to another window and switch back,
everything looks normal again.

Ken Orr

unread,
Jul 9, 2009, 7:23:50 PM7/9/09
to mac-widget...@googlegroups.com
What version of Java are you using?

gurjeet

unread,
Jul 9, 2009, 9:26:34 PM7/9/09
to Mac Widgets for Java
This is on Mac OS X 10.5.7

$ java -version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode)

jT

unread,
Jul 10, 2009, 3:38:50 AM7/10/09
to Mac Widgets for Java
Just for reference, I'm running same set of software and I get the
same visual artefact occasionally. The color remains in its unfocused
state even when the application has the focus.

jT

knalli

unread,
Jul 9, 2009, 7:34:18 PM7/9/09
to mac-widget...@googlegroups.com
Try this: Remove all other components and re-add them and their layout
contraints step-by-step. Using BorderLayout?


Jan

Ken Orr

unread,
Jul 10, 2009, 6:50:24 AM7/10/09
to mac-widget...@googlegroups.com
Could someone create an issue for this? I may still be relying on a client property that isn't technically supported ("frame.active" or something like that).

Thanks,
-Ken

uud ashr

unread,
Aug 13, 2009, 2:12:29 AM8/13/09
to mac-widget...@googlegroups.com
Wait, I'm wrong. It still on focus.

On Thu, Aug 13, 2009 at 1:12 PM, uud ashr <uud...@gmail.com> wrote:
It seems the issue happen if the the window is not on focus. So there should be modification on the paint code.

uud ashr

unread,
Aug 13, 2009, 2:12:00 AM8/13/09
to mac-widget...@googlegroups.com
It seems the issue happen if the the window is not on focus. So there should be modification on the paint code.
On Fri, Jul 10, 2009 at 5:50 PM, Ken Orr <kenne...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages