Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eliminating focus ring space on Leopard & Java 1.5



On Oct 29, 2007, at 1:17 PM, Steve Roy wrote:

Hey!

I have buttons that I don't want to ever get focus (in a toolbar) so I setFocusable(false), but while this does make them non-focusable, the space used by the focus ring is still there. Is there a way to eliminate this space?

Perhaps we should alter the default insets on a component if it is marked as not focusable? If you think this is a good idea, please write up a bug/feature request about it.


What are your toolbars buttons suppose to be actually? Is there another application you can point to on the Mac that has a similar appearance you are trying to achieve?

We have new client properties for segmented controls that are supposed to be pushed together which might give you the look you are going for.

Try using some of these "JButton.buttonType" properties:
{ "segmented", "segmentedRoundRect", "segmentedCapsule", "segmentedTextured" }
with these "JButton.segmentPosition" properties:
{ "first", "middle", "last", "only" }


Segmented round-rect with a reduced font size might be what you are looking for if this is suppose to be in more of a palette window.

More discussion of these properties will be in a tech note, but I thought I'd mention them now for you to try.

Usually I would just set a compound border made up of a negative empty border and the original border:

button.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createEmptyBorder(-3, -3, -3, -3), button.getBorder()));


But this trick doesn't work with these new borders. Somehow they just don't draw anything at all when subverted this way.

It's because the button UI delegate checks if the border is one that it knows about and is in cahoots with. This was necessary to avoid visual regressions in a number of other applications. Using a "client property"'ifided border in a compound border is not likely to work very well in all cases.


I don't see any new client property to control the focus ring or focus ring space either.

Perhaps we should add one. :)
Using the focusable attribute might be a good hint too. I'm taking all suggestions at this point.


At this point I could put the border inside a container with a negative empty border, but that's uglier than I would like it to be.

Do you guys know of anything I might have missed?

(By the way, I'm using the client property JButton.buttonType = square.)

If you don't specify any property at all, the buttons will become square if they are forced smaller than the default button size, and that style will not provide for any space around the outsides. Perhaps this simplest option might be the best one, depending on what appearance you are going after.


Mike Swingler
Java Frameworks Engineer
Apple Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Eliminating focus ring space on Leopard & Java 1.5 (From: Steve Roy <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.