Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Compact Buttons ( was: NullPointerException in MacButtonUI...)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compact Buttons ( was: NullPointerException in MacButtonUI...)



And the real issue is this. The code below when run under Metal produces
evenly looking buttons, but under Aqua, button "b" is much bigger than
button "a". Is there any way (preferably PLaF independent) to make them
look the same (like button "a", that is)?

One way you could be certain that your buttons all look the same might be to write an Icon which draws the text and has a fixed width. That way all your buttons will appear to have an identical size and should get the same border:

pseudo-code....

class TextIcon implements Icon {
private String text;

public TextIcon(String text) {
this.text = text;
}

public int getIconWidth() {
return 24;
}

public int getIconHeight() {
return 24;
}

public void paintIcon(Component c, Graphics g, int x, int y) {
g.drawString(text, x+..., y+...);
}
}

Jerry

Jerry Huxtable
http://www.jhlabs.com




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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.