Open GoogleCodeExporter opened 8 years ago
This is related to issue 9
Original comment by thraw...@gmail.com
on 22 Sep 2008 at 2:48
need to fix JXSearchFieldAddon to swingx-0.9.XX
fixed here as :
public final class JXSearchFieldAddon extends AbstractComponentAddon {
public static final String SEARCH_FIELD_SOURCE = "searchField";
public static final String BUTTON_SOURCE = "button";
public JXSearchFieldAddon() {
super("JXSearchField");
}
@Override
protected void addBasicDefaults(final LookAndFeelAddons addon, final DefaultsList
defaults) {
super.addBasicDefaults(addon, defaults);
addAll(defaults, Arrays.asList(new Object[] { "SearchField.layoutStyle",
LayoutStyle.MAC,
"SearchField.icon", getIcon("basic/resources/search.gif"),
"SearchField.rolloverIcon", getIcon("basic/resources/search_rollover.gif"),
"SearchField.pressedIcon", getIcon("basic/resources/search.gif"),
"SearchField.popupIcon", getIcon("basic/resources/search_popup.gif"),
"SearchField.popupRolloverIcon",
getIcon("basic/resources/search_popup_rollover.gif"),
"SearchField.clearIcon", getIcon("basic/resources/clear.gif"),
"SearchField.clearRolloverIcon", getIcon("basic/resources/clear_rollover.gif"),
"SearchField.clearPressedIcon", getIcon("basic/resources/clear_pressed.gif"),
"SearchField.buttonMargin", new InsetsUIResource(1, 1, 1, 1),
"SearchField.popupSource", BUTTON_SOURCE}));
//webstart fix
UIManagerExt.addResourceBundle("org.jdesktop.xswingx.plaf.basic.resources.Search
Field");
//
UIManager.getDefaults().addResourceBundle("org.jdesktop.xswingx.plaf.basic.resou
rces.SearchField");
}
@Override
protected void addMetalDefaults(final LookAndFeelAddons addon, final DefaultsList
defaults) {
super.addMetalDefaults(addon, defaults);
addAll(defaults, Arrays.asList(new Object[] {
"SearchField.buttonMargin", new InsetsUIResource(0, 0, 1, 1) }));
}
@Override
protected void addWindowsDefaults(final LookAndFeelAddons addon, final
DefaultsList defaults) {
super.addWindowsDefaults(addon, defaults);
addAll(defaults, Arrays.asList(new Object[] { "SearchField.promptFontStyle",
Font.ITALIC,
"SearchField.layoutStyle", LayoutStyle.VISTA,
"SearchField.icon", getIcon("windows/resources/search.gif"),
"SearchField.rolloverIcon", getIcon("windows/resources/search_rollover.gif"),
"SearchField.pressedIcon", getIcon("windows/resources/search_pressed.gif"),
"SearchField.popupIcon", getIcon("windows/resources/search_popup.gif"),
"SearchField.popupRolloverIcon",
getIcon("windows/resources/search_popup_rollover.gif"),
"SearchField.popupPressedIcon",
getIcon("windows/resources/search_popup_pressed.gif"),
"SearchField.clearIcon", getIcon("windows/resources/clear.gif"),
"SearchField.clearRolloverIcon", getIcon("windows/resources/clear_rollover.gif"),
"SearchField.clearPressedIcon", getIcon("windows/resources/clear_pressed.gif"),
"SearchField.useSeperatePopupButton", Boolean.TRUE,
"SearchField.popupOffset", -1 }));
// Do it like 'Windows Media Player' in XP:
// Replace the border line with the search button line on rollover.
// But not in classic mode!
if (UIManager.getLookAndFeel().getClass().getName().indexOf("Classic") == -1) {
defaults.add("SearchField.buttonMargin", new InsetsUIResource(0, -1, 0, -1));
} else {
defaults.add("SearchField.buttonMargin", new InsetsUIResource(0, 0, 0, 0));
}
}
@Override
protected void addMotifDefaults(final LookAndFeelAddons addon, final DefaultsList
defaults) {
super.addMotifDefaults(addon, defaults);
addAll(defaults, Arrays.asList(new Object[] { "SearchField.icon",
getIcon("macosx/resources/search.png"),
"SearchField.rolloverIcon", getIcon("macosx/resources/search.png"),
"SearchField.pressedIcon", getIcon("macosx/resources/search.png"),
"SearchField.popupIcon", getIcon("macosx/resources/search_popup.png"),
"SearchField.popupRolloverIcon", getIcon("macosx/resources/search_popup.png"),
"SearchField.popupPressedIcon", getIcon("macosx/resources/search_popup.png"),
"SearchField.clearIcon", getIcon("macosx/resources/clear.png"),
"SearchField.clearRolloverIcon", getIcon("macosx/resources/clear_rollover.png"),
"SearchField.clearPressedIcon", getIcon("macosx/resources/clear_pressed.png") }));
}
@Override
protected void addMacDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addMacDefaults(addon, defaults);
addAll(defaults, Arrays.asList(new Object[] { "SearchField.icon",
getIcon("macosx/resources/search.png"),
"SearchField.rolloverIcon", getIcon("macosx/resources/search.png"),
"SearchField.pressedIcon", getIcon("macosx/resources/search.png"),
"SearchField.popupIcon", getIcon("macosx/resources/search_popup.png"),
"SearchField.popupRolloverIcon", getIcon("macosx/resources/search_popup.png"),
"SearchField.popupPressedIcon", getIcon("macosx/resources/search_popup.png"),
"SearchField.clearIcon", getIcon("macosx/resources/clear.png"),
"SearchField.clearRolloverIcon", getIcon("macosx/resources/clear_rollover.png"),
"SearchField.clearPressedIcon", getIcon("macosx/resources/clear_pressed.png"),
"SearchField.buttonMargin", new InsetsUIResource(0, 0, 0, 0),
"SearchField.popupSource", SEARCH_FIELD_SOURCE}));
}
// Workaround: Only return true, when the current LnF is Windows or
// PlasticXP.
protected boolean isWindows(final LookAndFeelAddons addon) {
return super.isWindows(addon) ||
(UIManager.getLookAndFeel().getClass().getName().indexOf("Windows") != -1 ||
UIManager.getLookAndFeel().getClass().getName().indexOf("PlasticXP") != -1);
}
private void addAll(final DefaultsList defaults, final List<Object> parList) {
assert( 0 == parList.size() % 2 );
for (int locIt = 0; locIt < parList.size(); ) {
defaults.add(parList.get(locIt), parList.get(locIt + 1));
locIt += 2;
}
}
private IconUIResource getIcon(final String resourceName) {
final URL url = JXSearchFieldAddon.class.getResource(resourceName);
if (url == null) {
return null;
} else {
return new IconUIResource(new ImageIcon(url));
}
}
}
Original comment by junqueir...@gmail.com
on 6 Jan 2009 at 4:25
Thank you it works in swingx 0.9.7 and substance 5.2dev
Original comment by digz6...@gmail.com
on 4 May 2009 at 6:33
Patched in issue 18
Original comment by ge0ffrey.spam@gmail.com
on 23 Dec 2009 at 9:38
Original issue reported on code.google.com by
thraw...@gmail.com
on 16 Sep 2008 at 1:51