id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
sequence
docstring
stringlengths
3
16k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
105
339
700
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java
SeaGlassTabbedPaneUI.updateTabContext
private void updateTabContext(int index, boolean selected, boolean isMouseDown, boolean isMouseOver, boolean hasFocus) { int state = 0; if (!tabPane.isEnabled() || !tabPane.isEnabledAt(index)) { state |= SynthConstants.DISABLED; if (selected) { state |= SynthConstants.SELECTED; } } else if (selected) { state |= (SynthConstants.ENABLED | SynthConstants.SELECTED); if (isMouseOver && UIManager.getBoolean("TabbedPane.isTabRollover")) { state |= SynthConstants.MOUSE_OVER; } } else if (isMouseOver) { state |= (SynthConstants.ENABLED | SynthConstants.MOUSE_OVER); } else { state = SeaGlassLookAndFeel.getComponentState(tabPane); state &= ~SynthConstants.FOCUSED; // Don't use tabbedpane focus state. } if (hasFocus && tabPane.hasFocus()) { state |= SynthConstants.FOCUSED; // individual tab has focus } if (isMouseDown) { state |= SynthConstants.PRESSED; } tabContext.setComponentState(state); }
java
private void updateTabContext(int index, boolean selected, boolean isMouseDown, boolean isMouseOver, boolean hasFocus) { int state = 0; if (!tabPane.isEnabled() || !tabPane.isEnabledAt(index)) { state |= SynthConstants.DISABLED; if (selected) { state |= SynthConstants.SELECTED; } } else if (selected) { state |= (SynthConstants.ENABLED | SynthConstants.SELECTED); if (isMouseOver && UIManager.getBoolean("TabbedPane.isTabRollover")) { state |= SynthConstants.MOUSE_OVER; } } else if (isMouseOver) { state |= (SynthConstants.ENABLED | SynthConstants.MOUSE_OVER); } else { state = SeaGlassLookAndFeel.getComponentState(tabPane); state &= ~SynthConstants.FOCUSED; // Don't use tabbedpane focus state. } if (hasFocus && tabPane.hasFocus()) { state |= SynthConstants.FOCUSED; // individual tab has focus } if (isMouseDown) { state |= SynthConstants.PRESSED; } tabContext.setComponentState(state); }
[ "private", "void", "updateTabContext", "(", "int", "index", ",", "boolean", "selected", ",", "boolean", "isMouseDown", ",", "boolean", "isMouseOver", ",", "boolean", "hasFocus", ")", "{", "int", "state", "=", "0", ";", "if", "(", "!", "tabPane", ".", "isEnabled", "(", ")", "||", "!", "tabPane", ".", "isEnabledAt", "(", "index", ")", ")", "{", "state", "|=", "SynthConstants", ".", "DISABLED", ";", "if", "(", "selected", ")", "{", "state", "|=", "SynthConstants", ".", "SELECTED", ";", "}", "}", "else", "if", "(", "selected", ")", "{", "state", "|=", "(", "SynthConstants", ".", "ENABLED", "|", "SynthConstants", ".", "SELECTED", ")", ";", "if", "(", "isMouseOver", "&&", "UIManager", ".", "getBoolean", "(", "\"TabbedPane.isTabRollover\"", ")", ")", "{", "state", "|=", "SynthConstants", ".", "MOUSE_OVER", ";", "}", "}", "else", "if", "(", "isMouseOver", ")", "{", "state", "|=", "(", "SynthConstants", ".", "ENABLED", "|", "SynthConstants", ".", "MOUSE_OVER", ")", ";", "}", "else", "{", "state", "=", "SeaGlassLookAndFeel", ".", "getComponentState", "(", "tabPane", ")", ";", "state", "&=", "~", "SynthConstants", ".", "FOCUSED", ";", "// Don't use tabbedpane focus state.", "}", "if", "(", "hasFocus", "&&", "tabPane", ".", "hasFocus", "(", ")", ")", "{", "state", "|=", "SynthConstants", ".", "FOCUSED", ";", "// individual tab has focus", "}", "if", "(", "isMouseDown", ")", "{", "state", "|=", "SynthConstants", ".", "PRESSED", ";", "}", "tabContext", ".", "setComponentState", "(", "state", ")", ";", "}" ]
Update the SynthContext for the tab area for a specified tab. @param index the tab to update for. @param selected is the tab selected? @param isMouseDown is the mouse down? @param isMouseOver is the mouse over the tab? @param hasFocus do we have focus?
[ "Update", "the", "SynthContext", "for", "the", "tab", "area", "for", "a", "specified", "tab", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java#L1078-L1109
701
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java
SeaGlassTabbedPaneUI.isOverCloseButton
protected boolean isOverCloseButton(int x, int y) { if (tabCloseButtonPlacement != CENTER) { int tabCount = tabPane.getTabCount(); for (int i = 0; i < tabCount; i++) { if (getCloseButtonBounds(i).contains(x, y)) { closeButtonHoverIndex = i; return true; } } } closeButtonHoverIndex = -1; return false; }
java
protected boolean isOverCloseButton(int x, int y) { if (tabCloseButtonPlacement != CENTER) { int tabCount = tabPane.getTabCount(); for (int i = 0; i < tabCount; i++) { if (getCloseButtonBounds(i).contains(x, y)) { closeButtonHoverIndex = i; return true; } } } closeButtonHoverIndex = -1; return false; }
[ "protected", "boolean", "isOverCloseButton", "(", "int", "x", ",", "int", "y", ")", "{", "if", "(", "tabCloseButtonPlacement", "!=", "CENTER", ")", "{", "int", "tabCount", "=", "tabPane", ".", "getTabCount", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tabCount", ";", "i", "++", ")", "{", "if", "(", "getCloseButtonBounds", "(", "i", ")", ".", "contains", "(", "x", ",", "y", ")", ")", "{", "closeButtonHoverIndex", "=", "i", ";", "return", "true", ";", "}", "}", "}", "closeButtonHoverIndex", "=", "-", "1", ";", "return", "false", ";", "}" ]
Determine whether the mouse is over a tab close button, and if so, set the hover index. @param x the current mouse x coordinate. @param y the current mouse y coordinate. @return {@code true} if the mouse is over a close button, {@code false} otherwise.
[ "Determine", "whether", "the", "mouse", "is", "over", "a", "tab", "close", "button", "and", "if", "so", "set", "the", "hover", "index", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java#L1121-L1135
702
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java
SeaGlassTabbedPaneUI.getCloseButtonBounds
protected Rectangle getCloseButtonBounds(int tabIndex) { Rectangle bounds = new Rectangle(rects[tabIndex]); bounds.width = closeButtonSize; bounds.height = closeButtonSize; bounds.y += (rects[tabIndex].height - closeButtonSize - closeButtonInsets.top - closeButtonInsets.bottom) / 2 + closeButtonInsets.top; boolean onLeft = isCloseButtonOnLeft(); if (onLeft) { int offset = orientation == ControlOrientation.VERTICAL || tabIndex == 0 ? 6 : 3; bounds.x += offset; } else { int offset = orientation == ControlOrientation.VERTICAL || tabIndex == tabPane.getTabCount() - 1 ? 6 : 4; bounds.x += rects[tabIndex].width - bounds.width - offset; } return bounds; }
java
protected Rectangle getCloseButtonBounds(int tabIndex) { Rectangle bounds = new Rectangle(rects[tabIndex]); bounds.width = closeButtonSize; bounds.height = closeButtonSize; bounds.y += (rects[tabIndex].height - closeButtonSize - closeButtonInsets.top - closeButtonInsets.bottom) / 2 + closeButtonInsets.top; boolean onLeft = isCloseButtonOnLeft(); if (onLeft) { int offset = orientation == ControlOrientation.VERTICAL || tabIndex == 0 ? 6 : 3; bounds.x += offset; } else { int offset = orientation == ControlOrientation.VERTICAL || tabIndex == tabPane.getTabCount() - 1 ? 6 : 4; bounds.x += rects[tabIndex].width - bounds.width - offset; } return bounds; }
[ "protected", "Rectangle", "getCloseButtonBounds", "(", "int", "tabIndex", ")", "{", "Rectangle", "bounds", "=", "new", "Rectangle", "(", "rects", "[", "tabIndex", "]", ")", ";", "bounds", ".", "width", "=", "closeButtonSize", ";", "bounds", ".", "height", "=", "closeButtonSize", ";", "bounds", ".", "y", "+=", "(", "rects", "[", "tabIndex", "]", ".", "height", "-", "closeButtonSize", "-", "closeButtonInsets", ".", "top", "-", "closeButtonInsets", ".", "bottom", ")", "/", "2", "+", "closeButtonInsets", ".", "top", ";", "boolean", "onLeft", "=", "isCloseButtonOnLeft", "(", ")", ";", "if", "(", "onLeft", ")", "{", "int", "offset", "=", "orientation", "==", "ControlOrientation", ".", "VERTICAL", "||", "tabIndex", "==", "0", "?", "6", ":", "3", ";", "bounds", ".", "x", "+=", "offset", ";", "}", "else", "{", "int", "offset", "=", "orientation", "==", "ControlOrientation", ".", "VERTICAL", "||", "tabIndex", "==", "tabPane", ".", "getTabCount", "(", ")", "-", "1", "?", "6", ":", "4", ";", "bounds", ".", "x", "+=", "rects", "[", "tabIndex", "]", ".", "width", "-", "bounds", ".", "width", "-", "offset", ";", "}", "return", "bounds", ";", "}" ]
Get the bounds for a tab close button. @param tabIndex the tab index. @return the bounds.
[ "Get", "the", "bounds", "for", "a", "tab", "close", "button", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java#L1144-L1166
703
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java
SeaGlassTabbedPaneUI.doClose
protected void doClose(int tabIndex) { if (tabCloseListener == null || tabCloseListener.tabAboutToBeClosed(tabIndex)) { String title = tabPane.getTitleAt(tabIndex); Component component = tabPane.getComponentAt(tabIndex); tabPane.removeTabAt(tabIndex); if (tabCloseListener != null) { tabCloseListener.tabClosed(title, component); } } }
java
protected void doClose(int tabIndex) { if (tabCloseListener == null || tabCloseListener.tabAboutToBeClosed(tabIndex)) { String title = tabPane.getTitleAt(tabIndex); Component component = tabPane.getComponentAt(tabIndex); tabPane.removeTabAt(tabIndex); if (tabCloseListener != null) { tabCloseListener.tabClosed(title, component); } } }
[ "protected", "void", "doClose", "(", "int", "tabIndex", ")", "{", "if", "(", "tabCloseListener", "==", "null", "||", "tabCloseListener", ".", "tabAboutToBeClosed", "(", "tabIndex", ")", ")", "{", "String", "title", "=", "tabPane", ".", "getTitleAt", "(", "tabIndex", ")", ";", "Component", "component", "=", "tabPane", ".", "getComponentAt", "(", "tabIndex", ")", ";", "tabPane", ".", "removeTabAt", "(", "tabIndex", ")", ";", "if", "(", "tabCloseListener", "!=", "null", ")", "{", "tabCloseListener", ".", "tabClosed", "(", "title", ",", "component", ")", ";", "}", "}", "}" ]
Called when a close tab button is pressed. @param tabIndex TODO
[ "Called", "when", "a", "close", "tab", "button", "is", "pressed", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java#L1184-L1195
704
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/CheckBoxMenuItemPainter.java
CheckBoxMenuItemPainter.paintCheckIconDisabledAndSelected
private void paintCheckIconDisabledAndSelected(Graphics2D g, int width, int height) { Shape s = shapeGenerator.createCheckMark(0, 0, width, height); g.setPaint(iconDisabledSelected); g.fill(s); }
java
private void paintCheckIconDisabledAndSelected(Graphics2D g, int width, int height) { Shape s = shapeGenerator.createCheckMark(0, 0, width, height); g.setPaint(iconDisabledSelected); g.fill(s); }
[ "private", "void", "paintCheckIconDisabledAndSelected", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ")", "{", "Shape", "s", "=", "shapeGenerator", ".", "createCheckMark", "(", "0", ",", "0", ",", "width", ",", "height", ")", ";", "g", ".", "setPaint", "(", "iconDisabledSelected", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "}" ]
Paint the check mark in disabled state. @param g the Graphics2D context to paint with. @param width the width. @param height the height.
[ "Paint", "the", "check", "mark", "in", "disabled", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/CheckBoxMenuItemPainter.java#L132-L138
705
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.initialize
@Override public void initialize() { super.initialize(); // create synth style factory setStyleFactory(new SynthStyleFactory() { @Override public SynthStyle getStyle(JComponent c, Region r) { SynthStyle style = getSeaGlassStyle(c, r); if (!(style instanceof SeaGlassStyle)) { style = new SeaGlassStyleWrapper(style); } return style; } }); }
java
@Override public void initialize() { super.initialize(); // create synth style factory setStyleFactory(new SynthStyleFactory() { @Override public SynthStyle getStyle(JComponent c, Region r) { SynthStyle style = getSeaGlassStyle(c, r); if (!(style instanceof SeaGlassStyle)) { style = new SeaGlassStyleWrapper(style); } return style; } }); }
[ "@", "Override", "public", "void", "initialize", "(", ")", "{", "super", ".", "initialize", "(", ")", ";", "// create synth style factory", "setStyleFactory", "(", "new", "SynthStyleFactory", "(", ")", "{", "@", "Override", "public", "SynthStyle", "getStyle", "(", "JComponent", "c", ",", "Region", "r", ")", "{", "SynthStyle", "style", "=", "getSeaGlassStyle", "(", "c", ",", "r", ")", ";", "if", "(", "!", "(", "style", "instanceof", "SeaGlassStyle", ")", ")", "{", "style", "=", "new", "SeaGlassStyleWrapper", "(", "style", ")", ";", "}", "return", "style", ";", "}", "}", ")", ";", "}" ]
Called by UIManager when this look and feel is installed.
[ "Called", "by", "UIManager", "when", "this", "look", "and", "feel", "is", "installed", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L308-L325
706
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.getDefaults
@Override public UIDefaults getDefaults() { if (uiDefaults == null) { uiDefaults = new UIWrapper(super.getDefaults()); // Install Keybindings for the operating system. if (PlatformUtils.isWindows()) { WindowsKeybindings.installKeybindings(uiDefaults); } else if (PlatformUtils.isMac()) { MacKeybindings.installKeybindings(uiDefaults); } else { GTKKeybindings.installKeybindings(uiDefaults); } // Set the default font. defineDefaultFont(uiDefaults); // Override some of the Synth UI delegates with copied and modified // versions. useOurUIs(); defineBaseColors(uiDefaults); defineDefaultBorders(uiDefaults); defineArrowButtons(uiDefaults); defineButtons(uiDefaults); defineComboBoxes(uiDefaults); defineDesktopPanes(uiDefaults); defineInternalFrames(uiDefaults); defineInternalFrameMenuButtons(uiDefaults); defineInternalFrameCloseButtons(uiDefaults); defineInternalFrameIconifyButtons(uiDefaults); defineInternalFrameMaximizeButton(uiDefaults); defineLists(uiDefaults); defineMenus(uiDefaults); definePanels(uiDefaults); definePopups(uiDefaults); defineProgressBars(uiDefaults); defineRootPanes(uiDefaults); defineSeparators(uiDefaults); defineSpinners(uiDefaults); defineScrollBars(uiDefaults); defineScrollPane(uiDefaults); defineSliders(uiDefaults); defineSplitPanes(uiDefaults); defineTabbedPanes(uiDefaults); defineTables(uiDefaults); defineTextControls(uiDefaults); defineToolBars(uiDefaults); defineTrees(uiDefaults); defineToolTips(uiDefaults); defineOptionPane(uiDefaults); defineFileChooser(uiDefaults); if (!PlatformUtils.isMac()) { uiDefaults.put("MenuBar[Enabled].backgroundPainter", null); uiDefaults.put("MenuBar[Enabled].borderPainter", null); // If we're not on a Mac, draw our own title bar. JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); } else { // If we're on a Mac, use the screen menu bar. System.setProperty("apple.laf.useScreenMenuBar", "true"); // If we're on a Mac, use Aqua for some things. defineAquaSettings(uiDefaults); } } return uiDefaults; }
java
@Override public UIDefaults getDefaults() { if (uiDefaults == null) { uiDefaults = new UIWrapper(super.getDefaults()); // Install Keybindings for the operating system. if (PlatformUtils.isWindows()) { WindowsKeybindings.installKeybindings(uiDefaults); } else if (PlatformUtils.isMac()) { MacKeybindings.installKeybindings(uiDefaults); } else { GTKKeybindings.installKeybindings(uiDefaults); } // Set the default font. defineDefaultFont(uiDefaults); // Override some of the Synth UI delegates with copied and modified // versions. useOurUIs(); defineBaseColors(uiDefaults); defineDefaultBorders(uiDefaults); defineArrowButtons(uiDefaults); defineButtons(uiDefaults); defineComboBoxes(uiDefaults); defineDesktopPanes(uiDefaults); defineInternalFrames(uiDefaults); defineInternalFrameMenuButtons(uiDefaults); defineInternalFrameCloseButtons(uiDefaults); defineInternalFrameIconifyButtons(uiDefaults); defineInternalFrameMaximizeButton(uiDefaults); defineLists(uiDefaults); defineMenus(uiDefaults); definePanels(uiDefaults); definePopups(uiDefaults); defineProgressBars(uiDefaults); defineRootPanes(uiDefaults); defineSeparators(uiDefaults); defineSpinners(uiDefaults); defineScrollBars(uiDefaults); defineScrollPane(uiDefaults); defineSliders(uiDefaults); defineSplitPanes(uiDefaults); defineTabbedPanes(uiDefaults); defineTables(uiDefaults); defineTextControls(uiDefaults); defineToolBars(uiDefaults); defineTrees(uiDefaults); defineToolTips(uiDefaults); defineOptionPane(uiDefaults); defineFileChooser(uiDefaults); if (!PlatformUtils.isMac()) { uiDefaults.put("MenuBar[Enabled].backgroundPainter", null); uiDefaults.put("MenuBar[Enabled].borderPainter", null); // If we're not on a Mac, draw our own title bar. JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); } else { // If we're on a Mac, use the screen menu bar. System.setProperty("apple.laf.useScreenMenuBar", "true"); // If we're on a Mac, use Aqua for some things. defineAquaSettings(uiDefaults); } } return uiDefaults; }
[ "@", "Override", "public", "UIDefaults", "getDefaults", "(", ")", "{", "if", "(", "uiDefaults", "==", "null", ")", "{", "uiDefaults", "=", "new", "UIWrapper", "(", "super", ".", "getDefaults", "(", ")", ")", ";", "// Install Keybindings for the operating system.", "if", "(", "PlatformUtils", ".", "isWindows", "(", ")", ")", "{", "WindowsKeybindings", ".", "installKeybindings", "(", "uiDefaults", ")", ";", "}", "else", "if", "(", "PlatformUtils", ".", "isMac", "(", ")", ")", "{", "MacKeybindings", ".", "installKeybindings", "(", "uiDefaults", ")", ";", "}", "else", "{", "GTKKeybindings", ".", "installKeybindings", "(", "uiDefaults", ")", ";", "}", "// Set the default font.", "defineDefaultFont", "(", "uiDefaults", ")", ";", "// Override some of the Synth UI delegates with copied and modified", "// versions.", "useOurUIs", "(", ")", ";", "defineBaseColors", "(", "uiDefaults", ")", ";", "defineDefaultBorders", "(", "uiDefaults", ")", ";", "defineArrowButtons", "(", "uiDefaults", ")", ";", "defineButtons", "(", "uiDefaults", ")", ";", "defineComboBoxes", "(", "uiDefaults", ")", ";", "defineDesktopPanes", "(", "uiDefaults", ")", ";", "defineInternalFrames", "(", "uiDefaults", ")", ";", "defineInternalFrameMenuButtons", "(", "uiDefaults", ")", ";", "defineInternalFrameCloseButtons", "(", "uiDefaults", ")", ";", "defineInternalFrameIconifyButtons", "(", "uiDefaults", ")", ";", "defineInternalFrameMaximizeButton", "(", "uiDefaults", ")", ";", "defineLists", "(", "uiDefaults", ")", ";", "defineMenus", "(", "uiDefaults", ")", ";", "definePanels", "(", "uiDefaults", ")", ";", "definePopups", "(", "uiDefaults", ")", ";", "defineProgressBars", "(", "uiDefaults", ")", ";", "defineRootPanes", "(", "uiDefaults", ")", ";", "defineSeparators", "(", "uiDefaults", ")", ";", "defineSpinners", "(", "uiDefaults", ")", ";", "defineScrollBars", "(", "uiDefaults", ")", ";", "defineScrollPane", "(", "uiDefaults", ")", ";", "defineSliders", "(", "uiDefaults", ")", ";", "defineSplitPanes", "(", "uiDefaults", ")", ";", "defineTabbedPanes", "(", "uiDefaults", ")", ";", "defineTables", "(", "uiDefaults", ")", ";", "defineTextControls", "(", "uiDefaults", ")", ";", "defineToolBars", "(", "uiDefaults", ")", ";", "defineTrees", "(", "uiDefaults", ")", ";", "defineToolTips", "(", "uiDefaults", ")", ";", "defineOptionPane", "(", "uiDefaults", ")", ";", "defineFileChooser", "(", "uiDefaults", ")", ";", "if", "(", "!", "PlatformUtils", ".", "isMac", "(", ")", ")", "{", "uiDefaults", ".", "put", "(", "\"MenuBar[Enabled].backgroundPainter\"", ",", "null", ")", ";", "uiDefaults", ".", "put", "(", "\"MenuBar[Enabled].borderPainter\"", ",", "null", ")", ";", "// If we're not on a Mac, draw our own title bar.", "JFrame", ".", "setDefaultLookAndFeelDecorated", "(", "true", ")", ";", "JDialog", ".", "setDefaultLookAndFeelDecorated", "(", "true", ")", ";", "}", "else", "{", "// If we're on a Mac, use the screen menu bar.", "System", ".", "setProperty", "(", "\"apple.laf.useScreenMenuBar\"", ",", "\"true\"", ")", ";", "// If we're on a Mac, use Aqua for some things.", "defineAquaSettings", "(", "uiDefaults", ")", ";", "}", "}", "return", "uiDefaults", ";", "}" ]
Returns the defaults for SeaGlassLookAndFeel. @return the UI defaults for SeaGlassLookAndFeel.
[ "Returns", "the", "defaults", "for", "SeaGlassLookAndFeel", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L444-L515
707
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineToolTips
private void defineToolTips(UIDefaults d) { String p = "ToolTip"; d.put("seaGlassToolTipBorder", new Color(0x5b7ea4)); d.put(p + ".contentMargins", new InsetsUIResource(4, 4, 4, 4)); d.put(p + ".opaque", Boolean.FALSE); d.put(p + ".background", new ColorUIResource(0xd5, 0xe8, 0xf7)); d.put(p + ".backgroundPainter", new ToolTipPainter(ToolTipPainter.Which.BORDER_ENABLED)); }
java
private void defineToolTips(UIDefaults d) { String p = "ToolTip"; d.put("seaGlassToolTipBorder", new Color(0x5b7ea4)); d.put(p + ".contentMargins", new InsetsUIResource(4, 4, 4, 4)); d.put(p + ".opaque", Boolean.FALSE); d.put(p + ".background", new ColorUIResource(0xd5, 0xe8, 0xf7)); d.put(p + ".backgroundPainter", new ToolTipPainter(ToolTipPainter.Which.BORDER_ENABLED)); }
[ "private", "void", "defineToolTips", "(", "UIDefaults", "d", ")", "{", "String", "p", "=", "\"ToolTip\"", ";", "d", ".", "put", "(", "\"seaGlassToolTipBorder\"", ",", "new", "Color", "(", "0x5b7ea4", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "4", ",", "4", ",", "4", ",", "4", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".opaque\"", ",", "Boolean", ".", "FALSE", ")", ";", "d", ".", "put", "(", "p", "+", "\".background\"", ",", "new", "ColorUIResource", "(", "0xd5", ",", "0xe8", ",", "0xf7", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".backgroundPainter\"", ",", "new", "ToolTipPainter", "(", "ToolTipPainter", ".", "Which", ".", "BORDER_ENABLED", ")", ")", ";", "}" ]
Define some settings for tool tips. @param d
[ "Define", "some", "settings", "for", "tool", "tips", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L573-L580
708
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.useOurUIs
private void useOurUIs() { for (String uiName : UI_LIST) { uiName = uiName + "UI"; uiDefaults.put(uiName, UI_PACKAGE_PREFIX + uiName); } }
java
private void useOurUIs() { for (String uiName : UI_LIST) { uiName = uiName + "UI"; uiDefaults.put(uiName, UI_PACKAGE_PREFIX + uiName); } }
[ "private", "void", "useOurUIs", "(", ")", "{", "for", "(", "String", "uiName", ":", "UI_LIST", ")", "{", "uiName", "=", "uiName", "+", "\"UI\"", ";", "uiDefaults", ".", "put", "(", "uiName", ",", "UI_PACKAGE_PREFIX", "+", "uiName", ")", ";", "}", "}" ]
Use our UI delegate for the specified UI control type. @param d the UI defaults map. @param uiName the UI type, e.g. "ScrollPane".
[ "Use", "our", "UI", "delegate", "for", "the", "specified", "UI", "control", "type", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L588-L593
709
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.initializeDefaultFont
protected Font initializeDefaultFont() { /* * Set the default font to Lucida Grande if available, else use Lucida * Sans Unicode. Grande is a later font and a bit nicer looking, but it * is a derivation of Sans Unicode, so they're compatible. */ if (defaultFont == null) { if (PlatformUtils.isMac()) { defaultFont = new Font("Lucida Grande", Font.PLAIN, 13); } if (defaultFont == null) { defaultFont = new Font("Dialog", Font.PLAIN, 13); } if (defaultFont == null) { defaultFont = new Font("SansSerif", Font.PLAIN, 13); } } return defaultFont; }
java
protected Font initializeDefaultFont() { /* * Set the default font to Lucida Grande if available, else use Lucida * Sans Unicode. Grande is a later font and a bit nicer looking, but it * is a derivation of Sans Unicode, so they're compatible. */ if (defaultFont == null) { if (PlatformUtils.isMac()) { defaultFont = new Font("Lucida Grande", Font.PLAIN, 13); } if (defaultFont == null) { defaultFont = new Font("Dialog", Font.PLAIN, 13); } if (defaultFont == null) { defaultFont = new Font("SansSerif", Font.PLAIN, 13); } } return defaultFont; }
[ "protected", "Font", "initializeDefaultFont", "(", ")", "{", "/*\n * Set the default font to Lucida Grande if available, else use Lucida\n * Sans Unicode. Grande is a later font and a bit nicer looking, but it\n * is a derivation of Sans Unicode, so they're compatible.\n */", "if", "(", "defaultFont", "==", "null", ")", "{", "if", "(", "PlatformUtils", ".", "isMac", "(", ")", ")", "{", "defaultFont", "=", "new", "Font", "(", "\"Lucida Grande\"", ",", "Font", ".", "PLAIN", ",", "13", ")", ";", "}", "if", "(", "defaultFont", "==", "null", ")", "{", "defaultFont", "=", "new", "Font", "(", "\"Dialog\"", ",", "Font", ".", "PLAIN", ",", "13", ")", ";", "}", "if", "(", "defaultFont", "==", "null", ")", "{", "defaultFont", "=", "new", "Font", "(", "\"SansSerif\"", ",", "Font", ".", "PLAIN", ",", "13", ")", ";", "}", "}", "return", "defaultFont", ";", "}" ]
Initialize the default font. @return the default font.
[ "Initialize", "the", "default", "font", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L635-L657
710
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineAquaSettings
private void defineAquaSettings(UIDefaults d) { try { // Instantiate Aqua but don't install it. Class<?> lnfClass = Class.forName(UIManager.getSystemLookAndFeelClassName(), true, Thread.currentThread().getContextClassLoader()); LookAndFeel aqua = (LookAndFeel) lnfClass.newInstance(); UIDefaults aquaDefaults = aqua.getDefaults(); // Use Aqua for any menu UI classes. d.put("MenuBarUI", aquaDefaults.get("MenuBarUI")); d.put("MenuUI", aquaDefaults.get("MenuUI")); } catch (Exception e) { // TODO Should we do something with this exception? e.printStackTrace(); } }
java
private void defineAquaSettings(UIDefaults d) { try { // Instantiate Aqua but don't install it. Class<?> lnfClass = Class.forName(UIManager.getSystemLookAndFeelClassName(), true, Thread.currentThread().getContextClassLoader()); LookAndFeel aqua = (LookAndFeel) lnfClass.newInstance(); UIDefaults aquaDefaults = aqua.getDefaults(); // Use Aqua for any menu UI classes. d.put("MenuBarUI", aquaDefaults.get("MenuBarUI")); d.put("MenuUI", aquaDefaults.get("MenuUI")); } catch (Exception e) { // TODO Should we do something with this exception? e.printStackTrace(); } }
[ "private", "void", "defineAquaSettings", "(", "UIDefaults", "d", ")", "{", "try", "{", "// Instantiate Aqua but don't install it.", "Class", "<", "?", ">", "lnfClass", "=", "Class", ".", "forName", "(", "UIManager", ".", "getSystemLookAndFeelClassName", "(", ")", ",", "true", ",", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ")", ";", "LookAndFeel", "aqua", "=", "(", "LookAndFeel", ")", "lnfClass", ".", "newInstance", "(", ")", ";", "UIDefaults", "aquaDefaults", "=", "aqua", ".", "getDefaults", "(", ")", ";", "// Use Aqua for any menu UI classes.", "d", ".", "put", "(", "\"MenuBarUI\"", ",", "aquaDefaults", ".", "get", "(", "\"MenuBarUI\"", ")", ")", ";", "d", ".", "put", "(", "\"MenuUI\"", ",", "aquaDefaults", ".", "get", "(", "\"MenuUI\"", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// TODO Should we do something with this exception?", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Use Aqua settings for some properties if we're on a Mac. @param d the UI defaults map.
[ "Use", "Aqua", "settings", "for", "some", "properties", "if", "we", "re", "on", "a", "Mac", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L891-L908
711
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineArrowButtons
private void defineArrowButtons(UIDefaults d) { String c = PAINTER_PREFIX + "ArrowButtonPainter"; String p = "ArrowButton"; d.put(p + ".States", "Enabled,MouseOver,Disabled,Pressed"); d.put(p + "[Disabled].foreground", new ColorUIResource(0x9ba8cf)); d.put(p + "[Enabled].foreground", new ColorUIResource(0x5b7ea4)); // getDerivedColor("seaGlassBlueGrey", -0.6111111f, -0.110526316f, -0.34509805f, 0, true)); // JTabbedPane arrows no longer black: Nimbus dependency should be replaced with color value? d.put(p + "[Pressed].foreground", new ColorUIResource(0x134D8C)); d.put(p + "[Disabled].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_DISABLED)); d.put(p + "[Enabled].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_ENABLED)); d.put(p + "[MouseOver].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_ENABLED)); d.put(p + "[Pressed].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_PRESSED)); }
java
private void defineArrowButtons(UIDefaults d) { String c = PAINTER_PREFIX + "ArrowButtonPainter"; String p = "ArrowButton"; d.put(p + ".States", "Enabled,MouseOver,Disabled,Pressed"); d.put(p + "[Disabled].foreground", new ColorUIResource(0x9ba8cf)); d.put(p + "[Enabled].foreground", new ColorUIResource(0x5b7ea4)); // getDerivedColor("seaGlassBlueGrey", -0.6111111f, -0.110526316f, -0.34509805f, 0, true)); // JTabbedPane arrows no longer black: Nimbus dependency should be replaced with color value? d.put(p + "[Pressed].foreground", new ColorUIResource(0x134D8C)); d.put(p + "[Disabled].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_DISABLED)); d.put(p + "[Enabled].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_ENABLED)); d.put(p + "[MouseOver].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_ENABLED)); d.put(p + "[Pressed].foregroundPainter", new LazyPainter(c, ArrowButtonPainter.Which.FOREGROUND_PRESSED)); }
[ "private", "void", "defineArrowButtons", "(", "UIDefaults", "d", ")", "{", "String", "c", "=", "PAINTER_PREFIX", "+", "\"ArrowButtonPainter\"", ";", "String", "p", "=", "\"ArrowButton\"", ";", "d", ".", "put", "(", "p", "+", "\".States\"", ",", "\"Enabled,MouseOver,Disabled,Pressed\"", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].foreground\"", ",", "new", "ColorUIResource", "(", "0x9ba8cf", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].foreground\"", ",", "new", "ColorUIResource", "(", "0x5b7ea4", ")", ")", ";", "// getDerivedColor(\"seaGlassBlueGrey\", -0.6111111f, -0.110526316f, -0.34509805f, 0, true)); // JTabbedPane arrows no longer black: Nimbus dependency should be replaced with color value?", "d", ".", "put", "(", "p", "+", "\"[Pressed].foreground\"", ",", "new", "ColorUIResource", "(", "0x134D8C", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ArrowButtonPainter", ".", "Which", ".", "FOREGROUND_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ArrowButtonPainter", ".", "Which", ".", "FOREGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ArrowButtonPainter", ".", "Which", ".", "FOREGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ArrowButtonPainter", ".", "Which", ".", "FOREGROUND_PRESSED", ")", ")", ";", "}" ]
Initialize the arrow button settings. @param d the UI defaults map.
[ "Initialize", "the", "arrow", "button", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L915-L928
712
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineDesktopPanes
private void defineDesktopPanes(UIDefaults d) { d.put("seaGlassDesktopPane", new ColorUIResource(0x556ba6)); String c = PAINTER_PREFIX + "DesktopPanePainter"; String p = "DesktopPane"; d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopPanePainter.Which.BACKGROUND_ENABLED)); // Initialize DesktopIcon p = "DesktopIcon"; c = PAINTER_PREFIX + "DesktopIconPainter"; d.put(p + ".contentMargins", new InsetsUIResource(0, 6, 5, 4)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopIconPainter.Which.BACKGROUND_ENABLED)); }
java
private void defineDesktopPanes(UIDefaults d) { d.put("seaGlassDesktopPane", new ColorUIResource(0x556ba6)); String c = PAINTER_PREFIX + "DesktopPanePainter"; String p = "DesktopPane"; d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopPanePainter.Which.BACKGROUND_ENABLED)); // Initialize DesktopIcon p = "DesktopIcon"; c = PAINTER_PREFIX + "DesktopIconPainter"; d.put(p + ".contentMargins", new InsetsUIResource(0, 6, 5, 4)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopIconPainter.Which.BACKGROUND_ENABLED)); }
[ "private", "void", "defineDesktopPanes", "(", "UIDefaults", "d", ")", "{", "d", ".", "put", "(", "\"seaGlassDesktopPane\"", ",", "new", "ColorUIResource", "(", "0x556ba6", ")", ")", ";", "String", "c", "=", "PAINTER_PREFIX", "+", "\"DesktopPanePainter\"", ";", "String", "p", "=", "\"DesktopPane\"", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "DesktopPanePainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "// Initialize DesktopIcon", "p", "=", "\"DesktopIcon\"", ";", "c", "=", "PAINTER_PREFIX", "+", "\"DesktopIconPainter\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "6", ",", "5", ",", "4", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "DesktopIconPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "}" ]
Initialize the desktop pane UI settings. @param d the UI defaults map.
[ "Initialize", "the", "desktop", "pane", "UI", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1143-L1156
713
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineInternalFrameCloseButtons
private void defineInternalFrameCloseButtons(UIDefaults d) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.closeButton\""; String c = PAINTER_PREFIX + "TitlePaneCloseButtonPainter"; // Set the multiplicity of states for the Close button. d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,WindowNotFocused"); d.put(p + ".WindowNotFocused", new TitlePaneCloseButtonWindowNotFocusedState()); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_PRESSED)); d.put(p + "[Enabled+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED)); d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 43, 18)); }
java
private void defineInternalFrameCloseButtons(UIDefaults d) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.closeButton\""; String c = PAINTER_PREFIX + "TitlePaneCloseButtonPainter"; // Set the multiplicity of states for the Close button. d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,WindowNotFocused"); d.put(p + ".WindowNotFocused", new TitlePaneCloseButtonWindowNotFocusedState()); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_PRESSED)); d.put(p + "[Enabled+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED)); d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 43, 18)); }
[ "private", "void", "defineInternalFrameCloseButtons", "(", "UIDefaults", "d", ")", "{", "String", "p", "=", "\"InternalFrame:InternalFrameTitlePane:\\\"InternalFrameTitlePane.closeButton\\\"\"", ";", "String", "c", "=", "PAINTER_PREFIX", "+", "\"TitlePaneCloseButtonPainter\"", ";", "// Set the multiplicity of states for the Close button.", "d", ".", "put", "(", "p", "+", "\".States\"", ",", "\"Enabled,MouseOver,Pressed,Disabled,Focused,Selected,WindowNotFocused\"", ")", ";", "d", ".", "put", "(", "p", "+", "\".WindowNotFocused\"", ",", "new", "TitlePaneCloseButtonWindowNotFocusedState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneCloseButtonPainter", ".", "Which", ".", "BACKGROUND_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneCloseButtonPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneCloseButtonPainter", ".", "Which", ".", "BACKGROUND_MOUSEOVER", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneCloseButtonPainter", ".", "Which", ".", "BACKGROUND_PRESSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneCloseButtonPainter", ".", "Which", ".", "BACKGROUND_ENABLED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneCloseButtonPainter", ".", "Which", ".", "BACKGROUND_MOUSEOVER", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneCloseButtonPainter", ".", "Which", ".", "BACKGROUND_PRESSED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".icon\"", ",", "new", "SeaGlassIcon", "(", "p", ",", "\"iconPainter\"", ",", "43", ",", "18", ")", ")", ";", "}" ]
Initialize the internal frame close button settings. @param d the UI defaults map.
[ "Initialize", "the", "internal", "frame", "close", "button", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1234-L1252
714
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineInternalFrameIconifyButtons
private void defineInternalFrameIconifyButtons(UIDefaults d) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.iconifyButton\""; String c = PAINTER_PREFIX + "TitlePaneIconifyButtonPainter"; d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,WindowNotFocused,WindowMinimized"); d.put(p + ".WindowNotFocused", new TitlePaneIconifyButtonWindowNotFocusedState()); d.put(p + ".WindowMinimized", new TitlePaneIconifyButtonWindowMinimizedState()); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); // Set the iconify button states. d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_PRESSED)); d.put(p + "[Enabled+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED)); // Set the restore button states. d.put(p + "[Disabled+WindowMinimized].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_DISABLED)); d.put(p + "[Enabled+WindowMinimized].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_ENABLED)); d.put(p + "[MouseOver+WindowMinimized].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_MOUSEOVER)); d.put(p + "[Pressed+WindowMinimized].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_PRESSED)); d.put(p + "[Enabled+WindowMinimized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowMinimized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowMinimized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_PRESSED_WINDOWNOTFOCUSED)); d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 26, 18)); }
java
private void defineInternalFrameIconifyButtons(UIDefaults d) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.iconifyButton\""; String c = PAINTER_PREFIX + "TitlePaneIconifyButtonPainter"; d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,WindowNotFocused,WindowMinimized"); d.put(p + ".WindowNotFocused", new TitlePaneIconifyButtonWindowNotFocusedState()); d.put(p + ".WindowMinimized", new TitlePaneIconifyButtonWindowMinimizedState()); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); // Set the iconify button states. d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_PRESSED)); d.put(p + "[Enabled+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED)); // Set the restore button states. d.put(p + "[Disabled+WindowMinimized].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_DISABLED)); d.put(p + "[Enabled+WindowMinimized].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_ENABLED)); d.put(p + "[MouseOver+WindowMinimized].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_MOUSEOVER)); d.put(p + "[Pressed+WindowMinimized].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_PRESSED)); d.put(p + "[Enabled+WindowMinimized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowMinimized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowMinimized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneIconifyButtonPainter.Which.BACKGROUND_MINIMIZED_PRESSED_WINDOWNOTFOCUSED)); d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 26, 18)); }
[ "private", "void", "defineInternalFrameIconifyButtons", "(", "UIDefaults", "d", ")", "{", "String", "p", "=", "\"InternalFrame:InternalFrameTitlePane:\\\"InternalFrameTitlePane.iconifyButton\\\"\"", ";", "String", "c", "=", "PAINTER_PREFIX", "+", "\"TitlePaneIconifyButtonPainter\"", ";", "d", ".", "put", "(", "p", "+", "\".States\"", ",", "\"Enabled,MouseOver,Pressed,Disabled,Focused,Selected,WindowNotFocused,WindowMinimized\"", ")", ";", "d", ".", "put", "(", "p", "+", "\".WindowNotFocused\"", ",", "new", "TitlePaneIconifyButtonWindowNotFocusedState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".WindowMinimized\"", ",", "new", "TitlePaneIconifyButtonWindowMinimizedState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "// Set the iconify button states.", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_MOUSEOVER", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_PRESSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_ENABLED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_PRESSED_WINDOWNOTFOCUSED", ")", ")", ";", "// Set the restore button states.", "d", ".", "put", "(", "p", "+", "\"[Disabled+WindowMinimized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_MINIMIZED_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowMinimized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_MINIMIZED_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver+WindowMinimized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_MINIMIZED_MOUSEOVER", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed+WindowMinimized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_MINIMIZED_PRESSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowMinimized+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_MINIMIZED_ENABLED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver+WindowMinimized+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_MINIMIZED_MOUSEOVER_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed+WindowMinimized+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneIconifyButtonPainter", ".", "Which", ".", "BACKGROUND_MINIMIZED_PRESSED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".icon\"", ",", "new", "SeaGlassIcon", "(", "p", ",", "\"iconPainter\"", ",", "26", ",", "18", ")", ")", ";", "}" ]
Initialize the internal frame iconify button settings. @param d the UI defaults map.
[ "Initialize", "the", "internal", "frame", "iconify", "button", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1259-L1301
715
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineInternalFrameMaximizeButton
private void defineInternalFrameMaximizeButton(UIDefaults d) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.maximizeButton\""; String c = PAINTER_PREFIX + "TitlePaneMaximizeButtonPainter"; d.put(p + ".WindowNotFocused", new TitlePaneMaximizeButtonWindowNotFocusedState()); d.put(p + ".WindowMaximized", new TitlePaneMaximizeButtonWindowMaximizedState()); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); // Set the maximize button states. d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED)); d.put(p + "[Enabled+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED)); // Set the restore button states. d.put(p + "[Disabled+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_DISABLED)); d.put(p + "[Enabled+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED)); d.put(p + "[MouseOver+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER)); d.put(p + "[Pressed+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED)); d.put(p + "[Enabled+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED_WINDOWNOTFOCUSED)); d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 25, 18)); }
java
private void defineInternalFrameMaximizeButton(UIDefaults d) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.maximizeButton\""; String c = PAINTER_PREFIX + "TitlePaneMaximizeButtonPainter"; d.put(p + ".WindowNotFocused", new TitlePaneMaximizeButtonWindowNotFocusedState()); d.put(p + ".WindowMaximized", new TitlePaneMaximizeButtonWindowMaximizedState()); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); // Set the maximize button states. d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER)); d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED)); d.put(p + "[Enabled+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED)); // Set the restore button states. d.put(p + "[Disabled+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_DISABLED)); d.put(p + "[Enabled+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED)); d.put(p + "[MouseOver+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER)); d.put(p + "[Pressed+WindowMaximized].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED)); d.put(p + "[Enabled+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowMaximized+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneMaximizeButtonPainter.Which.BACKGROUND_MAXIMIZED_PRESSED_WINDOWNOTFOCUSED)); d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 25, 18)); }
[ "private", "void", "defineInternalFrameMaximizeButton", "(", "UIDefaults", "d", ")", "{", "String", "p", "=", "\"InternalFrame:InternalFrameTitlePane:\\\"InternalFrameTitlePane.maximizeButton\\\"\"", ";", "String", "c", "=", "PAINTER_PREFIX", "+", "\"TitlePaneMaximizeButtonPainter\"", ";", "d", ".", "put", "(", "p", "+", "\".WindowNotFocused\"", ",", "new", "TitlePaneMaximizeButtonWindowNotFocusedState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".WindowMaximized\"", ",", "new", "TitlePaneMaximizeButtonWindowMaximizedState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "// Set the maximize button states.", "d", ".", "put", "(", "p", "+", "\"[Disabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MOUSEOVER", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_PRESSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_ENABLED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MOUSEOVER_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_PRESSED_WINDOWNOTFOCUSED", ")", ")", ";", "// Set the restore button states.", "d", ".", "put", "(", "p", "+", "\"[Disabled+WindowMaximized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowMaximized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver+WindowMaximized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_MOUSEOVER", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed+WindowMaximized].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_PRESSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowMaximized+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_ENABLED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver+WindowMaximized+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_MOUSEOVER_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed+WindowMaximized+WindowNotFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMaximizeButtonPainter", ".", "Which", ".", "BACKGROUND_MAXIMIZED_PRESSED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".icon\"", ",", "new", "SeaGlassIcon", "(", "p", ",", "\"iconPainter\"", ",", "25", ",", "18", ")", ")", ";", "}" ]
Initialize the internal frame maximize button settings. @param d the UI defaults map.
[ "Initialize", "the", "internal", "frame", "maximize", "button", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1308-L1355
716
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineInternalFrameMenuButtons
private void defineInternalFrameMenuButtons(UIDefaults d) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.menuButton\""; String c = PAINTER_PREFIX + "TitlePaneMenuButtonPainter"; d.put(p + ".WindowNotFocused", new TitlePaneMenuButtonWindowNotFocusedState()); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); // Set the states for the Menu button. d.put(p + "[Enabled].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_ENABLED)); d.put(p + "[Disabled].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_DISABLED)); d.put(p + "[MouseOver].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_MOUSEOVER)); d.put(p + "[Pressed].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_PRESSED)); d.put(p + "[Enabled+WindowNotFocused].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowNotFocused].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowNotFocused].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_PRESSED_WINDOWNOTFOCUSED)); d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 19, 18)); }
java
private void defineInternalFrameMenuButtons(UIDefaults d) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.menuButton\""; String c = PAINTER_PREFIX + "TitlePaneMenuButtonPainter"; d.put(p + ".WindowNotFocused", new TitlePaneMenuButtonWindowNotFocusedState()); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); // Set the states for the Menu button. d.put(p + "[Enabled].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_ENABLED)); d.put(p + "[Disabled].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_DISABLED)); d.put(p + "[MouseOver].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_MOUSEOVER)); d.put(p + "[Pressed].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_PRESSED)); d.put(p + "[Enabled+WindowNotFocused].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_ENABLED_WINDOWNOTFOCUSED)); d.put(p + "[MouseOver+WindowNotFocused].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_MOUSEOVER_WINDOWNOTFOCUSED)); d.put(p + "[Pressed+WindowNotFocused].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_PRESSED_WINDOWNOTFOCUSED)); d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 19, 18)); }
[ "private", "void", "defineInternalFrameMenuButtons", "(", "UIDefaults", "d", ")", "{", "String", "p", "=", "\"InternalFrame:InternalFrameTitlePane:\\\"InternalFrameTitlePane.menuButton\\\"\"", ";", "String", "c", "=", "PAINTER_PREFIX", "+", "\"TitlePaneMenuButtonPainter\"", ";", "d", ".", "put", "(", "p", "+", "\".WindowNotFocused\"", ",", "new", "TitlePaneMenuButtonWindowNotFocusedState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "// Set the states for the Menu button.", "d", ".", "put", "(", "p", "+", "\"[Enabled].iconPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMenuButtonPainter", ".", "Which", ".", "ICON_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].iconPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMenuButtonPainter", ".", "Which", ".", "ICON_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver].iconPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMenuButtonPainter", ".", "Which", ".", "ICON_MOUSEOVER", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed].iconPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMenuButtonPainter", ".", "Which", ".", "ICON_PRESSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowNotFocused].iconPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMenuButtonPainter", ".", "Which", ".", "ICON_ENABLED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[MouseOver+WindowNotFocused].iconPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMenuButtonPainter", ".", "Which", ".", "ICON_MOUSEOVER_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Pressed+WindowNotFocused].iconPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "TitlePaneMenuButtonPainter", ".", "Which", ".", "ICON_PRESSED_WINDOWNOTFOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".icon\"", ",", "new", "SeaGlassIcon", "(", "p", ",", "\"iconPainter\"", ",", "19", ",", "18", ")", ")", ";", "}" ]
Initialize the internal frame menu button settings. @param d the UI defaults map.
[ "Initialize", "the", "internal", "frame", "menu", "button", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1362-L1385
717
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineLists
private void defineLists(UIDefaults d) { String p = "List"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".opaque", Boolean.TRUE); d.put(p + ".background", d.get("seaGlassLightBackground")); d.put(p + ".dropLineColor", d.get("seaGlassFocus")); d.put(p + ".rendererUseListColors", Boolean.TRUE); d.put(p + ".rendererUseUIBorder", Boolean.TRUE); d.put(p + ".cellNoFocusBorder", new BorderUIResource(BorderFactory.createEmptyBorder(2, 5, 2, 5))); d.put(p + ".focusCellHighlightBorder", new BorderUIResource(new PainterBorder("Tree:TreeCell[Enabled+Focused].backgroundPainter", new Insets(2, 5, 2, 5)))); // TODO Why doesn't ColorUIResource work here? d.put(p + "[Selected].textForeground", Color.WHITE); d.put(p + "[Selected].textBackground", d.get("seaGlassSelection")); d.put(p + "[Disabled+Selected].textBackground", Color.WHITE); d.put(p + "[Disabled].textForeground", d.get("seaGlassDisabledText")); p = "List:\"List.cellRenderer\""; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".opaque", Boolean.TRUE); d.put(p + "[Disabled].textForeground", d.get("seaGlassDisabledText")); d.put(p + "[Disabled].background", d.get("seaGlassSelectionBackground")); }
java
private void defineLists(UIDefaults d) { String p = "List"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".opaque", Boolean.TRUE); d.put(p + ".background", d.get("seaGlassLightBackground")); d.put(p + ".dropLineColor", d.get("seaGlassFocus")); d.put(p + ".rendererUseListColors", Boolean.TRUE); d.put(p + ".rendererUseUIBorder", Boolean.TRUE); d.put(p + ".cellNoFocusBorder", new BorderUIResource(BorderFactory.createEmptyBorder(2, 5, 2, 5))); d.put(p + ".focusCellHighlightBorder", new BorderUIResource(new PainterBorder("Tree:TreeCell[Enabled+Focused].backgroundPainter", new Insets(2, 5, 2, 5)))); // TODO Why doesn't ColorUIResource work here? d.put(p + "[Selected].textForeground", Color.WHITE); d.put(p + "[Selected].textBackground", d.get("seaGlassSelection")); d.put(p + "[Disabled+Selected].textBackground", Color.WHITE); d.put(p + "[Disabled].textForeground", d.get("seaGlassDisabledText")); p = "List:\"List.cellRenderer\""; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".opaque", Boolean.TRUE); d.put(p + "[Disabled].textForeground", d.get("seaGlassDisabledText")); d.put(p + "[Disabled].background", d.get("seaGlassSelectionBackground")); }
[ "private", "void", "defineLists", "(", "UIDefaults", "d", ")", "{", "String", "p", "=", "\"List\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".opaque\"", ",", "Boolean", ".", "TRUE", ")", ";", "d", ".", "put", "(", "p", "+", "\".background\"", ",", "d", ".", "get", "(", "\"seaGlassLightBackground\"", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".dropLineColor\"", ",", "d", ".", "get", "(", "\"seaGlassFocus\"", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".rendererUseListColors\"", ",", "Boolean", ".", "TRUE", ")", ";", "d", ".", "put", "(", "p", "+", "\".rendererUseUIBorder\"", ",", "Boolean", ".", "TRUE", ")", ";", "d", ".", "put", "(", "p", "+", "\".cellNoFocusBorder\"", ",", "new", "BorderUIResource", "(", "BorderFactory", ".", "createEmptyBorder", "(", "2", ",", "5", ",", "2", ",", "5", ")", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".focusCellHighlightBorder\"", ",", "new", "BorderUIResource", "(", "new", "PainterBorder", "(", "\"Tree:TreeCell[Enabled+Focused].backgroundPainter\"", ",", "new", "Insets", "(", "2", ",", "5", ",", "2", ",", "5", ")", ")", ")", ")", ";", "// TODO Why doesn't ColorUIResource work here?", "d", ".", "put", "(", "p", "+", "\"[Selected].textForeground\"", ",", "Color", ".", "WHITE", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Selected].textBackground\"", ",", "d", ".", "get", "(", "\"seaGlassSelection\"", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled+Selected].textBackground\"", ",", "Color", ".", "WHITE", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].textForeground\"", ",", "d", ".", "get", "(", "\"seaGlassDisabledText\"", ")", ")", ";", "p", "=", "\"List:\\\"List.cellRenderer\\\"\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".opaque\"", ",", "Boolean", ".", "TRUE", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].textForeground\"", ",", "d", ".", "get", "(", "\"seaGlassDisabledText\"", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].background\"", ",", "d", ".", "get", "(", "\"seaGlassSelectionBackground\"", ")", ")", ";", "}" ]
Initialize the list settings. @param d the UI defaults map.
[ "Initialize", "the", "list", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1392-L1418
718
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.definePanels
private void definePanels(UIDefaults d) { String p = "Panel"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".background", new ColorUIResource((Color) d.get("control"))); d.put(p + ".opaque", Boolean.TRUE); }
java
private void definePanels(UIDefaults d) { String p = "Panel"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".background", new ColorUIResource((Color) d.get("control"))); d.put(p + ".opaque", Boolean.TRUE); }
[ "private", "void", "definePanels", "(", "UIDefaults", "d", ")", "{", "String", "p", "=", "\"Panel\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".background\"", ",", "new", "ColorUIResource", "(", "(", "Color", ")", "d", ".", "get", "(", "\"control\"", ")", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".opaque\"", ",", "Boolean", ".", "TRUE", ")", ";", "}" ]
Initialize the panel settings. @param d the UI defaults map.
[ "Initialize", "the", "panel", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1560-L1565
719
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.definePopups
private void definePopups(UIDefaults d) { d.put("seaGlassPopupBorder", new ColorUIResource(0xbbbbbb)); d.put("popupMenuInteriorEnabled", Color.WHITE); // Rossi: Changed color of popup / submenus to get better contrast to bright backgrounds. // d.put("popupMenuBorderEnabled", new Color(0xdddddd)); d.put("popupMenuBorderEnabled", new Color(0x5b7ea4)); String c = PAINTER_PREFIX + "PopupMenuPainter"; String p = "PopupMenu"; d.put(p + ".contentMargins", new InsetsUIResource(6, 1, 6, 1)); d.put(p + ".opaque", Boolean.TRUE); d.put(p + ".consumeEventOnClose", Boolean.TRUE); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, PopupMenuPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, PopupMenuPainter.Which.BACKGROUND_ENABLED)); // Initialize PopupMenuSeparator c = PAINTER_PREFIX + "SeparatorPainter"; p = "PopupMenuSeparator"; d.put(p + ".contentMargins", new InsetsUIResource(1, 0, 2, 0)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, SeparatorPainter.Which.BACKGROUND_ENABLED)); }
java
private void definePopups(UIDefaults d) { d.put("seaGlassPopupBorder", new ColorUIResource(0xbbbbbb)); d.put("popupMenuInteriorEnabled", Color.WHITE); // Rossi: Changed color of popup / submenus to get better contrast to bright backgrounds. // d.put("popupMenuBorderEnabled", new Color(0xdddddd)); d.put("popupMenuBorderEnabled", new Color(0x5b7ea4)); String c = PAINTER_PREFIX + "PopupMenuPainter"; String p = "PopupMenu"; d.put(p + ".contentMargins", new InsetsUIResource(6, 1, 6, 1)); d.put(p + ".opaque", Boolean.TRUE); d.put(p + ".consumeEventOnClose", Boolean.TRUE); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, PopupMenuPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, PopupMenuPainter.Which.BACKGROUND_ENABLED)); // Initialize PopupMenuSeparator c = PAINTER_PREFIX + "SeparatorPainter"; p = "PopupMenuSeparator"; d.put(p + ".contentMargins", new InsetsUIResource(1, 0, 2, 0)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, SeparatorPainter.Which.BACKGROUND_ENABLED)); }
[ "private", "void", "definePopups", "(", "UIDefaults", "d", ")", "{", "d", ".", "put", "(", "\"seaGlassPopupBorder\"", ",", "new", "ColorUIResource", "(", "0xbbbbbb", ")", ")", ";", "d", ".", "put", "(", "\"popupMenuInteriorEnabled\"", ",", "Color", ".", "WHITE", ")", ";", "// Rossi: Changed color of popup / submenus to get better contrast to bright backgrounds.", "// d.put(\"popupMenuBorderEnabled\", new Color(0xdddddd));", "d", ".", "put", "(", "\"popupMenuBorderEnabled\"", ",", "new", "Color", "(", "0x5b7ea4", ")", ")", ";", "String", "c", "=", "PAINTER_PREFIX", "+", "\"PopupMenuPainter\"", ";", "String", "p", "=", "\"PopupMenu\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "6", ",", "1", ",", "6", ",", "1", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".opaque\"", ",", "Boolean", ".", "TRUE", ")", ";", "d", ".", "put", "(", "p", "+", "\".consumeEventOnClose\"", ",", "Boolean", ".", "TRUE", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "PopupMenuPainter", ".", "Which", ".", "BACKGROUND_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "PopupMenuPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "// Initialize PopupMenuSeparator", "c", "=", "PAINTER_PREFIX", "+", "\"SeparatorPainter\"", ";", "p", "=", "\"PopupMenuSeparator\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "1", ",", "0", ",", "2", ",", "0", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SeparatorPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "}" ]
Initialize the popup settings. @param d the UI defaults map.
[ "Initialize", "the", "popup", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1572-L1594
720
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineProgressBars
private void defineProgressBars(UIDefaults d) { // Copied from nimbus //Initialize ProgressBar d.put("ProgressBar.contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put("ProgressBar.States", "Enabled,Disabled,Indeterminate,Finished"); d.put("ProgressBar.tileWhenIndeterminate", Boolean.TRUE); d.put("ProgressBar.paintOutsideClip", Boolean.TRUE); d.put("ProgressBar.rotateText", Boolean.TRUE); d.put("ProgressBar.vertictalSize", new DimensionUIResource(19, 150)); d.put("ProgressBar.horizontalSize", new DimensionUIResource(150, 19)); addColor(d, "ProgressBar[Disabled].textForeground", "seaGlassDisabledText", 0.0f, 0.0f, 0.0f, 0); d.put("ProgressBar[Disabled+Indeterminate].progressPadding", new Integer(3)); // Seaglass starts below. d.put("progressBarTrackInterior", Color.WHITE); d.put("progressBarTrackBase", new Color(0x4076bf)); d.put("ProgressBar.Indeterminate", new ProgressBarIndeterminateState()); d.put("ProgressBar.Finished", new ProgressBarFinishedState()); String p = "ProgressBar"; String c = PAINTER_PREFIX + "ProgressBarPainter"; d.put(p + ".cycleTime", 500); d.put(p + ".progressPadding", new Integer(3)); d.put(p + ".trackThickness", new Integer(19)); d.put(p + ".tileWidth", new Integer(24)); d.put(p + ".backgroundFillColor", Color.WHITE); d.put(p + ".font", new DerivedFont("defaultFont", 0.769f, null, null)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, ProgressBarPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, ProgressBarPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_ENABLED)); d.put(p + "[Enabled+Finished].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_ENABLED_FINISHED)); d.put(p + "[Enabled+Indeterminate].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_ENABLED_INDETERMINATE)); d.put(p + "[Disabled].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_DISABLED)); d.put(p + "[Disabled+Finished].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_DISABLED_FINISHED)); d.put(p + "[Disabled+Indeterminate].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_DISABLED_INDETERMINATE)); }
java
private void defineProgressBars(UIDefaults d) { // Copied from nimbus //Initialize ProgressBar d.put("ProgressBar.contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put("ProgressBar.States", "Enabled,Disabled,Indeterminate,Finished"); d.put("ProgressBar.tileWhenIndeterminate", Boolean.TRUE); d.put("ProgressBar.paintOutsideClip", Boolean.TRUE); d.put("ProgressBar.rotateText", Boolean.TRUE); d.put("ProgressBar.vertictalSize", new DimensionUIResource(19, 150)); d.put("ProgressBar.horizontalSize", new DimensionUIResource(150, 19)); addColor(d, "ProgressBar[Disabled].textForeground", "seaGlassDisabledText", 0.0f, 0.0f, 0.0f, 0); d.put("ProgressBar[Disabled+Indeterminate].progressPadding", new Integer(3)); // Seaglass starts below. d.put("progressBarTrackInterior", Color.WHITE); d.put("progressBarTrackBase", new Color(0x4076bf)); d.put("ProgressBar.Indeterminate", new ProgressBarIndeterminateState()); d.put("ProgressBar.Finished", new ProgressBarFinishedState()); String p = "ProgressBar"; String c = PAINTER_PREFIX + "ProgressBarPainter"; d.put(p + ".cycleTime", 500); d.put(p + ".progressPadding", new Integer(3)); d.put(p + ".trackThickness", new Integer(19)); d.put(p + ".tileWidth", new Integer(24)); d.put(p + ".backgroundFillColor", Color.WHITE); d.put(p + ".font", new DerivedFont("defaultFont", 0.769f, null, null)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, ProgressBarPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, ProgressBarPainter.Which.BACKGROUND_DISABLED)); d.put(p + "[Enabled].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_ENABLED)); d.put(p + "[Enabled+Finished].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_ENABLED_FINISHED)); d.put(p + "[Enabled+Indeterminate].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_ENABLED_INDETERMINATE)); d.put(p + "[Disabled].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_DISABLED)); d.put(p + "[Disabled+Finished].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_DISABLED_FINISHED)); d.put(p + "[Disabled+Indeterminate].foregroundPainter", new LazyPainter(c, ProgressBarPainter.Which.FOREGROUND_DISABLED_INDETERMINATE)); }
[ "private", "void", "defineProgressBars", "(", "UIDefaults", "d", ")", "{", "// Copied from nimbus", "//Initialize ProgressBar", "d", ".", "put", "(", "\"ProgressBar.contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "\"ProgressBar.States\"", ",", "\"Enabled,Disabled,Indeterminate,Finished\"", ")", ";", "d", ".", "put", "(", "\"ProgressBar.tileWhenIndeterminate\"", ",", "Boolean", ".", "TRUE", ")", ";", "d", ".", "put", "(", "\"ProgressBar.paintOutsideClip\"", ",", "Boolean", ".", "TRUE", ")", ";", "d", ".", "put", "(", "\"ProgressBar.rotateText\"", ",", "Boolean", ".", "TRUE", ")", ";", "d", ".", "put", "(", "\"ProgressBar.vertictalSize\"", ",", "new", "DimensionUIResource", "(", "19", ",", "150", ")", ")", ";", "d", ".", "put", "(", "\"ProgressBar.horizontalSize\"", ",", "new", "DimensionUIResource", "(", "150", ",", "19", ")", ")", ";", "addColor", "(", "d", ",", "\"ProgressBar[Disabled].textForeground\"", ",", "\"seaGlassDisabledText\"", ",", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0", ")", ";", "d", ".", "put", "(", "\"ProgressBar[Disabled+Indeterminate].progressPadding\"", ",", "new", "Integer", "(", "3", ")", ")", ";", "// Seaglass starts below.", "d", ".", "put", "(", "\"progressBarTrackInterior\"", ",", "Color", ".", "WHITE", ")", ";", "d", ".", "put", "(", "\"progressBarTrackBase\"", ",", "new", "Color", "(", "0x4076bf", ")", ")", ";", "d", ".", "put", "(", "\"ProgressBar.Indeterminate\"", ",", "new", "ProgressBarIndeterminateState", "(", ")", ")", ";", "d", ".", "put", "(", "\"ProgressBar.Finished\"", ",", "new", "ProgressBarFinishedState", "(", ")", ")", ";", "String", "p", "=", "\"ProgressBar\"", ";", "String", "c", "=", "PAINTER_PREFIX", "+", "\"ProgressBarPainter\"", ";", "d", ".", "put", "(", "p", "+", "\".cycleTime\"", ",", "500", ")", ";", "d", ".", "put", "(", "p", "+", "\".progressPadding\"", ",", "new", "Integer", "(", "3", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".trackThickness\"", ",", "new", "Integer", "(", "19", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".tileWidth\"", ",", "new", "Integer", "(", "24", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".backgroundFillColor\"", ",", "Color", ".", "WHITE", ")", ";", "d", ".", "put", "(", "p", "+", "\".font\"", ",", "new", "DerivedFont", "(", "\"defaultFont\"", ",", "0.769f", ",", "null", ",", "null", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ProgressBarPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ProgressBarPainter", ".", "Which", ".", "BACKGROUND_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ProgressBarPainter", ".", "Which", ".", "FOREGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+Finished].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ProgressBarPainter", ".", "Which", ".", "FOREGROUND_ENABLED_FINISHED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+Indeterminate].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ProgressBarPainter", ".", "Which", ".", "FOREGROUND_ENABLED_INDETERMINATE", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ProgressBarPainter", ".", "Which", ".", "FOREGROUND_DISABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled+Finished].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ProgressBarPainter", ".", "Which", ".", "FOREGROUND_DISABLED_FINISHED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Disabled+Indeterminate].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ProgressBarPainter", ".", "Which", ".", "FOREGROUND_DISABLED_INDETERMINATE", ")", ")", ";", "}" ]
Initialize the progress bar settings. @param d the UI defaults map.
[ "Initialize", "the", "progress", "bar", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1601-L1644
721
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineRootPanes
private void defineRootPanes(UIDefaults d) { String c = PAINTER_PREFIX + "FrameAndRootPainter"; String p = "RootPane"; d.put(p + ".States", "Enabled,WindowFocused,NoFrame"); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".opaque", Boolean.FALSE); d.put(p + ".NoFrame", new RootPaneNoFrameState()); d.put(p + ".WindowFocused", new RootPaneWindowFocusedState()); d.put(p + "[Enabled+NoFrame].backgroundPainter", new LazyPainter(c, FrameAndRootPainter.Which.BACKGROUND_ENABLED_NOFRAME)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, FrameAndRootPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Enabled+WindowFocused].backgroundPainter", new LazyPainter(c, FrameAndRootPainter.Which.BACKGROUND_ENABLED_WINDOWFOCUSED)); }
java
private void defineRootPanes(UIDefaults d) { String c = PAINTER_PREFIX + "FrameAndRootPainter"; String p = "RootPane"; d.put(p + ".States", "Enabled,WindowFocused,NoFrame"); d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".opaque", Boolean.FALSE); d.put(p + ".NoFrame", new RootPaneNoFrameState()); d.put(p + ".WindowFocused", new RootPaneWindowFocusedState()); d.put(p + "[Enabled+NoFrame].backgroundPainter", new LazyPainter(c, FrameAndRootPainter.Which.BACKGROUND_ENABLED_NOFRAME)); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, FrameAndRootPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Enabled+WindowFocused].backgroundPainter", new LazyPainter(c, FrameAndRootPainter.Which.BACKGROUND_ENABLED_WINDOWFOCUSED)); }
[ "private", "void", "defineRootPanes", "(", "UIDefaults", "d", ")", "{", "String", "c", "=", "PAINTER_PREFIX", "+", "\"FrameAndRootPainter\"", ";", "String", "p", "=", "\"RootPane\"", ";", "d", ".", "put", "(", "p", "+", "\".States\"", ",", "\"Enabled,WindowFocused,NoFrame\"", ")", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".opaque\"", ",", "Boolean", ".", "FALSE", ")", ";", "d", ".", "put", "(", "p", "+", "\".NoFrame\"", ",", "new", "RootPaneNoFrameState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".WindowFocused\"", ",", "new", "RootPaneWindowFocusedState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+NoFrame].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "FrameAndRootPainter", ".", "Which", ".", "BACKGROUND_ENABLED_NOFRAME", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "FrameAndRootPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+WindowFocused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "FrameAndRootPainter", ".", "Which", ".", "BACKGROUND_ENABLED_WINDOWFOCUSED", ")", ")", ";", "}" ]
Initialize the root pane settings. @param d the UI defaults map.
[ "Initialize", "the", "root", "pane", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1651-L1664
722
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineScrollPane
private void defineScrollPane(UIDefaults d) { // Define ScrollPane border painters. String c = PAINTER_PREFIX + "ScrollPanePainter"; String p = "ScrollPane"; d.put(p + ".opaque", Boolean.FALSE); d.put(p + ".contentMargins", new InsetsUIResource(3, 3, 3, 3)); // d.put(p + ".useChildTextComponentFocus", Boolean.TRUE); d.put(p + ".backgroundPainter", new LazyPainter(c, ScrollPanePainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Enabled+Focused].borderPainter", new LazyPainter(c, ScrollPanePainter.Which.BORDER_ENABLED_FOCUSED)); d.put(p + "[Enabled].borderPainter", new LazyPainter(c, ScrollPanePainter.Which.BORDER_ENABLED)); // Store ScrollPane Corner Component d.put(p + ".cornerPainter", new LazyPainter(c, ScrollPanePainter.Which.CORNER_ENABLED)); //Initialize Viewport p = "Viewport"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".opaque", Boolean.TRUE); }
java
private void defineScrollPane(UIDefaults d) { // Define ScrollPane border painters. String c = PAINTER_PREFIX + "ScrollPanePainter"; String p = "ScrollPane"; d.put(p + ".opaque", Boolean.FALSE); d.put(p + ".contentMargins", new InsetsUIResource(3, 3, 3, 3)); // d.put(p + ".useChildTextComponentFocus", Boolean.TRUE); d.put(p + ".backgroundPainter", new LazyPainter(c, ScrollPanePainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Enabled+Focused].borderPainter", new LazyPainter(c, ScrollPanePainter.Which.BORDER_ENABLED_FOCUSED)); d.put(p + "[Enabled].borderPainter", new LazyPainter(c, ScrollPanePainter.Which.BORDER_ENABLED)); // Store ScrollPane Corner Component d.put(p + ".cornerPainter", new LazyPainter(c, ScrollPanePainter.Which.CORNER_ENABLED)); //Initialize Viewport p = "Viewport"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".opaque", Boolean.TRUE); }
[ "private", "void", "defineScrollPane", "(", "UIDefaults", "d", ")", "{", "// Define ScrollPane border painters.", "String", "c", "=", "PAINTER_PREFIX", "+", "\"ScrollPanePainter\"", ";", "String", "p", "=", "\"ScrollPane\"", ";", "d", ".", "put", "(", "p", "+", "\".opaque\"", ",", "Boolean", ".", "FALSE", ")", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "3", ",", "3", ",", "3", ",", "3", ")", ")", ";", "// d.put(p + \".useChildTextComponentFocus\", Boolean.TRUE);", "d", ".", "put", "(", "p", "+", "\".backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ScrollPanePainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+Focused].borderPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ScrollPanePainter", ".", "Which", ".", "BORDER_ENABLED_FOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].borderPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ScrollPanePainter", ".", "Which", ".", "BORDER_ENABLED", ")", ")", ";", "// Store ScrollPane Corner Component", "d", ".", "put", "(", "p", "+", "\".cornerPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "ScrollPanePainter", ".", "Which", ".", "CORNER_ENABLED", ")", ")", ";", "//Initialize Viewport", "p", "=", "\"Viewport\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".opaque\"", ",", "Boolean", ".", "TRUE", ")", ";", "}" ]
Initialize the scroll pane UI @param d
[ "Initialize", "the", "scroll", "pane", "UI" ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1670-L1688
723
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineSeparators
private void defineSeparators(UIDefaults d) { String c = PAINTER_PREFIX + "SeparatorPainter"; d.put("Separator.contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put("Separator[Enabled].backgroundPainter", new LazyPainter(c, SeparatorPainter.Which.BACKGROUND_ENABLED)); }
java
private void defineSeparators(UIDefaults d) { String c = PAINTER_PREFIX + "SeparatorPainter"; d.put("Separator.contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put("Separator[Enabled].backgroundPainter", new LazyPainter(c, SeparatorPainter.Which.BACKGROUND_ENABLED)); }
[ "private", "void", "defineSeparators", "(", "UIDefaults", "d", ")", "{", "String", "c", "=", "PAINTER_PREFIX", "+", "\"SeparatorPainter\"", ";", "d", ".", "put", "(", "\"Separator.contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "\"Separator[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SeparatorPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "}" ]
Initialize the separator settings. @param d the UI defaults map.
[ "Initialize", "the", "separator", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1771-L1775
724
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.defineSplitPanes
private void defineSplitPanes(UIDefaults d) { d.put("splitPaneDividerBackgroundOuter", new Color(0xd9d9d9)); String p = "SplitPane"; d.put(p + ".contentMargins", new InsetsUIResource(1, 1, 1, 1)); d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,Vertical"); d.put(p + ".Vertical", new SplitPaneVerticalState()); d.put(p + ".size", new Integer(11)); d.put(p + ".dividerSize", new Integer(11)); d.put(p + ".centerOneTouchButtons", Boolean.TRUE); d.put(p + ".oneTouchButtonOffset", new Integer(20)); d.put(p + ".oneTouchButtonVOffset", new Integer(3)); d.put(p + ".oneTouchExpandable", Boolean.FALSE); d.put(p + ".continuousLayout", Boolean.TRUE); String c = PAINTER_PREFIX + "SplitPaneDividerPainter"; p = "SplitPane:SplitPaneDivider"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,Vertical"); d.put(p + ".Vertical", new SplitPaneDividerVerticalState()); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Focused].backgroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.BACKGROUND_FOCUSED)); d.put(p + "[Enabled].foregroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.FOREGROUND_ENABLED)); d.put(p + "[Focused].foregroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.FOREGROUND_FOCUSED)); d.put(p + "[Enabled+Vertical].foregroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.FOREGROUND_ENABLED_VERTICAL)); d.put(p + "[Focused+Vertical].foregroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.FOREGROUND_FOCUSED_VERTICAL)); }
java
private void defineSplitPanes(UIDefaults d) { d.put("splitPaneDividerBackgroundOuter", new Color(0xd9d9d9)); String p = "SplitPane"; d.put(p + ".contentMargins", new InsetsUIResource(1, 1, 1, 1)); d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,Vertical"); d.put(p + ".Vertical", new SplitPaneVerticalState()); d.put(p + ".size", new Integer(11)); d.put(p + ".dividerSize", new Integer(11)); d.put(p + ".centerOneTouchButtons", Boolean.TRUE); d.put(p + ".oneTouchButtonOffset", new Integer(20)); d.put(p + ".oneTouchButtonVOffset", new Integer(3)); d.put(p + ".oneTouchExpandable", Boolean.FALSE); d.put(p + ".continuousLayout", Boolean.TRUE); String c = PAINTER_PREFIX + "SplitPaneDividerPainter"; p = "SplitPane:SplitPaneDivider"; d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0)); d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,Vertical"); d.put(p + ".Vertical", new SplitPaneDividerVerticalState()); d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.BACKGROUND_ENABLED)); d.put(p + "[Focused].backgroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.BACKGROUND_FOCUSED)); d.put(p + "[Enabled].foregroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.FOREGROUND_ENABLED)); d.put(p + "[Focused].foregroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.FOREGROUND_FOCUSED)); d.put(p + "[Enabled+Vertical].foregroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.FOREGROUND_ENABLED_VERTICAL)); d.put(p + "[Focused+Vertical].foregroundPainter", new LazyPainter(c, SplitPaneDividerPainter.Which.FOREGROUND_FOCUSED_VERTICAL)); }
[ "private", "void", "defineSplitPanes", "(", "UIDefaults", "d", ")", "{", "d", ".", "put", "(", "\"splitPaneDividerBackgroundOuter\"", ",", "new", "Color", "(", "0xd9d9d9", ")", ")", ";", "String", "p", "=", "\"SplitPane\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "1", ",", "1", ",", "1", ",", "1", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".States\"", ",", "\"Enabled,MouseOver,Pressed,Disabled,Focused,Selected,Vertical\"", ")", ";", "d", ".", "put", "(", "p", "+", "\".Vertical\"", ",", "new", "SplitPaneVerticalState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".size\"", ",", "new", "Integer", "(", "11", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".dividerSize\"", ",", "new", "Integer", "(", "11", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".centerOneTouchButtons\"", ",", "Boolean", ".", "TRUE", ")", ";", "d", ".", "put", "(", "p", "+", "\".oneTouchButtonOffset\"", ",", "new", "Integer", "(", "20", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".oneTouchButtonVOffset\"", ",", "new", "Integer", "(", "3", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".oneTouchExpandable\"", ",", "Boolean", ".", "FALSE", ")", ";", "d", ".", "put", "(", "p", "+", "\".continuousLayout\"", ",", "Boolean", ".", "TRUE", ")", ";", "String", "c", "=", "PAINTER_PREFIX", "+", "\"SplitPaneDividerPainter\"", ";", "p", "=", "\"SplitPane:SplitPaneDivider\"", ";", "d", ".", "put", "(", "p", "+", "\".contentMargins\"", ",", "new", "InsetsUIResource", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\".States\"", ",", "\"Enabled,MouseOver,Pressed,Disabled,Focused,Selected,Vertical\"", ")", ";", "d", ".", "put", "(", "p", "+", "\".Vertical\"", ",", "new", "SplitPaneDividerVerticalState", "(", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SplitPaneDividerPainter", ".", "Which", ".", "BACKGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Focused].backgroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SplitPaneDividerPainter", ".", "Which", ".", "BACKGROUND_FOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SplitPaneDividerPainter", ".", "Which", ".", "FOREGROUND_ENABLED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Focused].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SplitPaneDividerPainter", ".", "Which", ".", "FOREGROUND_FOCUSED", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Enabled+Vertical].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SplitPaneDividerPainter", ".", "Which", ".", "FOREGROUND_ENABLED_VERTICAL", ")", ")", ";", "d", ".", "put", "(", "p", "+", "\"[Focused+Vertical].foregroundPainter\"", ",", "new", "LazyPainter", "(", "c", ",", "SplitPaneDividerPainter", ".", "Which", ".", "FOREGROUND_FOCUSED_VERTICAL", ")", ")", ";", "}" ]
Initialize the split pane UI settings. @param d the UI defaults map.
[ "Initialize", "the", "split", "pane", "UI", "settings", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1906-L1934
725
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.getPaintingInsets
public static Insets getPaintingInsets(SynthContext state, Insets insets) { if (state.getRegion().isSubregion()) { insets = state.getStyle().getInsets(state, insets); } else { insets = state.getComponent().getInsets(insets); } return insets; }
java
public static Insets getPaintingInsets(SynthContext state, Insets insets) { if (state.getRegion().isSubregion()) { insets = state.getStyle().getInsets(state, insets); } else { insets = state.getComponent().getInsets(insets); } return insets; }
[ "public", "static", "Insets", "getPaintingInsets", "(", "SynthContext", "state", ",", "Insets", "insets", ")", "{", "if", "(", "state", ".", "getRegion", "(", ")", ".", "isSubregion", "(", ")", ")", "{", "insets", "=", "state", ".", "getStyle", "(", ")", ".", "getInsets", "(", "state", ",", "insets", ")", ";", "}", "else", "{", "insets", "=", "state", ".", "getComponent", "(", ")", ".", "getInsets", "(", "insets", ")", ";", "}", "return", "insets", ";", "}" ]
A convenience method to return where the foreground should be painted for the Component identified by the passed in AbstractSynthContext. @param state the SynthContext representing the current state. @param insets an Insets object to be filled with the painting insets. @return the insets object passed in and filled with the painting insets.
[ "A", "convenience", "method", "to", "return", "where", "the", "foreground", "should", "be", "painted", "for", "the", "Component", "identified", "by", "the", "passed", "in", "AbstractSynthContext", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2522-L2530
726
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.resolveToolbarConstraint
public static Object resolveToolbarConstraint(JToolBar toolbar) { /* * NOTE: we don't worry about component orientation or PAGE_END etc * because the BasicToolBarUI always uses an absolute position of * NORTH/SOUTH/EAST/WEST. */ if (toolbar != null) { Container parent = toolbar.getParent(); if (parent != null) { LayoutManager m = parent.getLayout(); if (m instanceof BorderLayout) { BorderLayout b = (BorderLayout) m; Object con = b.getConstraints(toolbar); if (con == SOUTH || con == EAST || con == WEST) { return con; } return NORTH; } } } return NORTH; }
java
public static Object resolveToolbarConstraint(JToolBar toolbar) { /* * NOTE: we don't worry about component orientation or PAGE_END etc * because the BasicToolBarUI always uses an absolute position of * NORTH/SOUTH/EAST/WEST. */ if (toolbar != null) { Container parent = toolbar.getParent(); if (parent != null) { LayoutManager m = parent.getLayout(); if (m instanceof BorderLayout) { BorderLayout b = (BorderLayout) m; Object con = b.getConstraints(toolbar); if (con == SOUTH || con == EAST || con == WEST) { return con; } return NORTH; } } } return NORTH; }
[ "public", "static", "Object", "resolveToolbarConstraint", "(", "JToolBar", "toolbar", ")", "{", "/*\n * NOTE: we don't worry about component orientation or PAGE_END etc\n * because the BasicToolBarUI always uses an absolute position of\n * NORTH/SOUTH/EAST/WEST.\n */", "if", "(", "toolbar", "!=", "null", ")", "{", "Container", "parent", "=", "toolbar", ".", "getParent", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "LayoutManager", "m", "=", "parent", ".", "getLayout", "(", ")", ";", "if", "(", "m", "instanceof", "BorderLayout", ")", "{", "BorderLayout", "b", "=", "(", "BorderLayout", ")", "m", ";", "Object", "con", "=", "b", ".", "getConstraints", "(", "toolbar", ")", ";", "if", "(", "con", "==", "SOUTH", "||", "con", "==", "EAST", "||", "con", "==", "WEST", ")", "{", "return", "con", ";", "}", "return", "NORTH", ";", "}", "}", "}", "return", "NORTH", ";", "}" ]
Package private method which returns either BorderLayout.NORTH, BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending on the location of the toolbar in its parent. The toolbar might be in PAGE_START, PAGE_END, CENTER, or some other position, but will be resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar actually IS, with CENTER being NORTH. <p/>This code is used to determine where the border line should be drawn by the custom toolbar states, and also used by SeaGlassIcon to determine whether the handle icon needs to be shifted to look correct.</p> <p>Toollbars are unfortunately odd in the way these things are handled, and so this code exists to unify the logic related to toolbars so it can be shared among the static files such as SeaGlassIcon and generated files such as the ToolBar state classes.</p> @param toolbar a toolbar in the Swing hierarchy. @return the {@code BorderLayout} orientation of the toolbar, or {@code BorderLayout.NORTH} if none can be determined.
[ "Package", "private", "method", "which", "returns", "either", "BorderLayout", ".", "NORTH", "BorderLayout", ".", "SOUTH", "BorderLayout", ".", "EAST", "or", "BorderLayout", ".", "WEST", "depending", "on", "the", "location", "of", "the", "toolbar", "in", "its", "parent", ".", "The", "toolbar", "might", "be", "in", "PAGE_START", "PAGE_END", "CENTER", "or", "some", "other", "position", "but", "will", "be", "resolved", "to", "either", "NORTH", "SOUTH", "EAST", "or", "WEST", "based", "on", "where", "the", "toolbar", "actually", "IS", "with", "CENTER", "being", "NORTH", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2585-L2611
727
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.register
public void register(Region region, String prefix) { // validate the method arguments if (region == null || prefix == null) { throw new IllegalArgumentException("Neither Region nor Prefix may be null"); } // Add a LazyStyle for this region/prefix to styleMap. List<LazyStyle> styles = styleMap.get(region); if (styles == null) { styles = new LinkedList<LazyStyle>(); styles.add(new LazyStyle(prefix)); styleMap.put(region, styles); } else { // iterate over all the current styles and see if this prefix has // already been registered. If not, then register it. for (LazyStyle s : styles) { if (prefix.equals(s.prefix)) { return; } } styles.add(new LazyStyle(prefix)); } // add this region to the map of registered regions registeredRegions.put(region.getName(), region); }
java
public void register(Region region, String prefix) { // validate the method arguments if (region == null || prefix == null) { throw new IllegalArgumentException("Neither Region nor Prefix may be null"); } // Add a LazyStyle for this region/prefix to styleMap. List<LazyStyle> styles = styleMap.get(region); if (styles == null) { styles = new LinkedList<LazyStyle>(); styles.add(new LazyStyle(prefix)); styleMap.put(region, styles); } else { // iterate over all the current styles and see if this prefix has // already been registered. If not, then register it. for (LazyStyle s : styles) { if (prefix.equals(s.prefix)) { return; } } styles.add(new LazyStyle(prefix)); } // add this region to the map of registered regions registeredRegions.put(region.getName(), region); }
[ "public", "void", "register", "(", "Region", "region", ",", "String", "prefix", ")", "{", "// validate the method arguments", "if", "(", "region", "==", "null", "||", "prefix", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Neither Region nor Prefix may be null\"", ")", ";", "}", "// Add a LazyStyle for this region/prefix to styleMap.", "List", "<", "LazyStyle", ">", "styles", "=", "styleMap", ".", "get", "(", "region", ")", ";", "if", "(", "styles", "==", "null", ")", "{", "styles", "=", "new", "LinkedList", "<", "LazyStyle", ">", "(", ")", ";", "styles", ".", "add", "(", "new", "LazyStyle", "(", "prefix", ")", ")", ";", "styleMap", ".", "put", "(", "region", ",", "styles", ")", ";", "}", "else", "{", "// iterate over all the current styles and see if this prefix has", "// already been registered. If not, then register it.", "for", "(", "LazyStyle", "s", ":", "styles", ")", "{", "if", "(", "prefix", ".", "equals", "(", "s", ".", "prefix", ")", ")", "{", "return", ";", "}", "}", "styles", ".", "add", "(", "new", "LazyStyle", "(", "prefix", ")", ")", ";", "}", "// add this region to the map of registered regions", "registeredRegions", ".", "put", "(", "region", ".", "getName", "(", ")", ",", "region", ")", ";", "}" ]
Registers the given region and prefix. The prefix, if it contains quoted sections, refers to certain named components. If there are not quoted sections, then the prefix refers to a generic component type. <p>If the given region/prefix combo has already been registered, then it will not be registered twice. The second registration attempt will fail silently.</p> @param region The Synth Region that is being registered. Such as Button, or ScrollBarThumb. @param prefix The UIDefault prefix. For example, could be ComboBox, or if a named components, "MyComboBox", or even something like ToolBar:"MyComboBox":"ComboBox.arrowButton"
[ "Registers", "the", "given", "region", "and", "prefix", ".", "The", "prefix", "if", "it", "contains", "quoted", "sections", "refers", "to", "certain", "named", "components", ".", "If", "there", "are", "not", "quoted", "sections", "then", "the", "prefix", "refers", "to", "a", "generic", "component", "type", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2628-L2657
728
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.getSeaGlassStyle
SynthStyle getSeaGlassStyle(JComponent c, Region r) { // validate method arguments if (c == null || r == null) { throw new IllegalArgumentException("Neither comp nor r may be null"); } // if there are no lazy styles registered for the region r, then return // the default style List<LazyStyle> styles = styleMap.get(r); if (styles == null || styles.size() == 0) { return getDefaultStyle(); } // Look for the best SynthStyle for this component/region pair. LazyStyle foundStyle = null; for (LazyStyle s : styles) { if (s.matches(c)) { /* * Replace the foundStyle if foundStyle is null, or if the new * style "s" is more specific (ie, its path was longer), or if * the foundStyle was "simple" and the new style was not (ie: * the foundStyle was for something like Button and the new * style was for something like "MyButton", hence, being more * specific). In all cases, favor the most specific style found. */ if (foundStyle == null || (foundStyle.parts.length < s.parts.length) || (foundStyle.parts.length == s.parts.length && foundStyle.simple && !s.simple)) { foundStyle = s; } } } // return the style, if found, or the default style if not found return foundStyle == null ? getDefaultStyle() : foundStyle.getStyle(c); }
java
SynthStyle getSeaGlassStyle(JComponent c, Region r) { // validate method arguments if (c == null || r == null) { throw new IllegalArgumentException("Neither comp nor r may be null"); } // if there are no lazy styles registered for the region r, then return // the default style List<LazyStyle> styles = styleMap.get(r); if (styles == null || styles.size() == 0) { return getDefaultStyle(); } // Look for the best SynthStyle for this component/region pair. LazyStyle foundStyle = null; for (LazyStyle s : styles) { if (s.matches(c)) { /* * Replace the foundStyle if foundStyle is null, or if the new * style "s" is more specific (ie, its path was longer), or if * the foundStyle was "simple" and the new style was not (ie: * the foundStyle was for something like Button and the new * style was for something like "MyButton", hence, being more * specific). In all cases, favor the most specific style found. */ if (foundStyle == null || (foundStyle.parts.length < s.parts.length) || (foundStyle.parts.length == s.parts.length && foundStyle.simple && !s.simple)) { foundStyle = s; } } } // return the style, if found, or the default style if not found return foundStyle == null ? getDefaultStyle() : foundStyle.getStyle(c); }
[ "SynthStyle", "getSeaGlassStyle", "(", "JComponent", "c", ",", "Region", "r", ")", "{", "// validate method arguments", "if", "(", "c", "==", "null", "||", "r", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Neither comp nor r may be null\"", ")", ";", "}", "// if there are no lazy styles registered for the region r, then return", "// the default style", "List", "<", "LazyStyle", ">", "styles", "=", "styleMap", ".", "get", "(", "r", ")", ";", "if", "(", "styles", "==", "null", "||", "styles", ".", "size", "(", ")", "==", "0", ")", "{", "return", "getDefaultStyle", "(", ")", ";", "}", "// Look for the best SynthStyle for this component/region pair.", "LazyStyle", "foundStyle", "=", "null", ";", "for", "(", "LazyStyle", "s", ":", "styles", ")", "{", "if", "(", "s", ".", "matches", "(", "c", ")", ")", "{", "/*\n * Replace the foundStyle if foundStyle is null, or if the new\n * style \"s\" is more specific (ie, its path was longer), or if\n * the foundStyle was \"simple\" and the new style was not (ie:\n * the foundStyle was for something like Button and the new\n * style was for something like \"MyButton\", hence, being more\n * specific). In all cases, favor the most specific style found.\n */", "if", "(", "foundStyle", "==", "null", "||", "(", "foundStyle", ".", "parts", ".", "length", "<", "s", ".", "parts", ".", "length", ")", "||", "(", "foundStyle", ".", "parts", ".", "length", "==", "s", ".", "parts", ".", "length", "&&", "foundStyle", ".", "simple", "&&", "!", "s", ".", "simple", ")", ")", "{", "foundStyle", "=", "s", ";", "}", "}", "}", "// return the style, if found, or the default style if not found", "return", "foundStyle", "==", "null", "?", "getDefaultStyle", "(", ")", ":", "foundStyle", ".", "getStyle", "(", "c", ")", ";", "}" ]
Locate the style associated with the given region and component. This is called from SeaGlassLookAndFeel in the SynthStyleFactory implementation. <p>Lookup occurs as follows:<br/> Check the map of styles <code>styleMap</code>. If the map contains no styles at all, then simply return the defaultStyle. If the map contains styles, then iterate over all of the styles for the Region <code>r</code> looking for the best match, based on prefix. If a match was made, then return that SynthStyle. Otherwise, return the defaultStyle.</p> @param c The component associated with this region. For example, if the Region is Region.Button then the component will be a JButton. If the Region is a subregion, such as ScrollBarThumb, then the associated component will be the component that subregion belongs to, such as JScrollBar. The JComponent may be named. It may not be null. @param r The region we are looking for a style for. May not be null. @return the style associated with the given region and component.
[ "Locate", "the", "style", "associated", "with", "the", "given", "region", "and", "component", ".", "This", "is", "called", "from", "SeaGlassLookAndFeel", "in", "the", "SynthStyleFactory", "implementation", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2680-L2718
729
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.getComponentState
public static int getComponentState(Component c) { if (c.isEnabled()) { if (c.isFocusOwner()) { return SeaglassUI.ENABLED | SeaglassUI.FOCUSED; } return SeaglassUI.ENABLED; } return SeaglassUI.DISABLED; }
java
public static int getComponentState(Component c) { if (c.isEnabled()) { if (c.isFocusOwner()) { return SeaglassUI.ENABLED | SeaglassUI.FOCUSED; } return SeaglassUI.ENABLED; } return SeaglassUI.DISABLED; }
[ "public", "static", "int", "getComponentState", "(", "Component", "c", ")", "{", "if", "(", "c", ".", "isEnabled", "(", ")", ")", "{", "if", "(", "c", ".", "isFocusOwner", "(", ")", ")", "{", "return", "SeaglassUI", ".", "ENABLED", "|", "SeaglassUI", ".", "FOCUSED", ";", "}", "return", "SeaglassUI", ".", "ENABLED", ";", "}", "return", "SeaglassUI", ".", "DISABLED", ";", "}" ]
Returns the component state for the specified component. This should only be used for Components that don't have any special state beyond that of ENABLED, DISABLED or FOCUSED. For example, buttons shouldn't call into this method. @param c the component. @return the simple state of the component.
[ "Returns", "the", "component", "state", "for", "the", "specified", "component", ".", "This", "should", "only", "be", "used", "for", "Components", "that", "don", "t", "have", "any", "special", "state", "beyond", "that", "of", "ENABLED", "DISABLED", "or", "FOCUSED", ".", "For", "example", "buttons", "shouldn", "t", "call", "into", "this", "method", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2758-L2769
730
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.updateSubregion
public static void updateSubregion(SynthContext state, Graphics g, Rectangle bounds) { paintRegion(state, g, bounds); }
java
public static void updateSubregion(SynthContext state, Graphics g, Rectangle bounds) { paintRegion(state, g, bounds); }
[ "public", "static", "void", "updateSubregion", "(", "SynthContext", "state", ",", "Graphics", "g", ",", "Rectangle", "bounds", ")", "{", "paintRegion", "(", "state", ",", "g", ",", "bounds", ")", ";", "}" ]
A convenience method that handles painting of the background for subregions. All SynthUI's that have subregions should invoke this method, than paint the foreground. @param state the SynthContext describing the component, region, and state. @param g the Graphics context used to paint the subregion. @param bounds the bounds to paint in.
[ "A", "convenience", "method", "that", "handles", "painting", "of", "the", "background", "for", "subregions", ".", "All", "SynthUI", "s", "that", "have", "subregions", "should", "invoke", "this", "method", "than", "paint", "the", "foreground", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2792-L2794
731
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.paintRegion
private static void paintRegion(SynthContext state, Graphics g, Rectangle bounds) { JComponent c = state.getComponent(); SynthStyle style = state.getStyle(); int x; int y; int width; int height; if (bounds == null) { x = 0; y = 0; width = c.getWidth(); height = c.getHeight(); } else { x = bounds.x; y = bounds.y; width = bounds.width; height = bounds.height; } // Fill in the background, if necessary. boolean subregion = state.getRegion().isSubregion(); if ((subregion && style.isOpaque(state)) || (!subregion && c.isOpaque())) { g.setColor(style.getColor(state, ColorType.BACKGROUND)); g.fillRect(x, y, width, height); } }
java
private static void paintRegion(SynthContext state, Graphics g, Rectangle bounds) { JComponent c = state.getComponent(); SynthStyle style = state.getStyle(); int x; int y; int width; int height; if (bounds == null) { x = 0; y = 0; width = c.getWidth(); height = c.getHeight(); } else { x = bounds.x; y = bounds.y; width = bounds.width; height = bounds.height; } // Fill in the background, if necessary. boolean subregion = state.getRegion().isSubregion(); if ((subregion && style.isOpaque(state)) || (!subregion && c.isOpaque())) { g.setColor(style.getColor(state, ColorType.BACKGROUND)); g.fillRect(x, y, width, height); } }
[ "private", "static", "void", "paintRegion", "(", "SynthContext", "state", ",", "Graphics", "g", ",", "Rectangle", "bounds", ")", "{", "JComponent", "c", "=", "state", ".", "getComponent", "(", ")", ";", "SynthStyle", "style", "=", "state", ".", "getStyle", "(", ")", ";", "int", "x", ";", "int", "y", ";", "int", "width", ";", "int", "height", ";", "if", "(", "bounds", "==", "null", ")", "{", "x", "=", "0", ";", "y", "=", "0", ";", "width", "=", "c", ".", "getWidth", "(", ")", ";", "height", "=", "c", ".", "getHeight", "(", ")", ";", "}", "else", "{", "x", "=", "bounds", ".", "x", ";", "y", "=", "bounds", ".", "y", ";", "width", "=", "bounds", ".", "width", ";", "height", "=", "bounds", ".", "height", ";", "}", "// Fill in the background, if necessary.", "boolean", "subregion", "=", "state", ".", "getRegion", "(", ")", ".", "isSubregion", "(", ")", ";", "if", "(", "(", "subregion", "&&", "style", ".", "isOpaque", "(", "state", ")", ")", "||", "(", "!", "subregion", "&&", "c", ".", "isOpaque", "(", ")", ")", ")", "{", "g", ".", "setColor", "(", "style", ".", "getColor", "(", "state", ",", "ColorType", ".", "BACKGROUND", ")", ")", ";", "g", ".", "fillRect", "(", "x", ",", "y", ",", "width", ",", "height", ")", ";", "}", "}" ]
Paint a region. @param state the SynthContext describing the current component, region, and state. @param g the Graphics context used to paint the subregion. @param bounds the bounds to paint in.
[ "Paint", "a", "region", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2804-L2831
732
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.getDerivedColor
public DerivedColor getDerivedColor(String parentUin, float hOffset, float sOffset, float bOffset, int aOffset, boolean uiResource){ return getDerivedColor(null, parentUin, hOffset, sOffset, bOffset, aOffset, uiResource); }
java
public DerivedColor getDerivedColor(String parentUin, float hOffset, float sOffset, float bOffset, int aOffset, boolean uiResource){ return getDerivedColor(null, parentUin, hOffset, sOffset, bOffset, aOffset, uiResource); }
[ "public", "DerivedColor", "getDerivedColor", "(", "String", "parentUin", ",", "float", "hOffset", ",", "float", "sOffset", ",", "float", "bOffset", ",", "int", "aOffset", ",", "boolean", "uiResource", ")", "{", "return", "getDerivedColor", "(", "null", ",", "parentUin", ",", "hOffset", ",", "sOffset", ",", "bOffset", ",", "aOffset", ",", "uiResource", ")", ";", "}" ]
Get a derived color, derived colors are shared instances and will be updated when its parent UIDefault color changes. @param uiDefaultParentName The parent UIDefault key @param hOffset The hue offset @param sOffset The saturation offset @param bOffset The brightness offset @param aOffset The alpha offset @param uiResource True if the derived color should be a UIResource, false if it should not be a UIResource @return The stored derived color
[ "Get", "a", "derived", "color", "derived", "colors", "are", "shared", "instances", "and", "will", "be", "updated", "when", "its", "parent", "UIDefault", "color", "changes", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L3416-L3422
733
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.getDerivedColor
protected final Color getDerivedColor(Color color1, Color color2, float midPoint, boolean uiResource) { int argb = deriveARGB(color1, color2, midPoint); if (uiResource) { return new ColorUIResource(argb); } else { return new Color(argb); } }
java
protected final Color getDerivedColor(Color color1, Color color2, float midPoint, boolean uiResource) { int argb = deriveARGB(color1, color2, midPoint); if (uiResource) { return new ColorUIResource(argb); } else { return new Color(argb); } }
[ "protected", "final", "Color", "getDerivedColor", "(", "Color", "color1", ",", "Color", "color2", ",", "float", "midPoint", ",", "boolean", "uiResource", ")", "{", "int", "argb", "=", "deriveARGB", "(", "color1", ",", "color2", ",", "midPoint", ")", ";", "if", "(", "uiResource", ")", "{", "return", "new", "ColorUIResource", "(", "argb", ")", ";", "}", "else", "{", "return", "new", "Color", "(", "argb", ")", ";", "}", "}" ]
Decodes and returns a color, which is derived from an offset between two other colors. @param color1 The first color @param color2 The second color @param midPoint The offset between color 1 and color 2, a value of 0.0 is color 1 and 1.0 is color 2; @param uiResource True if the derived color should be a UIResource @return The derived color
[ "Decodes", "and", "returns", "a", "color", "which", "is", "derived", "from", "an", "offset", "between", "two", "other", "colors", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L3450-L3458
734
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassSliderUI.java
SeaGlassSliderUI.getPadForLabel
private int getPadForLabel(int i) { Dictionary dictionary = slider.getLabelTable(); int pad = 0; Object o = dictionary.get(i); if (o != null) { Component c = (Component) o; int centerX = xPositionForValue(i); int cHalfWidth = c.getPreferredSize().width / 2; if (centerX - cHalfWidth < insetCache.left) { pad = Math.max(pad, insetCache.left - (centerX - cHalfWidth)); } if (centerX + cHalfWidth > slider.getWidth() - insetCache.right) { pad = Math.max(pad, (centerX + cHalfWidth) - (slider.getWidth() - insetCache.right)); } } return pad; }
java
private int getPadForLabel(int i) { Dictionary dictionary = slider.getLabelTable(); int pad = 0; Object o = dictionary.get(i); if (o != null) { Component c = (Component) o; int centerX = xPositionForValue(i); int cHalfWidth = c.getPreferredSize().width / 2; if (centerX - cHalfWidth < insetCache.left) { pad = Math.max(pad, insetCache.left - (centerX - cHalfWidth)); } if (centerX + cHalfWidth > slider.getWidth() - insetCache.right) { pad = Math.max(pad, (centerX + cHalfWidth) - (slider.getWidth() - insetCache.right)); } } return pad; }
[ "private", "int", "getPadForLabel", "(", "int", "i", ")", "{", "Dictionary", "dictionary", "=", "slider", ".", "getLabelTable", "(", ")", ";", "int", "pad", "=", "0", ";", "Object", "o", "=", "dictionary", ".", "get", "(", "i", ")", ";", "if", "(", "o", "!=", "null", ")", "{", "Component", "c", "=", "(", "Component", ")", "o", ";", "int", "centerX", "=", "xPositionForValue", "(", "i", ")", ";", "int", "cHalfWidth", "=", "c", ".", "getPreferredSize", "(", ")", ".", "width", "/", "2", ";", "if", "(", "centerX", "-", "cHalfWidth", "<", "insetCache", ".", "left", ")", "{", "pad", "=", "Math", ".", "max", "(", "pad", ",", "insetCache", ".", "left", "-", "(", "centerX", "-", "cHalfWidth", ")", ")", ";", "}", "if", "(", "centerX", "+", "cHalfWidth", ">", "slider", ".", "getWidth", "(", ")", "-", "insetCache", ".", "right", ")", "{", "pad", "=", "Math", ".", "max", "(", "pad", ",", "(", "centerX", "+", "cHalfWidth", ")", "-", "(", "slider", ".", "getWidth", "(", ")", "-", "insetCache", ".", "right", ")", ")", ";", "}", "}", "return", "pad", ";", "}" ]
Calculates the pad for the label at the specified index. @param index index of the label to calculate pad for. @return padding required to keep label visible.
[ "Calculates", "the", "pad", "for", "the", "label", "at", "the", "specified", "index", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassSliderUI.java#L464-L482
735
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassSliderUI.java
SeaGlassSliderUI.valueForYPosition
public int valueForYPosition(int yPos) { int value; int minValue = slider.getMinimum(); int maxValue = slider.getMaximum(); int trackTop = trackRect.y + thumbRect.height / 2 + trackBorder; int trackBottom = trackRect.y + trackRect.height - thumbRect.height / 2 - trackBorder; int trackLength = trackBottom - trackTop; if (yPos <= trackTop) { value = drawInverted() ? minValue : maxValue; } else if (yPos >= trackBottom) { value = drawInverted() ? maxValue : minValue; } else { int distanceFromTrackTop = yPos - trackTop; double valueRange = (double) maxValue - (double) minValue; double valuePerPixel = valueRange / (double) trackLength; int valueFromTrackTop = (int) Math.round(distanceFromTrackTop * valuePerPixel); value = drawInverted() ? minValue + valueFromTrackTop : maxValue - valueFromTrackTop; } return value; }
java
public int valueForYPosition(int yPos) { int value; int minValue = slider.getMinimum(); int maxValue = slider.getMaximum(); int trackTop = trackRect.y + thumbRect.height / 2 + trackBorder; int trackBottom = trackRect.y + trackRect.height - thumbRect.height / 2 - trackBorder; int trackLength = trackBottom - trackTop; if (yPos <= trackTop) { value = drawInverted() ? minValue : maxValue; } else if (yPos >= trackBottom) { value = drawInverted() ? maxValue : minValue; } else { int distanceFromTrackTop = yPos - trackTop; double valueRange = (double) maxValue - (double) minValue; double valuePerPixel = valueRange / (double) trackLength; int valueFromTrackTop = (int) Math.round(distanceFromTrackTop * valuePerPixel); value = drawInverted() ? minValue + valueFromTrackTop : maxValue - valueFromTrackTop; } return value; }
[ "public", "int", "valueForYPosition", "(", "int", "yPos", ")", "{", "int", "value", ";", "int", "minValue", "=", "slider", ".", "getMinimum", "(", ")", ";", "int", "maxValue", "=", "slider", ".", "getMaximum", "(", ")", ";", "int", "trackTop", "=", "trackRect", ".", "y", "+", "thumbRect", ".", "height", "/", "2", "+", "trackBorder", ";", "int", "trackBottom", "=", "trackRect", ".", "y", "+", "trackRect", ".", "height", "-", "thumbRect", ".", "height", "/", "2", "-", "trackBorder", ";", "int", "trackLength", "=", "trackBottom", "-", "trackTop", ";", "if", "(", "yPos", "<=", "trackTop", ")", "{", "value", "=", "drawInverted", "(", ")", "?", "minValue", ":", "maxValue", ";", "}", "else", "if", "(", "yPos", ">=", "trackBottom", ")", "{", "value", "=", "drawInverted", "(", ")", "?", "maxValue", ":", "minValue", ";", "}", "else", "{", "int", "distanceFromTrackTop", "=", "yPos", "-", "trackTop", ";", "double", "valueRange", "=", "(", "double", ")", "maxValue", "-", "(", "double", ")", "minValue", ";", "double", "valuePerPixel", "=", "valueRange", "/", "(", "double", ")", "trackLength", ";", "int", "valueFromTrackTop", "=", "(", "int", ")", "Math", ".", "round", "(", "distanceFromTrackTop", "*", "valuePerPixel", ")", ";", "value", "=", "drawInverted", "(", ")", "?", "minValue", "+", "valueFromTrackTop", ":", "maxValue", "-", "valueFromTrackTop", ";", "}", "return", "value", ";", "}" ]
Returns a value give a y position. If yPos is past the track at the top or the bottom it will set the value to the min or max of the slider, depending if the slider is inverted or not.
[ "Returns", "a", "value", "give", "a", "y", "position", ".", "If", "yPos", "is", "past", "the", "track", "at", "the", "top", "or", "the", "bottom", "it", "will", "set", "the", "value", "to", "the", "min", "or", "max", "of", "the", "slider", "depending", "if", "the", "slider", "is", "inverted", "or", "not", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassSliderUI.java#L617-L637
736
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassSliderUI.java
SeaGlassSliderUI.valueForXPosition
public int valueForXPosition(int xPos) { int value; int minValue = slider.getMinimum(); int maxValue = slider.getMaximum(); int trackLeft = trackRect.x + thumbRect.width / 2 + trackBorder; int trackRight = trackRect.x + trackRect.width - thumbRect.width / 2 - trackBorder; int trackLength = trackRight - trackLeft; if (xPos <= trackLeft) { value = drawInverted() ? maxValue : minValue; } else if (xPos >= trackRight) { value = drawInverted() ? minValue : maxValue; } else { int distanceFromTrackLeft = xPos - trackLeft; double valueRange = (double) maxValue - (double) minValue; double valuePerPixel = valueRange / (double) trackLength; int valueFromTrackLeft = (int) Math.round(distanceFromTrackLeft * valuePerPixel); value = drawInverted() ? maxValue - valueFromTrackLeft : minValue + valueFromTrackLeft; } return value; }
java
public int valueForXPosition(int xPos) { int value; int minValue = slider.getMinimum(); int maxValue = slider.getMaximum(); int trackLeft = trackRect.x + thumbRect.width / 2 + trackBorder; int trackRight = trackRect.x + trackRect.width - thumbRect.width / 2 - trackBorder; int trackLength = trackRight - trackLeft; if (xPos <= trackLeft) { value = drawInverted() ? maxValue : minValue; } else if (xPos >= trackRight) { value = drawInverted() ? minValue : maxValue; } else { int distanceFromTrackLeft = xPos - trackLeft; double valueRange = (double) maxValue - (double) minValue; double valuePerPixel = valueRange / (double) trackLength; int valueFromTrackLeft = (int) Math.round(distanceFromTrackLeft * valuePerPixel); value = drawInverted() ? maxValue - valueFromTrackLeft : minValue + valueFromTrackLeft; } return value; }
[ "public", "int", "valueForXPosition", "(", "int", "xPos", ")", "{", "int", "value", ";", "int", "minValue", "=", "slider", ".", "getMinimum", "(", ")", ";", "int", "maxValue", "=", "slider", ".", "getMaximum", "(", ")", ";", "int", "trackLeft", "=", "trackRect", ".", "x", "+", "thumbRect", ".", "width", "/", "2", "+", "trackBorder", ";", "int", "trackRight", "=", "trackRect", ".", "x", "+", "trackRect", ".", "width", "-", "thumbRect", ".", "width", "/", "2", "-", "trackBorder", ";", "int", "trackLength", "=", "trackRight", "-", "trackLeft", ";", "if", "(", "xPos", "<=", "trackLeft", ")", "{", "value", "=", "drawInverted", "(", ")", "?", "maxValue", ":", "minValue", ";", "}", "else", "if", "(", "xPos", ">=", "trackRight", ")", "{", "value", "=", "drawInverted", "(", ")", "?", "minValue", ":", "maxValue", ";", "}", "else", "{", "int", "distanceFromTrackLeft", "=", "xPos", "-", "trackLeft", ";", "double", "valueRange", "=", "(", "double", ")", "maxValue", "-", "(", "double", ")", "minValue", ";", "double", "valuePerPixel", "=", "valueRange", "/", "(", "double", ")", "trackLength", ";", "int", "valueFromTrackLeft", "=", "(", "int", ")", "Math", ".", "round", "(", "distanceFromTrackLeft", "*", "valuePerPixel", ")", ";", "value", "=", "drawInverted", "(", ")", "?", "maxValue", "-", "valueFromTrackLeft", ":", "minValue", "+", "valueFromTrackLeft", ";", "}", "return", "value", ";", "}" ]
Returns a value give an x position. If xPos is past the track at the left or the right it will set the value to the min or max of the slider, depending if the slider is inverted or not.
[ "Returns", "a", "value", "give", "an", "x", "position", ".", "If", "xPos", "is", "past", "the", "track", "at", "the", "left", "or", "the", "right", "it", "will", "set", "the", "value", "to", "the", "min", "or", "max", "of", "the", "slider", "depending", "if", "the", "slider", "is", "inverted", "or", "not", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassSliderUI.java#L644-L664
737
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TextComponentPainter.java
TextComponentPainter.isPaintLineSeperators
private boolean isPaintLineSeperators(JComponent c) { boolean paintLines = c instanceof JTextArea; // Global settings String globalOverride = System.getProperty("SeaGlass.JTextArea.drawLineSeparator"); if (globalOverride != null && globalOverride.length() > 0) { paintLines = Boolean.valueOf(globalOverride); } // Settings per component Boolean overrideProperty = (Boolean) c.getClientProperty("SeaGlass.JTextArea.drawLineSeparator"); if (overrideProperty != null) { paintLines = overrideProperty; } return paintLines; }
java
private boolean isPaintLineSeperators(JComponent c) { boolean paintLines = c instanceof JTextArea; // Global settings String globalOverride = System.getProperty("SeaGlass.JTextArea.drawLineSeparator"); if (globalOverride != null && globalOverride.length() > 0) { paintLines = Boolean.valueOf(globalOverride); } // Settings per component Boolean overrideProperty = (Boolean) c.getClientProperty("SeaGlass.JTextArea.drawLineSeparator"); if (overrideProperty != null) { paintLines = overrideProperty; } return paintLines; }
[ "private", "boolean", "isPaintLineSeperators", "(", "JComponent", "c", ")", "{", "boolean", "paintLines", "=", "c", "instanceof", "JTextArea", ";", "// Global settings", "String", "globalOverride", "=", "System", ".", "getProperty", "(", "\"SeaGlass.JTextArea.drawLineSeparator\"", ")", ";", "if", "(", "globalOverride", "!=", "null", "&&", "globalOverride", ".", "length", "(", ")", ">", "0", ")", "{", "paintLines", "=", "Boolean", ".", "valueOf", "(", "globalOverride", ")", ";", "}", "// Settings per component", "Boolean", "overrideProperty", "=", "(", "Boolean", ")", "c", ".", "getClientProperty", "(", "\"SeaGlass.JTextArea.drawLineSeparator\"", ")", ";", "if", "(", "overrideProperty", "!=", "null", ")", "{", "paintLines", "=", "overrideProperty", ";", "}", "return", "paintLines", ";", "}" ]
Test if we should also paint the line seperators. @param c @return
[ "Test", "if", "we", "should", "also", "paint", "the", "line", "seperators", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TextComponentPainter.java#L163-L178
738
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TextComponentPainter.java
TextComponentPainter.paintBorder
private void paintBorder(Graphics2D g, JComponent c, int x, int y, int width, int height) { boolean useToolBarColors = isInToolBar(c); Shape s; if (focused) { s = shapeGenerator.createRoundRectangle(x - 2, y - 2, width + 3, height + 3, CornerSize.OUTER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.OUTER_FOCUS, useToolBarColors)); g.draw(s); s = shapeGenerator.createRoundRectangle(x - 1, y - 1, width + 1, height + 1, CornerSize.INNER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.INNER_FOCUS, useToolBarColors)); g.draw(s); } if (type != CommonControlState.DISABLED) { s = shapeGenerator.createRoundRectangle(x + 1, x + 1, width - 2, height - 2, CornerSize.BORDER); internalShadow.fill(g, s, false, true); } s = shapeGenerator.createRoundRectangle(x, y, width - 1, height - 1, CornerSize.BORDER); g.setPaint(getTextBorderPaint(type, !focused && useToolBarColors)); g.draw(s); }
java
private void paintBorder(Graphics2D g, JComponent c, int x, int y, int width, int height) { boolean useToolBarColors = isInToolBar(c); Shape s; if (focused) { s = shapeGenerator.createRoundRectangle(x - 2, y - 2, width + 3, height + 3, CornerSize.OUTER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.OUTER_FOCUS, useToolBarColors)); g.draw(s); s = shapeGenerator.createRoundRectangle(x - 1, y - 1, width + 1, height + 1, CornerSize.INNER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.INNER_FOCUS, useToolBarColors)); g.draw(s); } if (type != CommonControlState.DISABLED) { s = shapeGenerator.createRoundRectangle(x + 1, x + 1, width - 2, height - 2, CornerSize.BORDER); internalShadow.fill(g, s, false, true); } s = shapeGenerator.createRoundRectangle(x, y, width - 1, height - 1, CornerSize.BORDER); g.setPaint(getTextBorderPaint(type, !focused && useToolBarColors)); g.draw(s); }
[ "private", "void", "paintBorder", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "boolean", "useToolBarColors", "=", "isInToolBar", "(", "c", ")", ";", "Shape", "s", ";", "if", "(", "focused", ")", "{", "s", "=", "shapeGenerator", ".", "createRoundRectangle", "(", "x", "-", "2", ",", "y", "-", "2", ",", "width", "+", "3", ",", "height", "+", "3", ",", "CornerSize", ".", "OUTER_FOCUS", ")", ";", "g", ".", "setPaint", "(", "getFocusPaint", "(", "s", ",", "FocusType", ".", "OUTER_FOCUS", ",", "useToolBarColors", ")", ")", ";", "g", ".", "draw", "(", "s", ")", ";", "s", "=", "shapeGenerator", ".", "createRoundRectangle", "(", "x", "-", "1", ",", "y", "-", "1", ",", "width", "+", "1", ",", "height", "+", "1", ",", "CornerSize", ".", "INNER_FOCUS", ")", ";", "g", ".", "setPaint", "(", "getFocusPaint", "(", "s", ",", "FocusType", ".", "INNER_FOCUS", ",", "useToolBarColors", ")", ")", ";", "g", ".", "draw", "(", "s", ")", ";", "}", "if", "(", "type", "!=", "CommonControlState", ".", "DISABLED", ")", "{", "s", "=", "shapeGenerator", ".", "createRoundRectangle", "(", "x", "+", "1", ",", "x", "+", "1", ",", "width", "-", "2", ",", "height", "-", "2", ",", "CornerSize", ".", "BORDER", ")", ";", "internalShadow", ".", "fill", "(", "g", ",", "s", ",", "false", ",", "true", ")", ";", "}", "s", "=", "shapeGenerator", ".", "createRoundRectangle", "(", "x", ",", "y", ",", "width", "-", "1", ",", "height", "-", "1", ",", "CornerSize", ".", "BORDER", ")", ";", "g", ".", "setPaint", "(", "getTextBorderPaint", "(", "type", ",", "!", "focused", "&&", "useToolBarColors", ")", ")", ";", "g", ".", "draw", "(", "s", ")", ";", "}" ]
Paint the border. @param g DOCUMENT ME! @param c DOCUMENT ME! @param x DOCUMENT ME! @param y DOCUMENT ME! @param width DOCUMENT ME! @param height DOCUMENT ME!
[ "Paint", "the", "border", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TextComponentPainter.java#L232-L253
739
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/button/SegmentedButtonPainter.java
SegmentedButtonPainter.getButtonHeight
private int getButtonHeight(JComponent c, int height) { String scaleKey = SeaGlassStyle.getSizeVariant(c); int newHeight = 27; // If the key is natural, allow the button to scale. if (SeaGlassStyle.NATURAL_KEY.equals(scaleKey)) { return height; } else if (SeaGlassStyle.LARGE_KEY.equals(scaleKey)) { newHeight *= SeaGlassStyle.LARGE_SCALE; // 31 } else if (SeaGlassStyle.SMALL_KEY.equals(scaleKey)) { newHeight *= SeaGlassStyle.SMALL_SCALE; // 23 } else if (SeaGlassStyle.MINI_KEY.equals(scaleKey)) { newHeight *= SeaGlassStyle.MINI_SCALE; // 19 } else { if (height < 22) { newHeight *= SeaGlassStyle.MINI_SCALE; } else if (height < 26) { newHeight *= SeaGlassStyle.SMALL_SCALE; } else if (height >= 30) { newHeight *= SeaGlassStyle.LARGE_SCALE; } } return newHeight; }
java
private int getButtonHeight(JComponent c, int height) { String scaleKey = SeaGlassStyle.getSizeVariant(c); int newHeight = 27; // If the key is natural, allow the button to scale. if (SeaGlassStyle.NATURAL_KEY.equals(scaleKey)) { return height; } else if (SeaGlassStyle.LARGE_KEY.equals(scaleKey)) { newHeight *= SeaGlassStyle.LARGE_SCALE; // 31 } else if (SeaGlassStyle.SMALL_KEY.equals(scaleKey)) { newHeight *= SeaGlassStyle.SMALL_SCALE; // 23 } else if (SeaGlassStyle.MINI_KEY.equals(scaleKey)) { newHeight *= SeaGlassStyle.MINI_SCALE; // 19 } else { if (height < 22) { newHeight *= SeaGlassStyle.MINI_SCALE; } else if (height < 26) { newHeight *= SeaGlassStyle.SMALL_SCALE; } else if (height >= 30) { newHeight *= SeaGlassStyle.LARGE_SCALE; } } return newHeight; }
[ "private", "int", "getButtonHeight", "(", "JComponent", "c", ",", "int", "height", ")", "{", "String", "scaleKey", "=", "SeaGlassStyle", ".", "getSizeVariant", "(", "c", ")", ";", "int", "newHeight", "=", "27", ";", "// If the key is natural, allow the button to scale.", "if", "(", "SeaGlassStyle", ".", "NATURAL_KEY", ".", "equals", "(", "scaleKey", ")", ")", "{", "return", "height", ";", "}", "else", "if", "(", "SeaGlassStyle", ".", "LARGE_KEY", ".", "equals", "(", "scaleKey", ")", ")", "{", "newHeight", "*=", "SeaGlassStyle", ".", "LARGE_SCALE", ";", "// 31", "}", "else", "if", "(", "SeaGlassStyle", ".", "SMALL_KEY", ".", "equals", "(", "scaleKey", ")", ")", "{", "newHeight", "*=", "SeaGlassStyle", ".", "SMALL_SCALE", ";", "// 23", "}", "else", "if", "(", "SeaGlassStyle", ".", "MINI_KEY", ".", "equals", "(", "scaleKey", ")", ")", "{", "newHeight", "*=", "SeaGlassStyle", ".", "MINI_SCALE", ";", "// 19", "}", "else", "{", "if", "(", "height", "<", "22", ")", "{", "newHeight", "*=", "SeaGlassStyle", ".", "MINI_SCALE", ";", "}", "else", "if", "(", "height", "<", "26", ")", "{", "newHeight", "*=", "SeaGlassStyle", ".", "SMALL_SCALE", ";", "}", "else", "if", "(", "height", ">=", "30", ")", "{", "newHeight", "*=", "SeaGlassStyle", ".", "LARGE_SCALE", ";", "}", "}", "return", "newHeight", ";", "}" ]
Compute the new button height for drawing, forcing the button into a standard height. @param c the button. @param height the height requested. @return the new height.
[ "Compute", "the", "new", "button", "height", "for", "drawing", "forcing", "the", "button", "into", "a", "standard", "height", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/button/SegmentedButtonPainter.java#L122-L146
740
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/button/SegmentedButtonPainter.java
SegmentedButtonPainter.createOuterFocus
protected Shape createOuterFocus(final SegmentType segmentType, final int x, final int y, final int w, final int h) { switch (segmentType) { case FIRST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.SQUARE, CornerStyle.SQUARE); case MIDDLE: return shapeGenerator.createRectangle(x - 2, y - 2, w + 3, h + 3); case LAST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.ROUNDED, CornerStyle.ROUNDED); default: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS); } }
java
protected Shape createOuterFocus(final SegmentType segmentType, final int x, final int y, final int w, final int h) { switch (segmentType) { case FIRST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.SQUARE, CornerStyle.SQUARE); case MIDDLE: return shapeGenerator.createRectangle(x - 2, y - 2, w + 3, h + 3); case LAST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.ROUNDED, CornerStyle.ROUNDED); default: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS); } }
[ "protected", "Shape", "createOuterFocus", "(", "final", "SegmentType", "segmentType", ",", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "w", ",", "final", "int", "h", ")", "{", "switch", "(", "segmentType", ")", "{", "case", "FIRST", ":", "return", "shapeGenerator", ".", "createRoundRectangle", "(", "x", "-", "2", ",", "y", "-", "2", ",", "w", "+", "3", ",", "h", "+", "3", ",", "CornerSize", ".", "OUTER_FOCUS", ",", "CornerStyle", ".", "ROUNDED", ",", "CornerStyle", ".", "ROUNDED", ",", "CornerStyle", ".", "SQUARE", ",", "CornerStyle", ".", "SQUARE", ")", ";", "case", "MIDDLE", ":", "return", "shapeGenerator", ".", "createRectangle", "(", "x", "-", "2", ",", "y", "-", "2", ",", "w", "+", "3", ",", "h", "+", "3", ")", ";", "case", "LAST", ":", "return", "shapeGenerator", ".", "createRoundRectangle", "(", "x", "-", "2", ",", "y", "-", "2", ",", "w", "+", "3", ",", "h", "+", "3", ",", "CornerSize", ".", "OUTER_FOCUS", ",", "CornerStyle", ".", "SQUARE", ",", "CornerStyle", ".", "SQUARE", ",", "CornerStyle", ".", "ROUNDED", ",", "CornerStyle", ".", "ROUNDED", ")", ";", "default", ":", "return", "shapeGenerator", ".", "createRoundRectangle", "(", "x", "-", "2", ",", "y", "-", "2", ",", "w", "+", "3", ",", "h", "+", "3", ",", "CornerSize", ".", "OUTER_FOCUS", ")", ";", "}", "}" ]
Create the shape for the outer focus ring. Designed to be drawn rather than filled. @param segmentType the segment type. @param x the x offset. @param y the y offset. @param w the width. @param h the height. @return the shape of the outer focus ring. Designed to be drawn rather than filled.
[ "Create", "the", "shape", "for", "the", "outer", "focus", "ring", ".", "Designed", "to", "be", "drawn", "rather", "than", "filled", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/button/SegmentedButtonPainter.java#L227-L244
741
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/PlatformUtils.java
PlatformUtils.isMac
public static boolean isMac() { if (System.getProperty(SEA_GLASS_OVERRIDE_OS_NAME) != null) { return System.getProperty(SEA_GLASS_OVERRIDE_OS_NAME).startsWith("Mac OS"); } return System.getProperty("os.name").startsWith("Mac OS"); }
java
public static boolean isMac() { if (System.getProperty(SEA_GLASS_OVERRIDE_OS_NAME) != null) { return System.getProperty(SEA_GLASS_OVERRIDE_OS_NAME).startsWith("Mac OS"); } return System.getProperty("os.name").startsWith("Mac OS"); }
[ "public", "static", "boolean", "isMac", "(", ")", "{", "if", "(", "System", ".", "getProperty", "(", "SEA_GLASS_OVERRIDE_OS_NAME", ")", "!=", "null", ")", "{", "return", "System", ".", "getProperty", "(", "SEA_GLASS_OVERRIDE_OS_NAME", ")", ".", "startsWith", "(", "\"Mac OS\"", ")", ";", "}", "return", "System", ".", "getProperty", "(", "\"os.name\"", ")", ".", "startsWith", "(", "\"Mac OS\"", ")", ";", "}" ]
True if this JVM is running on a Mac. @return true if this JVM is running on a Mac.
[ "True", "if", "this", "JVM", "is", "running", "on", "a", "Mac", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/PlatformUtils.java#L73-L79
742
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassComboBoxUI.java
SeaGlassComboBoxUI.paintCurrentValue
@Override public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) { ListCellRenderer renderer = comboBox.getRenderer(); Component c; c = renderer.getListCellRendererComponent(listBox, comboBox.getSelectedItem(), -1, false, false); // Fix for 4238829: should lay out the JPanel. boolean shouldValidate = false; if (c instanceof JPanel) { shouldValidate = true; } if (c instanceof UIResource) { c.setName("ComboBox.renderer"); } boolean force = forceOpaque && c instanceof JComponent; if (force) { ((JComponent) c).setOpaque(false); } int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height; if (padding != null) { x = bounds.x + padding.left; y = bounds.y + padding.top; w = bounds.width - (padding.left + padding.right); h = bounds.height - (padding.top + padding.bottom); } currentValuePane.paintComponent(g, c, comboBox, x, y, w, h, shouldValidate); if (force) { ((JComponent) c).setOpaque(true); } }
java
@Override public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) { ListCellRenderer renderer = comboBox.getRenderer(); Component c; c = renderer.getListCellRendererComponent(listBox, comboBox.getSelectedItem(), -1, false, false); // Fix for 4238829: should lay out the JPanel. boolean shouldValidate = false; if (c instanceof JPanel) { shouldValidate = true; } if (c instanceof UIResource) { c.setName("ComboBox.renderer"); } boolean force = forceOpaque && c instanceof JComponent; if (force) { ((JComponent) c).setOpaque(false); } int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height; if (padding != null) { x = bounds.x + padding.left; y = bounds.y + padding.top; w = bounds.width - (padding.left + padding.right); h = bounds.height - (padding.top + padding.bottom); } currentValuePane.paintComponent(g, c, comboBox, x, y, w, h, shouldValidate); if (force) { ((JComponent) c).setOpaque(true); } }
[ "@", "Override", "public", "void", "paintCurrentValue", "(", "Graphics", "g", ",", "Rectangle", "bounds", ",", "boolean", "hasFocus", ")", "{", "ListCellRenderer", "renderer", "=", "comboBox", ".", "getRenderer", "(", ")", ";", "Component", "c", ";", "c", "=", "renderer", ".", "getListCellRendererComponent", "(", "listBox", ",", "comboBox", ".", "getSelectedItem", "(", ")", ",", "-", "1", ",", "false", ",", "false", ")", ";", "// Fix for 4238829: should lay out the JPanel.", "boolean", "shouldValidate", "=", "false", ";", "if", "(", "c", "instanceof", "JPanel", ")", "{", "shouldValidate", "=", "true", ";", "}", "if", "(", "c", "instanceof", "UIResource", ")", "{", "c", ".", "setName", "(", "\"ComboBox.renderer\"", ")", ";", "}", "boolean", "force", "=", "forceOpaque", "&&", "c", "instanceof", "JComponent", ";", "if", "(", "force", ")", "{", "(", "(", "JComponent", ")", "c", ")", ".", "setOpaque", "(", "false", ")", ";", "}", "int", "x", "=", "bounds", ".", "x", ",", "y", "=", "bounds", ".", "y", ",", "w", "=", "bounds", ".", "width", ",", "h", "=", "bounds", ".", "height", ";", "if", "(", "padding", "!=", "null", ")", "{", "x", "=", "bounds", ".", "x", "+", "padding", ".", "left", ";", "y", "=", "bounds", ".", "y", "+", "padding", ".", "top", ";", "w", "=", "bounds", ".", "width", "-", "(", "padding", ".", "left", "+", "padding", ".", "right", ")", ";", "h", "=", "bounds", ".", "height", "-", "(", "padding", ".", "top", "+", "padding", ".", "bottom", ")", ";", "}", "currentValuePane", ".", "paintComponent", "(", "g", ",", "c", ",", "comboBox", ",", "x", ",", "y", ",", "w", ",", "h", ",", "shouldValidate", ")", ";", "if", "(", "force", ")", "{", "(", "(", "JComponent", ")", "c", ")", ".", "setOpaque", "(", "true", ")", ";", "}", "}" ]
Paints the currently selected item.
[ "Paints", "the", "currently", "selected", "item", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassComboBoxUI.java#L349-L385
743
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassComboBoxUI.java
SeaGlassComboBoxUI.getDefaultSize
@Override protected Dimension getDefaultSize() { SynthComboBoxRenderer r = new SynthComboBoxRenderer(); Dimension d = getSizeForComponent(r.getListCellRendererComponent(listBox, " ", -1, false, false)); return new Dimension(d.width, d.height); }
java
@Override protected Dimension getDefaultSize() { SynthComboBoxRenderer r = new SynthComboBoxRenderer(); Dimension d = getSizeForComponent(r.getListCellRendererComponent(listBox, " ", -1, false, false)); return new Dimension(d.width, d.height); }
[ "@", "Override", "protected", "Dimension", "getDefaultSize", "(", ")", "{", "SynthComboBoxRenderer", "r", "=", "new", "SynthComboBoxRenderer", "(", ")", ";", "Dimension", "d", "=", "getSizeForComponent", "(", "r", ".", "getListCellRendererComponent", "(", "listBox", ",", "\" \"", ",", "-", "1", ",", "false", ",", "false", ")", ")", ";", "return", "new", "Dimension", "(", "d", ".", "width", ",", "d", ".", "height", ")", ";", "}" ]
Return the default size of an empty display area of the combo box using the current renderer and font. This method was overridden to use SynthComboBoxRenderer instead of DefaultListCellRenderer as the default renderer when calculating the size of the combo box. This is used in the case of the combo not having any data. @return the size of an empty display area @see #getDisplaySize
[ "Return", "the", "default", "size", "of", "an", "empty", "display", "area", "of", "the", "combo", "box", "using", "the", "current", "renderer", "and", "font", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassComboBoxUI.java#L408-L413
744
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java
SeaGlassInternalShadowEffect.fill
public void fill(Graphics2D g, Shape s, boolean isRounded, boolean paintRightShadow) { if (isRounded) { fillInternalShadowRounded(g, s); } else { fillInternalShadow(g, s, paintRightShadow); } }
java
public void fill(Graphics2D g, Shape s, boolean isRounded, boolean paintRightShadow) { if (isRounded) { fillInternalShadowRounded(g, s); } else { fillInternalShadow(g, s, paintRightShadow); } }
[ "public", "void", "fill", "(", "Graphics2D", "g", ",", "Shape", "s", ",", "boolean", "isRounded", ",", "boolean", "paintRightShadow", ")", "{", "if", "(", "isRounded", ")", "{", "fillInternalShadowRounded", "(", "g", ",", "s", ")", ";", "}", "else", "{", "fillInternalShadow", "(", "g", ",", "s", ",", "paintRightShadow", ")", ";", "}", "}" ]
Fill the shape with the internal shadow. @param g the Graphics context to paint with. @param s the shape to fill. This is only used for its bounds. @param isRounded {@code true} if the shape is rounded, {@code false} if it is rectangular. @param paintRightShadow {@code true} if the shape is rectangular and the rightmost shadow should be painted, {@code false} otherwise.
[ "Fill", "the", "shape", "with", "the", "internal", "shadow", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java#L64-L70
745
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java
SeaGlassInternalShadowEffect.fillInternalShadow
private void fillInternalShadow(Graphics2D g, Shape s, boolean paintRightShadow) { Rectangle bounds = s.getBounds(); int x = bounds.x; int y = bounds.y; int w = bounds.width; int h = bounds.height; s = shapeGenerator.createRectangle(x, y, w, 2); g.setPaint(getTopShadowGradient(s)); g.fill(s); s = shapeGenerator.createRectangle(x, y, 1, h); g.setPaint(getLeftShadowGradient(s)); g.fill(s); if (paintRightShadow) { s = shapeGenerator.createRectangle(x + w - 1, y, 1, h); g.setPaint(getRightShadowGradient(s)); g.fill(s); } }
java
private void fillInternalShadow(Graphics2D g, Shape s, boolean paintRightShadow) { Rectangle bounds = s.getBounds(); int x = bounds.x; int y = bounds.y; int w = bounds.width; int h = bounds.height; s = shapeGenerator.createRectangle(x, y, w, 2); g.setPaint(getTopShadowGradient(s)); g.fill(s); s = shapeGenerator.createRectangle(x, y, 1, h); g.setPaint(getLeftShadowGradient(s)); g.fill(s); if (paintRightShadow) { s = shapeGenerator.createRectangle(x + w - 1, y, 1, h); g.setPaint(getRightShadowGradient(s)); g.fill(s); } }
[ "private", "void", "fillInternalShadow", "(", "Graphics2D", "g", ",", "Shape", "s", ",", "boolean", "paintRightShadow", ")", "{", "Rectangle", "bounds", "=", "s", ".", "getBounds", "(", ")", ";", "int", "x", "=", "bounds", ".", "x", ";", "int", "y", "=", "bounds", ".", "y", ";", "int", "w", "=", "bounds", ".", "width", ";", "int", "h", "=", "bounds", ".", "height", ";", "s", "=", "shapeGenerator", ".", "createRectangle", "(", "x", ",", "y", ",", "w", ",", "2", ")", ";", "g", ".", "setPaint", "(", "getTopShadowGradient", "(", "s", ")", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "s", "=", "shapeGenerator", ".", "createRectangle", "(", "x", ",", "y", ",", "1", ",", "h", ")", ";", "g", ".", "setPaint", "(", "getLeftShadowGradient", "(", "s", ")", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "if", "(", "paintRightShadow", ")", "{", "s", "=", "shapeGenerator", ".", "createRectangle", "(", "x", "+", "w", "-", "1", ",", "y", ",", "1", ",", "h", ")", ";", "g", ".", "setPaint", "(", "getRightShadowGradient", "(", "s", ")", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "}", "}" ]
Fill a rectangular shadow. @param g the Graphics context to paint with. @param s the shape to fill. This is only used for its bounds. @param paintRightShadow {@code true} if the shape is rectangular and the rightmost shadow should be painted, {@code false} otherwise.
[ "Fill", "a", "rectangular", "shadow", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java#L82-L102
746
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java
SeaGlassInternalShadowEffect.fillInternalShadowRounded
private void fillInternalShadowRounded(Graphics2D g, Shape s) { g.setPaint(getRoundedShadowGradient(s)); g.fill(s); }
java
private void fillInternalShadowRounded(Graphics2D g, Shape s) { g.setPaint(getRoundedShadowGradient(s)); g.fill(s); }
[ "private", "void", "fillInternalShadowRounded", "(", "Graphics2D", "g", ",", "Shape", "s", ")", "{", "g", ".", "setPaint", "(", "getRoundedShadowGradient", "(", "s", ")", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "}" ]
Fill a rounded shadow. @param g the Graphics context to paint with. @param s the shape to fill. This is only used for its bounds.
[ "Fill", "a", "rounded", "shadow", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java#L110-L113
747
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java
SeaGlassInternalShadowEffect.getRoundedShadowGradient
public Paint getRoundedShadowGradient(Shape s) { Rectangle r = s.getBounds(); int x = r.x + r.width / 2; int y1 = r.y; float frac = 1.0f / r.height; int y2 = r.y + r.height; return new LinearGradientPaint(x, y1, x, y2, (new float[] { 0f, frac, 1f }), new Color[] { innerShadow.top, innerShadow.bottom, innerShadow.bottom }); }
java
public Paint getRoundedShadowGradient(Shape s) { Rectangle r = s.getBounds(); int x = r.x + r.width / 2; int y1 = r.y; float frac = 1.0f / r.height; int y2 = r.y + r.height; return new LinearGradientPaint(x, y1, x, y2, (new float[] { 0f, frac, 1f }), new Color[] { innerShadow.top, innerShadow.bottom, innerShadow.bottom }); }
[ "public", "Paint", "getRoundedShadowGradient", "(", "Shape", "s", ")", "{", "Rectangle", "r", "=", "s", ".", "getBounds", "(", ")", ";", "int", "x", "=", "r", ".", "x", "+", "r", ".", "width", "/", "2", ";", "int", "y1", "=", "r", ".", "y", ";", "float", "frac", "=", "1.0f", "/", "r", ".", "height", ";", "int", "y2", "=", "r", ".", "y", "+", "r", ".", "height", ";", "return", "new", "LinearGradientPaint", "(", "x", ",", "y1", ",", "x", ",", "y2", ",", "(", "new", "float", "[", "]", "{", "0f", ",", "frac", ",", "1f", "}", ")", ",", "new", "Color", "[", "]", "{", "innerShadow", ".", "top", ",", "innerShadow", ".", "bottom", ",", "innerShadow", ".", "bottom", "}", ")", ";", "}" ]
Create the gradient for a rounded shadow. @param s the shape of the gradient. This is only used for its bounds. @return the gradient.
[ "Create", "the", "gradient", "for", "a", "rounded", "shadow", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java#L122-L131
748
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java
SeaGlassInternalShadowEffect.getTopShadowGradient
public Paint getTopShadowGradient(Shape s) { Rectangle2D bounds = s.getBounds2D(); float minY = (float) bounds.getMinY(); float maxY = (float) bounds.getMaxY(); float midX = (float) bounds.getCenterX(); return new LinearGradientPaint(midX, minY, midX, maxY, (new float[] { 0f, 1f }), new Color[] { innerShadow.top, transparentColor }); }
java
public Paint getTopShadowGradient(Shape s) { Rectangle2D bounds = s.getBounds2D(); float minY = (float) bounds.getMinY(); float maxY = (float) bounds.getMaxY(); float midX = (float) bounds.getCenterX(); return new LinearGradientPaint(midX, minY, midX, maxY, (new float[] { 0f, 1f }), new Color[] { innerShadow.top, transparentColor }); }
[ "public", "Paint", "getTopShadowGradient", "(", "Shape", "s", ")", "{", "Rectangle2D", "bounds", "=", "s", ".", "getBounds2D", "(", ")", ";", "float", "minY", "=", "(", "float", ")", "bounds", ".", "getMinY", "(", ")", ";", "float", "maxY", "=", "(", "float", ")", "bounds", ".", "getMaxY", "(", ")", ";", "float", "midX", "=", "(", "float", ")", "bounds", ".", "getCenterX", "(", ")", ";", "return", "new", "LinearGradientPaint", "(", "midX", ",", "minY", ",", "midX", ",", "maxY", ",", "(", "new", "float", "[", "]", "{", "0f", ",", "1f", "}", ")", ",", "new", "Color", "[", "]", "{", "innerShadow", ".", "top", ",", "transparentColor", "}", ")", ";", "}" ]
Create the gradient for the top of a rectangular shadow. @param s the shape of the gradient. This is only used for its bounds. @return the gradient.
[ "Create", "the", "gradient", "for", "the", "top", "of", "a", "rectangular", "shadow", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java#L140-L147
749
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java
SeaGlassInternalShadowEffect.getLeftShadowGradient
public Paint getLeftShadowGradient(Shape s) { Rectangle2D bounds = s.getBounds2D(); float minX = (float) bounds.getMinX(); float maxX = (float) bounds.getMaxX(); float midY = (float) bounds.getCenterY(); return new LinearGradientPaint(minX, midY, maxX, midY, (new float[] { 0f, 1f }), new Color[] { innerShadow.bottom, transparentColor }); }
java
public Paint getLeftShadowGradient(Shape s) { Rectangle2D bounds = s.getBounds2D(); float minX = (float) bounds.getMinX(); float maxX = (float) bounds.getMaxX(); float midY = (float) bounds.getCenterY(); return new LinearGradientPaint(minX, midY, maxX, midY, (new float[] { 0f, 1f }), new Color[] { innerShadow.bottom, transparentColor }); }
[ "public", "Paint", "getLeftShadowGradient", "(", "Shape", "s", ")", "{", "Rectangle2D", "bounds", "=", "s", ".", "getBounds2D", "(", ")", ";", "float", "minX", "=", "(", "float", ")", "bounds", ".", "getMinX", "(", ")", ";", "float", "maxX", "=", "(", "float", ")", "bounds", ".", "getMaxX", "(", ")", ";", "float", "midY", "=", "(", "float", ")", "bounds", ".", "getCenterY", "(", ")", ";", "return", "new", "LinearGradientPaint", "(", "minX", ",", "midY", ",", "maxX", ",", "midY", ",", "(", "new", "float", "[", "]", "{", "0f", ",", "1f", "}", ")", ",", "new", "Color", "[", "]", "{", "innerShadow", ".", "bottom", ",", "transparentColor", "}", ")", ";", "}" ]
Create the gradient for the left of a rectangular shadow. @param s the shape of the gradient. This is only used for its bounds. @return the gradient.
[ "Create", "the", "gradient", "for", "the", "left", "of", "a", "rectangular", "shadow", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java#L156-L164
750
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/DerivedColor.java
DerivedColor.rederiveColor
private void rederiveColor() { Color src = UIManager.getColor(uiDefaultParentName); if (src != null) { float[] tmp = Color.RGBtoHSB(src.getRed(), src.getGreen(), src.getBlue(), null); // apply offsets tmp[0] = clamp(tmp[0] + hOffset); tmp[1] = clamp(tmp[1] + sOffset); tmp[2] = clamp(tmp[2] + bOffset); int alpha = clamp(src.getAlpha() + aOffset); argbValue = (Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF) | (alpha << 24); } else { float[] tmp = new float[3]; tmp[0] = clamp(hOffset); tmp[1] = clamp(sOffset); tmp[2] = clamp(bOffset); int alpha = clamp(aOffset); argbValue = (Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF) | (alpha << 24); } }
java
private void rederiveColor() { Color src = UIManager.getColor(uiDefaultParentName); if (src != null) { float[] tmp = Color.RGBtoHSB(src.getRed(), src.getGreen(), src.getBlue(), null); // apply offsets tmp[0] = clamp(tmp[0] + hOffset); tmp[1] = clamp(tmp[1] + sOffset); tmp[2] = clamp(tmp[2] + bOffset); int alpha = clamp(src.getAlpha() + aOffset); argbValue = (Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF) | (alpha << 24); } else { float[] tmp = new float[3]; tmp[0] = clamp(hOffset); tmp[1] = clamp(sOffset); tmp[2] = clamp(bOffset); int alpha = clamp(aOffset); argbValue = (Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF) | (alpha << 24); } }
[ "private", "void", "rederiveColor", "(", ")", "{", "Color", "src", "=", "UIManager", ".", "getColor", "(", "uiDefaultParentName", ")", ";", "if", "(", "src", "!=", "null", ")", "{", "float", "[", "]", "tmp", "=", "Color", ".", "RGBtoHSB", "(", "src", ".", "getRed", "(", ")", ",", "src", ".", "getGreen", "(", ")", ",", "src", ".", "getBlue", "(", ")", ",", "null", ")", ";", "// apply offsets", "tmp", "[", "0", "]", "=", "clamp", "(", "tmp", "[", "0", "]", "+", "hOffset", ")", ";", "tmp", "[", "1", "]", "=", "clamp", "(", "tmp", "[", "1", "]", "+", "sOffset", ")", ";", "tmp", "[", "2", "]", "=", "clamp", "(", "tmp", "[", "2", "]", "+", "bOffset", ")", ";", "int", "alpha", "=", "clamp", "(", "src", ".", "getAlpha", "(", ")", "+", "aOffset", ")", ";", "argbValue", "=", "(", "Color", ".", "HSBtoRGB", "(", "tmp", "[", "0", "]", ",", "tmp", "[", "1", "]", ",", "tmp", "[", "2", "]", ")", "&", "0xFFFFFF", ")", "|", "(", "alpha", "<<", "24", ")", ";", "}", "else", "{", "float", "[", "]", "tmp", "=", "new", "float", "[", "3", "]", ";", "tmp", "[", "0", "]", "=", "clamp", "(", "hOffset", ")", ";", "tmp", "[", "1", "]", "=", "clamp", "(", "sOffset", ")", ";", "tmp", "[", "2", "]", "=", "clamp", "(", "bOffset", ")", ";", "int", "alpha", "=", "clamp", "(", "aOffset", ")", ";", "argbValue", "=", "(", "Color", ".", "HSBtoRGB", "(", "tmp", "[", "0", "]", ",", "tmp", "[", "1", "]", ",", "tmp", "[", "2", "]", ")", "&", "0xFFFFFF", ")", "|", "(", "alpha", "<<", "24", ")", ";", "}", "}" ]
Recalculate the derived color from the UIManager parent color and offsets
[ "Recalculate", "the", "derived", "color", "from", "the", "UIManager", "parent", "color", "and", "offsets" ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/DerivedColor.java#L54-L72
751
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/button/TexturedButtonPainter.java
TexturedButtonPainter.getTexturedButtonBorderColors
public TwoColors getTexturedButtonBorderColors(CommonControlState type) { switch (type) { case DISABLED: return texturedButtonBorderDisabled; case DISABLED_SELECTED: return texturedButtonBorderDisabledSelected; case ENABLED: return texturedButtonBorderEnabled; case PRESSED: return texturedButtonBorderPressed; case DEFAULT: return texturedButtonBorderDefault; case SELECTED: return texturedButtonBorderSelected; case DEFAULT_PRESSED: return texturedButtonBorderDefaultPressed; case PRESSED_SELECTED: return texturedButtonBorderPressedSelected; } return null; }
java
public TwoColors getTexturedButtonBorderColors(CommonControlState type) { switch (type) { case DISABLED: return texturedButtonBorderDisabled; case DISABLED_SELECTED: return texturedButtonBorderDisabledSelected; case ENABLED: return texturedButtonBorderEnabled; case PRESSED: return texturedButtonBorderPressed; case DEFAULT: return texturedButtonBorderDefault; case SELECTED: return texturedButtonBorderSelected; case DEFAULT_PRESSED: return texturedButtonBorderDefaultPressed; case PRESSED_SELECTED: return texturedButtonBorderPressedSelected; } return null; }
[ "public", "TwoColors", "getTexturedButtonBorderColors", "(", "CommonControlState", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "DISABLED", ":", "return", "texturedButtonBorderDisabled", ";", "case", "DISABLED_SELECTED", ":", "return", "texturedButtonBorderDisabledSelected", ";", "case", "ENABLED", ":", "return", "texturedButtonBorderEnabled", ";", "case", "PRESSED", ":", "return", "texturedButtonBorderPressed", ";", "case", "DEFAULT", ":", "return", "texturedButtonBorderDefault", ";", "case", "SELECTED", ":", "return", "texturedButtonBorderSelected", ";", "case", "DEFAULT_PRESSED", ":", "return", "texturedButtonBorderDefaultPressed", ";", "case", "PRESSED_SELECTED", ":", "return", "texturedButtonBorderPressedSelected", ";", "}", "return", "null", ";", "}" ]
Get the colors for the border. @param type the button type. Derived from state. @return a two-tuple of colors for top and bottom gradient.
[ "Get", "the", "colors", "for", "the", "border", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/button/TexturedButtonPainter.java#L119-L148
752
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/button/TexturedButtonPainter.java
TexturedButtonPainter.getTexturedButtonInteriorColors
public TwoColors getTexturedButtonInteriorColors(CommonControlState type) { switch (type) { case DISABLED: return texturedButtonInteriorDisabled; case DISABLED_SELECTED: return texturedButtonInteriorDisabledSelected; case ENABLED: return texturedButtonInteriorEnabled; case PRESSED: return texturedButtonInteriorPressed; case DEFAULT: return texturedButtonInteriorDefault; case SELECTED: return texturedButtonInteriorSelected; case DEFAULT_PRESSED: return texturedButtonInteriorDefaultPressed; case PRESSED_SELECTED: return texturedButtonInteriorPressedSelected; } return null; }
java
public TwoColors getTexturedButtonInteriorColors(CommonControlState type) { switch (type) { case DISABLED: return texturedButtonInteriorDisabled; case DISABLED_SELECTED: return texturedButtonInteriorDisabledSelected; case ENABLED: return texturedButtonInteriorEnabled; case PRESSED: return texturedButtonInteriorPressed; case DEFAULT: return texturedButtonInteriorDefault; case SELECTED: return texturedButtonInteriorSelected; case DEFAULT_PRESSED: return texturedButtonInteriorDefaultPressed; case PRESSED_SELECTED: return texturedButtonInteriorPressedSelected; } return null; }
[ "public", "TwoColors", "getTexturedButtonInteriorColors", "(", "CommonControlState", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "DISABLED", ":", "return", "texturedButtonInteriorDisabled", ";", "case", "DISABLED_SELECTED", ":", "return", "texturedButtonInteriorDisabledSelected", ";", "case", "ENABLED", ":", "return", "texturedButtonInteriorEnabled", ";", "case", "PRESSED", ":", "return", "texturedButtonInteriorPressed", ";", "case", "DEFAULT", ":", "return", "texturedButtonInteriorDefault", ";", "case", "SELECTED", ":", "return", "texturedButtonInteriorSelected", ";", "case", "DEFAULT_PRESSED", ":", "return", "texturedButtonInteriorDefaultPressed", ";", "case", "PRESSED_SELECTED", ":", "return", "texturedButtonInteriorPressedSelected", ";", "}", "return", "null", ";", "}" ]
Get the colors for the interior. @param type the button type. Derived from the state. @return a two-tuple of colors for top and bottom gradient.
[ "Get", "the", "colors", "for", "the", "interior", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/button/TexturedButtonPainter.java#L157-L186
753
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java
TitlePaneCloseButtonPainter.decodeCloseGradient
private Paint decodeCloseGradient(Shape s, Color top, Color bottom) { Rectangle r = s.getBounds(); int width = r.width; int height = r.height; return createGradient(r.x + width / 2, r.y, r.x + width / 2, r.y + height - 1, new float[] { 0f, 1f }, new Color[] { top, bottom }); }
java
private Paint decodeCloseGradient(Shape s, Color top, Color bottom) { Rectangle r = s.getBounds(); int width = r.width; int height = r.height; return createGradient(r.x + width / 2, r.y, r.x + width / 2, r.y + height - 1, new float[] { 0f, 1f }, new Color[] { top, bottom }); }
[ "private", "Paint", "decodeCloseGradient", "(", "Shape", "s", ",", "Color", "top", ",", "Color", "bottom", ")", "{", "Rectangle", "r", "=", "s", ".", "getBounds", "(", ")", ";", "int", "width", "=", "r", ".", "width", ";", "int", "height", "=", "r", ".", "height", ";", "return", "createGradient", "(", "r", ".", "x", "+", "width", "/", "2", ",", "r", ".", "y", ",", "r", ".", "x", "+", "width", "/", "2", ",", "r", ".", "y", "+", "height", "-", "1", ",", "new", "float", "[", "]", "{", "0f", ",", "1f", "}", ",", "new", "Color", "[", "]", "{", "top", ",", "bottom", "}", ")", ";", "}" ]
Create the gradient for the close button. @param s the shape to fill. @param top the top color. @param bottom the bottom color. @return the gradient.
[ "Create", "the", "gradient", "for", "the", "close", "button", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java#L186-L192
754
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java
TitlePaneCloseButtonPainter.decodeEdge
private Shape decodeEdge(int width, int height) { path.reset(); path.moveTo(width - 2, 0); path.lineTo(width - 2, height - 4); path.lineTo(width - 4, height - 2); path.lineTo(0, height - 2); return path; }
java
private Shape decodeEdge(int width, int height) { path.reset(); path.moveTo(width - 2, 0); path.lineTo(width - 2, height - 4); path.lineTo(width - 4, height - 2); path.lineTo(0, height - 2); return path; }
[ "private", "Shape", "decodeEdge", "(", "int", "width", ",", "int", "height", ")", "{", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "width", "-", "2", ",", "0", ")", ";", "path", ".", "lineTo", "(", "width", "-", "2", ",", "height", "-", "4", ")", ";", "path", ".", "lineTo", "(", "width", "-", "4", ",", "height", "-", "2", ")", ";", "path", ".", "lineTo", "(", "0", ",", "height", "-", "2", ")", ";", "return", "path", ";", "}" ]
Create the edge of the button. @param width the width. @param height the height. @return the shape of the edge.
[ "Create", "the", "edge", "of", "the", "button", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java#L222-L230
755
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java
TitlePaneCloseButtonPainter.decodeShadow
private Shape decodeShadow(int width, int height) { path.reset(); path.moveTo(width - 1, 0); path.lineTo(width - 1, height - 4); path.lineTo(width - 4, height - 1); path.lineTo(0, height - 1); return path; }
java
private Shape decodeShadow(int width, int height) { path.reset(); path.moveTo(width - 1, 0); path.lineTo(width - 1, height - 4); path.lineTo(width - 4, height - 1); path.lineTo(0, height - 1); return path; }
[ "private", "Shape", "decodeShadow", "(", "int", "width", ",", "int", "height", ")", "{", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "width", "-", "1", ",", "0", ")", ";", "path", ".", "lineTo", "(", "width", "-", "1", ",", "height", "-", "4", ")", ";", "path", ".", "lineTo", "(", "width", "-", "4", ",", "height", "-", "1", ")", ";", "path", ".", "lineTo", "(", "0", ",", "height", "-", "1", ")", ";", "return", "path", ";", "}" ]
Create the shadow for the button. @param width the width. @param height the height. @return the shape of the shadow.
[ "Create", "the", "shadow", "for", "the", "button", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java#L240-L248
756
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java
TitlePaneCloseButtonPainter.decodeMarkBorder
private Shape decodeMarkBorder(int width, int height) { int left = (width - 3) / 2 - 5; int top = (height - 2) / 2 - 5; path.reset(); path.moveTo(left + 1, top + 0); path.lineTo(left + 3, top + 0); path.pointAt(left + 4, top + 1); path.pointAt(left + 5, top + 2); path.pointAt(left + 6, top + 1); path.moveTo(left + 7, top + 0); path.lineTo(left + 9, top + 0); path.pointAt(left + 10, top + 1); path.pointAt(left + 9, top + 2); path.pointAt(left + 8, top + 3); path.moveTo(left + 7, top + 4); path.lineTo(left + 7, top + 5); path.pointAt(left + 8, top + 6); path.pointAt(left + 9, top + 7); path.pointAt(left + 10, top + 8); path.moveTo(left + 9, top + 9); path.lineTo(left + 7, top + 9); path.pointAt(left + 6, top + 8); path.pointAt(left + 5, top + 7); path.pointAt(left + 4, top + 8); path.moveTo(left + 3, top + 9); path.lineTo(left + 1, top + 9); path.pointAt(left + 0, top + 8); path.pointAt(left + 1, top + 7); path.pointAt(left + 2, top + 6); path.moveTo(left + 3, top + 5); path.lineTo(left + 3, top + 4); path.pointAt(left + 2, top + 3); path.pointAt(left + 1, top + 2); path.pointAt(left + 0, top + 1); return path; }
java
private Shape decodeMarkBorder(int width, int height) { int left = (width - 3) / 2 - 5; int top = (height - 2) / 2 - 5; path.reset(); path.moveTo(left + 1, top + 0); path.lineTo(left + 3, top + 0); path.pointAt(left + 4, top + 1); path.pointAt(left + 5, top + 2); path.pointAt(left + 6, top + 1); path.moveTo(left + 7, top + 0); path.lineTo(left + 9, top + 0); path.pointAt(left + 10, top + 1); path.pointAt(left + 9, top + 2); path.pointAt(left + 8, top + 3); path.moveTo(left + 7, top + 4); path.lineTo(left + 7, top + 5); path.pointAt(left + 8, top + 6); path.pointAt(left + 9, top + 7); path.pointAt(left + 10, top + 8); path.moveTo(left + 9, top + 9); path.lineTo(left + 7, top + 9); path.pointAt(left + 6, top + 8); path.pointAt(left + 5, top + 7); path.pointAt(left + 4, top + 8); path.moveTo(left + 3, top + 9); path.lineTo(left + 1, top + 9); path.pointAt(left + 0, top + 8); path.pointAt(left + 1, top + 7); path.pointAt(left + 2, top + 6); path.moveTo(left + 3, top + 5); path.lineTo(left + 3, top + 4); path.pointAt(left + 2, top + 3); path.pointAt(left + 1, top + 2); path.pointAt(left + 0, top + 1); return path; }
[ "private", "Shape", "decodeMarkBorder", "(", "int", "width", ",", "int", "height", ")", "{", "int", "left", "=", "(", "width", "-", "3", ")", "/", "2", "-", "5", ";", "int", "top", "=", "(", "height", "-", "2", ")", "/", "2", "-", "5", ";", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "left", "+", "1", ",", "top", "+", "0", ")", ";", "path", ".", "lineTo", "(", "left", "+", "3", ",", "top", "+", "0", ")", ";", "path", ".", "pointAt", "(", "left", "+", "4", ",", "top", "+", "1", ")", ";", "path", ".", "pointAt", "(", "left", "+", "5", ",", "top", "+", "2", ")", ";", "path", ".", "pointAt", "(", "left", "+", "6", ",", "top", "+", "1", ")", ";", "path", ".", "moveTo", "(", "left", "+", "7", ",", "top", "+", "0", ")", ";", "path", ".", "lineTo", "(", "left", "+", "9", ",", "top", "+", "0", ")", ";", "path", ".", "pointAt", "(", "left", "+", "10", ",", "top", "+", "1", ")", ";", "path", ".", "pointAt", "(", "left", "+", "9", ",", "top", "+", "2", ")", ";", "path", ".", "pointAt", "(", "left", "+", "8", ",", "top", "+", "3", ")", ";", "path", ".", "moveTo", "(", "left", "+", "7", ",", "top", "+", "4", ")", ";", "path", ".", "lineTo", "(", "left", "+", "7", ",", "top", "+", "5", ")", ";", "path", ".", "pointAt", "(", "left", "+", "8", ",", "top", "+", "6", ")", ";", "path", ".", "pointAt", "(", "left", "+", "9", ",", "top", "+", "7", ")", ";", "path", ".", "pointAt", "(", "left", "+", "10", ",", "top", "+", "8", ")", ";", "path", ".", "moveTo", "(", "left", "+", "9", ",", "top", "+", "9", ")", ";", "path", ".", "lineTo", "(", "left", "+", "7", ",", "top", "+", "9", ")", ";", "path", ".", "pointAt", "(", "left", "+", "6", ",", "top", "+", "8", ")", ";", "path", ".", "pointAt", "(", "left", "+", "5", ",", "top", "+", "7", ")", ";", "path", ".", "pointAt", "(", "left", "+", "4", ",", "top", "+", "8", ")", ";", "path", ".", "moveTo", "(", "left", "+", "3", ",", "top", "+", "9", ")", ";", "path", ".", "lineTo", "(", "left", "+", "1", ",", "top", "+", "9", ")", ";", "path", ".", "pointAt", "(", "left", "+", "0", ",", "top", "+", "8", ")", ";", "path", ".", "pointAt", "(", "left", "+", "1", ",", "top", "+", "7", ")", ";", "path", ".", "pointAt", "(", "left", "+", "2", ",", "top", "+", "6", ")", ";", "path", ".", "moveTo", "(", "left", "+", "3", ",", "top", "+", "5", ")", ";", "path", ".", "lineTo", "(", "left", "+", "3", ",", "top", "+", "4", ")", ";", "path", ".", "pointAt", "(", "left", "+", "2", ",", "top", "+", "3", ")", ";", "path", ".", "pointAt", "(", "left", "+", "1", ",", "top", "+", "2", ")", ";", "path", ".", "pointAt", "(", "left", "+", "0", ",", "top", "+", "1", ")", ";", "return", "path", ";", "}" ]
Create the shape for the mark border. @param width the width. @param height the height. @return the shape of the mark border.
[ "Create", "the", "shape", "for", "the", "mark", "border", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java#L258-L295
757
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java
TitlePaneCloseButtonPainter.decodeMarkInterior
private Shape decodeMarkInterior(int width, int height) { int left = (width - 3) / 2 - 5; int top = (height - 2) / 2 - 5; path.reset(); path.moveTo(left + 1, top + 1); path.lineTo(left + 4, top + 1); path.lineTo(left + 5, top + 3); path.lineTo(left + 7, top + 1); path.lineTo(left + 10, top + 1); path.lineTo(left + 7, top + 4); path.lineTo(left + 7, top + 5); path.lineTo(left + 10, top + 9); path.lineTo(left + 6, top + 8); path.lineTo(left + 5, top + 6); path.lineTo(left + 4, top + 9); path.lineTo(left + 0, top + 9); path.lineTo(left + 4, top + 5); path.lineTo(left + 4, top + 4); path.closePath(); return path; }
java
private Shape decodeMarkInterior(int width, int height) { int left = (width - 3) / 2 - 5; int top = (height - 2) / 2 - 5; path.reset(); path.moveTo(left + 1, top + 1); path.lineTo(left + 4, top + 1); path.lineTo(left + 5, top + 3); path.lineTo(left + 7, top + 1); path.lineTo(left + 10, top + 1); path.lineTo(left + 7, top + 4); path.lineTo(left + 7, top + 5); path.lineTo(left + 10, top + 9); path.lineTo(left + 6, top + 8); path.lineTo(left + 5, top + 6); path.lineTo(left + 4, top + 9); path.lineTo(left + 0, top + 9); path.lineTo(left + 4, top + 5); path.lineTo(left + 4, top + 4); path.closePath(); return path; }
[ "private", "Shape", "decodeMarkInterior", "(", "int", "width", ",", "int", "height", ")", "{", "int", "left", "=", "(", "width", "-", "3", ")", "/", "2", "-", "5", ";", "int", "top", "=", "(", "height", "-", "2", ")", "/", "2", "-", "5", ";", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "left", "+", "1", ",", "top", "+", "1", ")", ";", "path", ".", "lineTo", "(", "left", "+", "4", ",", "top", "+", "1", ")", ";", "path", ".", "lineTo", "(", "left", "+", "5", ",", "top", "+", "3", ")", ";", "path", ".", "lineTo", "(", "left", "+", "7", ",", "top", "+", "1", ")", ";", "path", ".", "lineTo", "(", "left", "+", "10", ",", "top", "+", "1", ")", ";", "path", ".", "lineTo", "(", "left", "+", "7", ",", "top", "+", "4", ")", ";", "path", ".", "lineTo", "(", "left", "+", "7", ",", "top", "+", "5", ")", ";", "path", ".", "lineTo", "(", "left", "+", "10", ",", "top", "+", "9", ")", ";", "path", ".", "lineTo", "(", "left", "+", "6", ",", "top", "+", "8", ")", ";", "path", ".", "lineTo", "(", "left", "+", "5", ",", "top", "+", "6", ")", ";", "path", ".", "lineTo", "(", "left", "+", "4", ",", "top", "+", "9", ")", ";", "path", ".", "lineTo", "(", "left", "+", "0", ",", "top", "+", "9", ")", ";", "path", ".", "lineTo", "(", "left", "+", "4", ",", "top", "+", "5", ")", ";", "path", ".", "lineTo", "(", "left", "+", "4", ",", "top", "+", "4", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Create the shape for the mark interior. @param width the width. @param height the height. @return the shape of the mark interior.
[ "Create", "the", "shape", "for", "the", "mark", "interior", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java#L305-L327
758
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassProgressBarUI.java
SeaGlassProgressBarUI.paintProgressIndicator
private void paintProgressIndicator(SeaGlassContext context, Graphics2D g2d, int width, int height, int size, boolean isFinished) { JProgressBar pBar = (JProgressBar) context.getComponent(); if (tileWhenIndeterminate && pBar.isIndeterminate()) { double offsetFraction = (double) getAnimationIndex() / (double) getFrameCount(); int offset = (int) (offsetFraction * tileWidth); if (pBar.getOrientation() == JProgressBar.HORIZONTAL) { // If we're right-to-left, flip the direction of animation. if (!SeaGlassLookAndFeel.isLeftToRight(pBar)) { offset = tileWidth - offset; } // paint each tile horizontally for (int i = -tileWidth + offset; i <= width; i += tileWidth) { context.getPainter().paintProgressBarForeground(context, g2d, i, 0, tileWidth, height, pBar.getOrientation()); } } else { // paint each tile vertically for (int i = -offset; i < height + tileWidth; i += tileWidth) { context.getPainter().paintProgressBarForeground(context, g2d, 0, i, width, tileWidth, pBar.getOrientation()); } } } else { if (pBar.getOrientation() == JProgressBar.HORIZONTAL) { int start = 0; if (isFinished) { size = width; } else if (!SeaGlassLookAndFeel.isLeftToRight(pBar)) { start = width - size; } context.getPainter().paintProgressBarForeground(context, g2d, start, 0, size, height, pBar.getOrientation()); } else { // When the progress bar is vertical we always paint from bottom // to top, not matter what the component orientation is. int start = height; if (isFinished) { size = height; } context.getPainter().paintProgressBarForeground(context, g2d, 0, start, width, size, pBar.getOrientation()); } } }
java
private void paintProgressIndicator(SeaGlassContext context, Graphics2D g2d, int width, int height, int size, boolean isFinished) { JProgressBar pBar = (JProgressBar) context.getComponent(); if (tileWhenIndeterminate && pBar.isIndeterminate()) { double offsetFraction = (double) getAnimationIndex() / (double) getFrameCount(); int offset = (int) (offsetFraction * tileWidth); if (pBar.getOrientation() == JProgressBar.HORIZONTAL) { // If we're right-to-left, flip the direction of animation. if (!SeaGlassLookAndFeel.isLeftToRight(pBar)) { offset = tileWidth - offset; } // paint each tile horizontally for (int i = -tileWidth + offset; i <= width; i += tileWidth) { context.getPainter().paintProgressBarForeground(context, g2d, i, 0, tileWidth, height, pBar.getOrientation()); } } else { // paint each tile vertically for (int i = -offset; i < height + tileWidth; i += tileWidth) { context.getPainter().paintProgressBarForeground(context, g2d, 0, i, width, tileWidth, pBar.getOrientation()); } } } else { if (pBar.getOrientation() == JProgressBar.HORIZONTAL) { int start = 0; if (isFinished) { size = width; } else if (!SeaGlassLookAndFeel.isLeftToRight(pBar)) { start = width - size; } context.getPainter().paintProgressBarForeground(context, g2d, start, 0, size, height, pBar.getOrientation()); } else { // When the progress bar is vertical we always paint from bottom // to top, not matter what the component orientation is. int start = height; if (isFinished) { size = height; } context.getPainter().paintProgressBarForeground(context, g2d, 0, start, width, size, pBar.getOrientation()); } } }
[ "private", "void", "paintProgressIndicator", "(", "SeaGlassContext", "context", ",", "Graphics2D", "g2d", ",", "int", "width", ",", "int", "height", ",", "int", "size", ",", "boolean", "isFinished", ")", "{", "JProgressBar", "pBar", "=", "(", "JProgressBar", ")", "context", ".", "getComponent", "(", ")", ";", "if", "(", "tileWhenIndeterminate", "&&", "pBar", ".", "isIndeterminate", "(", ")", ")", "{", "double", "offsetFraction", "=", "(", "double", ")", "getAnimationIndex", "(", ")", "/", "(", "double", ")", "getFrameCount", "(", ")", ";", "int", "offset", "=", "(", "int", ")", "(", "offsetFraction", "*", "tileWidth", ")", ";", "if", "(", "pBar", ".", "getOrientation", "(", ")", "==", "JProgressBar", ".", "HORIZONTAL", ")", "{", "// If we're right-to-left, flip the direction of animation.", "if", "(", "!", "SeaGlassLookAndFeel", ".", "isLeftToRight", "(", "pBar", ")", ")", "{", "offset", "=", "tileWidth", "-", "offset", ";", "}", "// paint each tile horizontally", "for", "(", "int", "i", "=", "-", "tileWidth", "+", "offset", ";", "i", "<=", "width", ";", "i", "+=", "tileWidth", ")", "{", "context", ".", "getPainter", "(", ")", ".", "paintProgressBarForeground", "(", "context", ",", "g2d", ",", "i", ",", "0", ",", "tileWidth", ",", "height", ",", "pBar", ".", "getOrientation", "(", ")", ")", ";", "}", "}", "else", "{", "// paint each tile vertically", "for", "(", "int", "i", "=", "-", "offset", ";", "i", "<", "height", "+", "tileWidth", ";", "i", "+=", "tileWidth", ")", "{", "context", ".", "getPainter", "(", ")", ".", "paintProgressBarForeground", "(", "context", ",", "g2d", ",", "0", ",", "i", ",", "width", ",", "tileWidth", ",", "pBar", ".", "getOrientation", "(", ")", ")", ";", "}", "}", "}", "else", "{", "if", "(", "pBar", ".", "getOrientation", "(", ")", "==", "JProgressBar", ".", "HORIZONTAL", ")", "{", "int", "start", "=", "0", ";", "if", "(", "isFinished", ")", "{", "size", "=", "width", ";", "}", "else", "if", "(", "!", "SeaGlassLookAndFeel", ".", "isLeftToRight", "(", "pBar", ")", ")", "{", "start", "=", "width", "-", "size", ";", "}", "context", ".", "getPainter", "(", ")", ".", "paintProgressBarForeground", "(", "context", ",", "g2d", ",", "start", ",", "0", ",", "size", ",", "height", ",", "pBar", ".", "getOrientation", "(", ")", ")", ";", "}", "else", "{", "// When the progress bar is vertical we always paint from bottom", "// to top, not matter what the component orientation is.", "int", "start", "=", "height", ";", "if", "(", "isFinished", ")", "{", "size", "=", "height", ";", "}", "context", ".", "getPainter", "(", ")", ".", "paintProgressBarForeground", "(", "context", ",", "g2d", ",", "0", ",", "start", ",", "width", ",", "size", ",", "pBar", ".", "getOrientation", "(", ")", ")", ";", "}", "}", "}" ]
Paint the actual internal progress bar. @param context @param g2d @param width @param height @param size @param isFinished
[ "Paint", "the", "actual", "internal", "progress", "bar", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassProgressBarUI.java#L323-L363
759
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ButtonPainter.java
ButtonPainter.getButtonPainter
private ButtonVariantPainter getButtonPainter(JComponent c) { Object buttonType = c.getClientProperty("JButton.buttonType"); ButtonVariantPainter button = standard; if ("textured".equals(buttonType) || "segmentedTextured".equals(buttonType)) { button = textured; } return button; }
java
private ButtonVariantPainter getButtonPainter(JComponent c) { Object buttonType = c.getClientProperty("JButton.buttonType"); ButtonVariantPainter button = standard; if ("textured".equals(buttonType) || "segmentedTextured".equals(buttonType)) { button = textured; } return button; }
[ "private", "ButtonVariantPainter", "getButtonPainter", "(", "JComponent", "c", ")", "{", "Object", "buttonType", "=", "c", ".", "getClientProperty", "(", "\"JButton.buttonType\"", ")", ";", "ButtonVariantPainter", "button", "=", "standard", ";", "if", "(", "\"textured\"", ".", "equals", "(", "buttonType", ")", "||", "\"segmentedTextured\"", ".", "equals", "(", "buttonType", ")", ")", "{", "button", "=", "textured", ";", "}", "return", "button", ";", "}" ]
Determine the button painter variant from the component's client property. @param c the component. @return the button painter variant.
[ "Determine", "the", "button", "painter", "variant", "from", "the", "component", "s", "client", "property", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ButtonPainter.java#L100-L109
760
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/TableScrollPaneCorner.java
TableScrollPaneCorner.paintComponent
@Override protected void paintComponent(Graphics g) { SeaGlassPainter painter = (SeaGlassPainter) UIManager.get("TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter"); if (painter != null) { Graphics2D g2d = (Graphics2D) g; painter.paint(g2d, this, getWidth() + 1, getHeight()); } }
java
@Override protected void paintComponent(Graphics g) { SeaGlassPainter painter = (SeaGlassPainter) UIManager.get("TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter"); if (painter != null) { Graphics2D g2d = (Graphics2D) g; painter.paint(g2d, this, getWidth() + 1, getHeight()); } }
[ "@", "Override", "protected", "void", "paintComponent", "(", "Graphics", "g", ")", "{", "SeaGlassPainter", "painter", "=", "(", "SeaGlassPainter", ")", "UIManager", ".", "get", "(", "\"TableHeader:\\\"TableHeader.renderer\\\"[Enabled].backgroundPainter\"", ")", ";", "if", "(", "painter", "!=", "null", ")", "{", "Graphics2D", "g2d", "=", "(", "Graphics2D", ")", "g", ";", "painter", ".", "paint", "(", "g2d", ",", "this", ",", "getWidth", "(", ")", "+", "1", ",", "getHeight", "(", ")", ")", ";", "}", "}" ]
Paint the component using the Nimbus Table Header Background Painter @param g the Graphics context to paint with.
[ "Paint", "the", "component", "using", "the", "Nimbus", "Table", "Header", "Background", "Painter" ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/TableScrollPaneCorner.java#L47-L57
761
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassContext.java
SeaGlassContext.getContext
public static SeaGlassContext getContext(Class type, JComponent component, Region region, SynthStyle style, int state) { SeaGlassContext context = null; synchronized (contextMap) { List instances = (List) contextMap.get(type); if (instances != null) { int size = instances.size(); if (size > 0) { context = (SeaGlassContext) instances.remove(size - 1); } } } if (context == null) { try { context = (SeaGlassContext) type.newInstance(); } catch (IllegalAccessException iae) { iae.printStackTrace(); } catch (InstantiationException ie) { ie.printStackTrace(); } } context.reset(component, region, style, state); return context; }
java
public static SeaGlassContext getContext(Class type, JComponent component, Region region, SynthStyle style, int state) { SeaGlassContext context = null; synchronized (contextMap) { List instances = (List) contextMap.get(type); if (instances != null) { int size = instances.size(); if (size > 0) { context = (SeaGlassContext) instances.remove(size - 1); } } } if (context == null) { try { context = (SeaGlassContext) type.newInstance(); } catch (IllegalAccessException iae) { iae.printStackTrace(); } catch (InstantiationException ie) { ie.printStackTrace(); } } context.reset(component, region, style, state); return context; }
[ "public", "static", "SeaGlassContext", "getContext", "(", "Class", "type", ",", "JComponent", "component", ",", "Region", "region", ",", "SynthStyle", "style", ",", "int", "state", ")", "{", "SeaGlassContext", "context", "=", "null", ";", "synchronized", "(", "contextMap", ")", "{", "List", "instances", "=", "(", "List", ")", "contextMap", ".", "get", "(", "type", ")", ";", "if", "(", "instances", "!=", "null", ")", "{", "int", "size", "=", "instances", ".", "size", "(", ")", ";", "if", "(", "size", ">", "0", ")", "{", "context", "=", "(", "SeaGlassContext", ")", "instances", ".", "remove", "(", "size", "-", "1", ")", ";", "}", "}", "}", "if", "(", "context", "==", "null", ")", "{", "try", "{", "context", "=", "(", "SeaGlassContext", ")", "type", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "IllegalAccessException", "iae", ")", "{", "iae", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "InstantiationException", "ie", ")", "{", "ie", ".", "printStackTrace", "(", ")", ";", "}", "}", "context", ".", "reset", "(", "component", ",", "region", ",", "style", ",", "state", ")", ";", "return", "context", ";", "}" ]
The method used to get a context. @param type the class of the context. @param component the component. @param region the region. @param style the style. @param state the state. @return the newly constructed context, corresponding to the arguments.
[ "The", "method", "used", "to", "get", "a", "context", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassContext.java#L127-L156
762
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassContext.java
SeaGlassContext.releaseContext
static void releaseContext(SeaGlassContext context) { synchronized (contextMap) { List instances = (List) contextMap.get(context.getClass()); if (instances == null) { instances = new ArrayList(5); contextMap.put(context.getClass(), instances); } instances.add(context); } }
java
static void releaseContext(SeaGlassContext context) { synchronized (contextMap) { List instances = (List) contextMap.get(context.getClass()); if (instances == null) { instances = new ArrayList(5); contextMap.put(context.getClass(), instances); } instances.add(context); } }
[ "static", "void", "releaseContext", "(", "SeaGlassContext", "context", ")", "{", "synchronized", "(", "contextMap", ")", "{", "List", "instances", "=", "(", "List", ")", "contextMap", ".", "get", "(", "context", ".", "getClass", "(", ")", ")", ";", "if", "(", "instances", "==", "null", ")", "{", "instances", "=", "new", "ArrayList", "(", "5", ")", ";", "contextMap", ".", "put", "(", "context", ".", "getClass", "(", ")", ",", "instances", ")", ";", "}", "instances", ".", "add", "(", "context", ")", ";", "}", "}" ]
Release a context for re-use. @param context the context to release.
[ "Release", "a", "context", "for", "re", "-", "use", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassContext.java#L163-L174
763
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassContext.java
SeaGlassContext.reset
@SuppressWarnings("all") public void reset(JComponent component, Region region, SynthStyle style, int state) { this.component = component; this.region = region; this.style = style; this.state = state; }
java
@SuppressWarnings("all") public void reset(JComponent component, Region region, SynthStyle style, int state) { this.component = component; this.region = region; this.style = style; this.state = state; }
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "public", "void", "reset", "(", "JComponent", "component", ",", "Region", "region", ",", "SynthStyle", "style", ",", "int", "state", ")", "{", "this", ".", "component", "=", "component", ";", "this", ".", "region", "=", "region", ";", "this", ".", "style", "=", "style", ";", "this", ".", "state", "=", "state", ";", "}" ]
Resets the state of the Context. @param component the new component. @param region the new region. @param style the new style. @param state the new state.
[ "Resets", "the", "state", "of", "the", "Context", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassContext.java#L256-L262
764
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassContext.java
SeaGlassContext.getPainter
@SuppressWarnings("all") public SynthPainter getPainter() { SynthPainter painter = getStyle().getPainter(this); if (painter != null) { return painter; } return EMPTY_PAINTER; }
java
@SuppressWarnings("all") public SynthPainter getPainter() { SynthPainter painter = getStyle().getPainter(this); if (painter != null) { return painter; } return EMPTY_PAINTER; }
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "public", "SynthPainter", "getPainter", "(", ")", "{", "SynthPainter", "painter", "=", "getStyle", "(", ")", ".", "getPainter", "(", "this", ")", ";", "if", "(", "painter", "!=", "null", ")", "{", "return", "painter", ";", "}", "return", "EMPTY_PAINTER", ";", "}" ]
Convenience method to get the Painter from the current SynthStyle. This will NEVER return null. @return the painter for the style and context, otherwise the empty painter.
[ "Convenience", "method", "to", "get", "the", "Painter", "from", "the", "current", "SynthStyle", ".", "This", "will", "NEVER", "return", "null", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassContext.java#L281-L290
765
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java
SeaGlassStyle.getSizeVariant
public static String getSizeVariant(JComponent c) { String sizeVariant = System.getProperty("JComponent.sizeVariant"); String componentSizeVariant = (String)c.getClientProperty("JComponent.sizeVariant"); if (componentSizeVariant != null) { sizeVariant = componentSizeVariant; } return sizeVariant; }
java
public static String getSizeVariant(JComponent c) { String sizeVariant = System.getProperty("JComponent.sizeVariant"); String componentSizeVariant = (String)c.getClientProperty("JComponent.sizeVariant"); if (componentSizeVariant != null) { sizeVariant = componentSizeVariant; } return sizeVariant; }
[ "public", "static", "String", "getSizeVariant", "(", "JComponent", "c", ")", "{", "String", "sizeVariant", "=", "System", ".", "getProperty", "(", "\"JComponent.sizeVariant\"", ")", ";", "String", "componentSizeVariant", "=", "(", "String", ")", "c", ".", "getClientProperty", "(", "\"JComponent.sizeVariant\"", ")", ";", "if", "(", "componentSizeVariant", "!=", "null", ")", "{", "sizeVariant", "=", "componentSizeVariant", ";", "}", "return", "sizeVariant", ";", "}" ]
Gets the size variant that is applicable for the given component. @param c @return
[ "Gets", "the", "size", "variant", "that", "is", "applicable", "for", "the", "given", "component", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L168-L175
766
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java
SeaGlassStyle.parsePrefix
static String parsePrefix(String key) { if (key == null) return null; boolean inquotes = false; for (int i = 0; i < key.length(); i++) { char c = key.charAt(i); if (c == '"') { inquotes = !inquotes; } else if ((c == '[' || c == '.') && !inquotes) { return key.substring(0, i); } } return null; }
java
static String parsePrefix(String key) { if (key == null) return null; boolean inquotes = false; for (int i = 0; i < key.length(); i++) { char c = key.charAt(i); if (c == '"') { inquotes = !inquotes; } else if ((c == '[' || c == '.') && !inquotes) { return key.substring(0, i); } } return null; }
[ "static", "String", "parsePrefix", "(", "String", "key", ")", "{", "if", "(", "key", "==", "null", ")", "return", "null", ";", "boolean", "inquotes", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "key", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "c", "=", "key", ".", "charAt", "(", "i", ")", ";", "if", "(", "c", "==", "'", "'", ")", "{", "inquotes", "=", "!", "inquotes", ";", "}", "else", "if", "(", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "&&", "!", "inquotes", ")", "{", "return", "key", ".", "substring", "(", "0", ",", "i", ")", ";", "}", "}", "return", "null", ";", "}" ]
Internal method to parse a style prefix. @param key the key to parse. @return the prefix portion of the key.
[ "Internal", "method", "to", "parse", "a", "style", "prefix", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L329-L346
767
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java
SeaGlassStyle.uninitialize
static void uninitialize() { // get the appcontext that we've stored data in AppContext ctx = AppContext.getAppContext(); // get the pcl stored in app context PropertyChangeListener pcl = (PropertyChangeListener) ctx.get("SeaGlassStyle.defaults.pcl"); // if the pcl exists, uninstall it from the UIDefaults tables if (pcl != null) { UIManager.getDefaults().removePropertyChangeListener(pcl); UIManager.getLookAndFeelDefaults().removePropertyChangeListener(pcl); } // clear out the compiled defaults ctx.put("SeaGlassStyle.defaults", null); }
java
static void uninitialize() { // get the appcontext that we've stored data in AppContext ctx = AppContext.getAppContext(); // get the pcl stored in app context PropertyChangeListener pcl = (PropertyChangeListener) ctx.get("SeaGlassStyle.defaults.pcl"); // if the pcl exists, uninstall it from the UIDefaults tables if (pcl != null) { UIManager.getDefaults().removePropertyChangeListener(pcl); UIManager.getLookAndFeelDefaults().removePropertyChangeListener(pcl); } // clear out the compiled defaults ctx.put("SeaGlassStyle.defaults", null); }
[ "static", "void", "uninitialize", "(", ")", "{", "// get the appcontext that we've stored data in", "AppContext", "ctx", "=", "AppContext", ".", "getAppContext", "(", ")", ";", "// get the pcl stored in app context", "PropertyChangeListener", "pcl", "=", "(", "PropertyChangeListener", ")", "ctx", ".", "get", "(", "\"SeaGlassStyle.defaults.pcl\"", ")", ";", "// if the pcl exists, uninstall it from the UIDefaults tables", "if", "(", "pcl", "!=", "null", ")", "{", "UIManager", ".", "getDefaults", "(", ")", ".", "removePropertyChangeListener", "(", "pcl", ")", ";", "UIManager", ".", "getLookAndFeelDefaults", "(", ")", ".", "removePropertyChangeListener", "(", "pcl", ")", ";", "}", "// clear out the compiled defaults", "ctx", ".", "put", "(", "\"SeaGlassStyle.defaults\"", ",", "null", ")", ";", "}" ]
Called by SeaGlassLookAndFeel when the look and feel is being uninstalled. Performs general cleanup of any app-context specific data.
[ "Called", "by", "SeaGlassLookAndFeel", "when", "the", "look", "and", "feel", "is", "being", "uninstalled", ".", "Performs", "general", "cleanup", "of", "any", "app", "-", "context", "specific", "data", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L352-L367
768
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java
SeaGlassStyle.validate
private void validate() { // a non-null values object is the flag we use to determine whether // to reparse from UIManager. if (values != null) return; // reconstruct this SeaGlassStyle based on the entries in the UIManager // and possibly based on any overrides within the component's // client properties (assuming such a component exists and contains // any SeaGlass.Overrides) values = new Values(); // the profiler revealed that a great deal of CPU time and useless // garbage was being produced by this method and the init method. One // culprit was the creation and reparsing of the entire UIDefaults // map on each call to this method where "values" was null. It turns // out this was happening a lot. // To remove this bottleneck, we store the compiled TreeMaps of defaults // in the appContext for reuse. It is nulled whenever the UIDefaults // changes and recomputed when necessary. final AppContext ctx = AppContext.getAppContext(); // fetch the defaults from the app context. If null, then create and // store the compiled defaults Map<String, TreeMap<String, Object>> compiledDefaults = (Map<String, TreeMap<String, Object>>) ctx.get("SeaGlassStyle.defaults"); if (compiledDefaults == null) { // the entire UIDefaults tables are parsed and compiled into // this map of maps. The key of the compiledDefaults is the // prefix for each style, while the value is a map of // keys->values for that prefix. compiledDefaults = new HashMap<String, TreeMap<String, Object>>(); // get all the defaults from UIManager.getDefaults() and put them // into the compiledDefaults compileDefaults(compiledDefaults, UIManager.getDefaults()); // This second statement pulls defaults from the laf defaults UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults(); compileDefaults(compiledDefaults, lafDefaults); // if it has not already been done, add a listener to both // UIManager.getDefaults() and UIManager.getLookAndFeelDefaults(). PropertyChangeListener pcl = (PropertyChangeListener) ctx.get("SeaGlassStyle.defaults.pcl"); // if pcl is null, then it has not yet been registered with // the UIManager defaults for this app context if (pcl == null) { // create a PCL which will simply clear out the compiled // defaults from the app context, causing it to be recomputed // on subsequent passes pcl = new DefaultsListener(); // add the PCL to both defaults tables that we pay attention // to, so that if the UIDefaults are updated, then the // precompiled defaults will be cleared from the app context // and recomputed on subsequent passes UIManager.getDefaults().addPropertyChangeListener(pcl); UIManager.getLookAndFeelDefaults().addPropertyChangeListener(pcl); // save the PCL to the app context as a marker indicating // that the PCL has been registered so we don't end up adding // more than one listener to the UIDefaults tables. ctx.put("SeaGlassStyle.defaults.pcl", pcl); } // store the defaults for reuse ctx.put("SeaGlassStyle.defaults", compiledDefaults); } TreeMap<String, Object> defaults = compiledDefaults.get(prefix); if (defaults == null) { defaults = new TreeMap<String, Object>(); } // inspect the client properties for the key "SeaGlass.Overrides". If // the // value is an instance of UIDefaults, then these defaults are used // in place of, or in addition to, the defaults in UIManager. if (component != null) { Object o = component.getClientProperty("SeaGlass.Overrides"); if (o instanceof UIDefaults) { Object i = component.getClientProperty("SeaGlass.Overrides.InheritDefaults"); boolean inherit = i instanceof Boolean ? (Boolean) i : true; UIDefaults d = (UIDefaults) o; TreeMap<String, Object> map = new TreeMap<String, Object>(); for (Object obj : d.keySet()) { if (obj instanceof String) { String key = (String) obj; if (key.startsWith(prefix)) { map.put(key, d.get(key)); } } } if (inherit) { defaults.putAll(map); } else { defaults = map; } } } // Now that I've accumulated all the defaults pertaining to this // style, call init which will read these defaults and configure // the default "values". init(values, defaults); }
java
private void validate() { // a non-null values object is the flag we use to determine whether // to reparse from UIManager. if (values != null) return; // reconstruct this SeaGlassStyle based on the entries in the UIManager // and possibly based on any overrides within the component's // client properties (assuming such a component exists and contains // any SeaGlass.Overrides) values = new Values(); // the profiler revealed that a great deal of CPU time and useless // garbage was being produced by this method and the init method. One // culprit was the creation and reparsing of the entire UIDefaults // map on each call to this method where "values" was null. It turns // out this was happening a lot. // To remove this bottleneck, we store the compiled TreeMaps of defaults // in the appContext for reuse. It is nulled whenever the UIDefaults // changes and recomputed when necessary. final AppContext ctx = AppContext.getAppContext(); // fetch the defaults from the app context. If null, then create and // store the compiled defaults Map<String, TreeMap<String, Object>> compiledDefaults = (Map<String, TreeMap<String, Object>>) ctx.get("SeaGlassStyle.defaults"); if (compiledDefaults == null) { // the entire UIDefaults tables are parsed and compiled into // this map of maps. The key of the compiledDefaults is the // prefix for each style, while the value is a map of // keys->values for that prefix. compiledDefaults = new HashMap<String, TreeMap<String, Object>>(); // get all the defaults from UIManager.getDefaults() and put them // into the compiledDefaults compileDefaults(compiledDefaults, UIManager.getDefaults()); // This second statement pulls defaults from the laf defaults UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults(); compileDefaults(compiledDefaults, lafDefaults); // if it has not already been done, add a listener to both // UIManager.getDefaults() and UIManager.getLookAndFeelDefaults(). PropertyChangeListener pcl = (PropertyChangeListener) ctx.get("SeaGlassStyle.defaults.pcl"); // if pcl is null, then it has not yet been registered with // the UIManager defaults for this app context if (pcl == null) { // create a PCL which will simply clear out the compiled // defaults from the app context, causing it to be recomputed // on subsequent passes pcl = new DefaultsListener(); // add the PCL to both defaults tables that we pay attention // to, so that if the UIDefaults are updated, then the // precompiled defaults will be cleared from the app context // and recomputed on subsequent passes UIManager.getDefaults().addPropertyChangeListener(pcl); UIManager.getLookAndFeelDefaults().addPropertyChangeListener(pcl); // save the PCL to the app context as a marker indicating // that the PCL has been registered so we don't end up adding // more than one listener to the UIDefaults tables. ctx.put("SeaGlassStyle.defaults.pcl", pcl); } // store the defaults for reuse ctx.put("SeaGlassStyle.defaults", compiledDefaults); } TreeMap<String, Object> defaults = compiledDefaults.get(prefix); if (defaults == null) { defaults = new TreeMap<String, Object>(); } // inspect the client properties for the key "SeaGlass.Overrides". If // the // value is an instance of UIDefaults, then these defaults are used // in place of, or in addition to, the defaults in UIManager. if (component != null) { Object o = component.getClientProperty("SeaGlass.Overrides"); if (o instanceof UIDefaults) { Object i = component.getClientProperty("SeaGlass.Overrides.InheritDefaults"); boolean inherit = i instanceof Boolean ? (Boolean) i : true; UIDefaults d = (UIDefaults) o; TreeMap<String, Object> map = new TreeMap<String, Object>(); for (Object obj : d.keySet()) { if (obj instanceof String) { String key = (String) obj; if (key.startsWith(prefix)) { map.put(key, d.get(key)); } } } if (inherit) { defaults.putAll(map); } else { defaults = map; } } } // Now that I've accumulated all the defaults pertaining to this // style, call init which will read these defaults and configure // the default "values". init(values, defaults); }
[ "private", "void", "validate", "(", ")", "{", "// a non-null values object is the flag we use to determine whether", "// to reparse from UIManager.", "if", "(", "values", "!=", "null", ")", "return", ";", "// reconstruct this SeaGlassStyle based on the entries in the UIManager", "// and possibly based on any overrides within the component's", "// client properties (assuming such a component exists and contains", "// any SeaGlass.Overrides)", "values", "=", "new", "Values", "(", ")", ";", "// the profiler revealed that a great deal of CPU time and useless", "// garbage was being produced by this method and the init method. One", "// culprit was the creation and reparsing of the entire UIDefaults", "// map on each call to this method where \"values\" was null. It turns", "// out this was happening a lot.", "// To remove this bottleneck, we store the compiled TreeMaps of defaults", "// in the appContext for reuse. It is nulled whenever the UIDefaults", "// changes and recomputed when necessary.", "final", "AppContext", "ctx", "=", "AppContext", ".", "getAppContext", "(", ")", ";", "// fetch the defaults from the app context. If null, then create and", "// store the compiled defaults", "Map", "<", "String", ",", "TreeMap", "<", "String", ",", "Object", ">", ">", "compiledDefaults", "=", "(", "Map", "<", "String", ",", "TreeMap", "<", "String", ",", "Object", ">", ">", ")", "ctx", ".", "get", "(", "\"SeaGlassStyle.defaults\"", ")", ";", "if", "(", "compiledDefaults", "==", "null", ")", "{", "// the entire UIDefaults tables are parsed and compiled into", "// this map of maps. The key of the compiledDefaults is the", "// prefix for each style, while the value is a map of", "// keys->values for that prefix.", "compiledDefaults", "=", "new", "HashMap", "<", "String", ",", "TreeMap", "<", "String", ",", "Object", ">", ">", "(", ")", ";", "// get all the defaults from UIManager.getDefaults() and put them", "// into the compiledDefaults", "compileDefaults", "(", "compiledDefaults", ",", "UIManager", ".", "getDefaults", "(", ")", ")", ";", "// This second statement pulls defaults from the laf defaults", "UIDefaults", "lafDefaults", "=", "UIManager", ".", "getLookAndFeelDefaults", "(", ")", ";", "compileDefaults", "(", "compiledDefaults", ",", "lafDefaults", ")", ";", "// if it has not already been done, add a listener to both", "// UIManager.getDefaults() and UIManager.getLookAndFeelDefaults().", "PropertyChangeListener", "pcl", "=", "(", "PropertyChangeListener", ")", "ctx", ".", "get", "(", "\"SeaGlassStyle.defaults.pcl\"", ")", ";", "// if pcl is null, then it has not yet been registered with", "// the UIManager defaults for this app context", "if", "(", "pcl", "==", "null", ")", "{", "// create a PCL which will simply clear out the compiled", "// defaults from the app context, causing it to be recomputed", "// on subsequent passes", "pcl", "=", "new", "DefaultsListener", "(", ")", ";", "// add the PCL to both defaults tables that we pay attention", "// to, so that if the UIDefaults are updated, then the", "// precompiled defaults will be cleared from the app context", "// and recomputed on subsequent passes", "UIManager", ".", "getDefaults", "(", ")", ".", "addPropertyChangeListener", "(", "pcl", ")", ";", "UIManager", ".", "getLookAndFeelDefaults", "(", ")", ".", "addPropertyChangeListener", "(", "pcl", ")", ";", "// save the PCL to the app context as a marker indicating", "// that the PCL has been registered so we don't end up adding", "// more than one listener to the UIDefaults tables.", "ctx", ".", "put", "(", "\"SeaGlassStyle.defaults.pcl\"", ",", "pcl", ")", ";", "}", "// store the defaults for reuse", "ctx", ".", "put", "(", "\"SeaGlassStyle.defaults\"", ",", "compiledDefaults", ")", ";", "}", "TreeMap", "<", "String", ",", "Object", ">", "defaults", "=", "compiledDefaults", ".", "get", "(", "prefix", ")", ";", "if", "(", "defaults", "==", "null", ")", "{", "defaults", "=", "new", "TreeMap", "<", "String", ",", "Object", ">", "(", ")", ";", "}", "// inspect the client properties for the key \"SeaGlass.Overrides\". If", "// the", "// value is an instance of UIDefaults, then these defaults are used", "// in place of, or in addition to, the defaults in UIManager.", "if", "(", "component", "!=", "null", ")", "{", "Object", "o", "=", "component", ".", "getClientProperty", "(", "\"SeaGlass.Overrides\"", ")", ";", "if", "(", "o", "instanceof", "UIDefaults", ")", "{", "Object", "i", "=", "component", ".", "getClientProperty", "(", "\"SeaGlass.Overrides.InheritDefaults\"", ")", ";", "boolean", "inherit", "=", "i", "instanceof", "Boolean", "?", "(", "Boolean", ")", "i", ":", "true", ";", "UIDefaults", "d", "=", "(", "UIDefaults", ")", "o", ";", "TreeMap", "<", "String", ",", "Object", ">", "map", "=", "new", "TreeMap", "<", "String", ",", "Object", ">", "(", ")", ";", "for", "(", "Object", "obj", ":", "d", ".", "keySet", "(", ")", ")", "{", "if", "(", "obj", "instanceof", "String", ")", "{", "String", "key", "=", "(", "String", ")", "obj", ";", "if", "(", "key", ".", "startsWith", "(", "prefix", ")", ")", "{", "map", ".", "put", "(", "key", ",", "d", ".", "get", "(", "key", ")", ")", ";", "}", "}", "}", "if", "(", "inherit", ")", "{", "defaults", ".", "putAll", "(", "map", ")", ";", "}", "else", "{", "defaults", "=", "map", ";", "}", "}", "}", "// Now that I've accumulated all the defaults pertaining to this", "// style, call init which will read these defaults and configure", "// the default \"values\".", "init", "(", "values", ",", "defaults", ")", ";", "}" ]
Pulls data out of UIDefaults, if it has not done so already, and sets up the internal state.
[ "Pulls", "data", "out", "of", "UIDefaults", "if", "it", "has", "not", "done", "so", "already", "and", "sets", "up", "the", "internal", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L373-L487
769
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java
SeaGlassStyle.getPainter
private SeaGlassPainter getPainter(TreeMap<String, Object> defaults, String key) { Object p = defaults.get(key); if (p instanceof UIDefaults.LazyValue) { p = ((UIDefaults.LazyValue) p).createValue(UIManager.getDefaults()); } return (p instanceof SeaGlassPainter ? (SeaGlassPainter) p : null); }
java
private SeaGlassPainter getPainter(TreeMap<String, Object> defaults, String key) { Object p = defaults.get(key); if (p instanceof UIDefaults.LazyValue) { p = ((UIDefaults.LazyValue) p).createValue(UIManager.getDefaults()); } return (p instanceof SeaGlassPainter ? (SeaGlassPainter) p : null); }
[ "private", "SeaGlassPainter", "getPainter", "(", "TreeMap", "<", "String", ",", "Object", ">", "defaults", ",", "String", "key", ")", "{", "Object", "p", "=", "defaults", ".", "get", "(", "key", ")", ";", "if", "(", "p", "instanceof", "UIDefaults", ".", "LazyValue", ")", "{", "p", "=", "(", "(", "UIDefaults", ".", "LazyValue", ")", "p", ")", ".", "createValue", "(", "UIManager", ".", "getDefaults", "(", ")", ")", ";", "}", "return", "(", "p", "instanceof", "SeaGlassPainter", "?", "(", "SeaGlassPainter", ")", "p", ":", "null", ")", ";", "}" ]
Determine the painter given the defaults and a key. @param defaults the defaults. @param key the key. @return the painter, if any can be found, {@code null} otherwise.
[ "Determine", "the", "painter", "given", "the", "defaults", "and", "a", "key", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L755-L763
770
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java
SeaGlassStyle.getInsets
@Override public Insets getInsets(SynthContext ctx, Insets in) { if (in == null) { in = new Insets(0, 0, 0, 0); } Values v = getValues(ctx); if (v.contentMargins == null) { in.bottom = in.top = in.left = in.right = 0; return in; } else { in.bottom = v.contentMargins.bottom; in.top = v.contentMargins.top; in.left = v.contentMargins.left; in.right = v.contentMargins.right; // Account for scale // The key "JComponent.sizeVariant" is used to match Apple's LAF String scaleKey = SeaGlassStyle.getSizeVariant(ctx.getComponent()); if (scaleKey != null) { if (LARGE_KEY.equals(scaleKey)) { in.bottom *= LARGE_SCALE; in.top *= LARGE_SCALE; in.left *= LARGE_SCALE; in.right *= LARGE_SCALE; } else if (SMALL_KEY.equals(scaleKey)) { in.bottom *= SMALL_SCALE; in.top *= SMALL_SCALE; in.left *= SMALL_SCALE; in.right *= SMALL_SCALE; } else if (MINI_KEY.equals(scaleKey)) { in.bottom *= MINI_SCALE; in.top *= MINI_SCALE; in.left *= MINI_SCALE; in.right *= MINI_SCALE; } } return in; } }
java
@Override public Insets getInsets(SynthContext ctx, Insets in) { if (in == null) { in = new Insets(0, 0, 0, 0); } Values v = getValues(ctx); if (v.contentMargins == null) { in.bottom = in.top = in.left = in.right = 0; return in; } else { in.bottom = v.contentMargins.bottom; in.top = v.contentMargins.top; in.left = v.contentMargins.left; in.right = v.contentMargins.right; // Account for scale // The key "JComponent.sizeVariant" is used to match Apple's LAF String scaleKey = SeaGlassStyle.getSizeVariant(ctx.getComponent()); if (scaleKey != null) { if (LARGE_KEY.equals(scaleKey)) { in.bottom *= LARGE_SCALE; in.top *= LARGE_SCALE; in.left *= LARGE_SCALE; in.right *= LARGE_SCALE; } else if (SMALL_KEY.equals(scaleKey)) { in.bottom *= SMALL_SCALE; in.top *= SMALL_SCALE; in.left *= SMALL_SCALE; in.right *= SMALL_SCALE; } else if (MINI_KEY.equals(scaleKey)) { in.bottom *= MINI_SCALE; in.top *= MINI_SCALE; in.left *= MINI_SCALE; in.right *= MINI_SCALE; } } return in; } }
[ "@", "Override", "public", "Insets", "getInsets", "(", "SynthContext", "ctx", ",", "Insets", "in", ")", "{", "if", "(", "in", "==", "null", ")", "{", "in", "=", "new", "Insets", "(", "0", ",", "0", ",", "0", ",", "0", ")", ";", "}", "Values", "v", "=", "getValues", "(", "ctx", ")", ";", "if", "(", "v", ".", "contentMargins", "==", "null", ")", "{", "in", ".", "bottom", "=", "in", ".", "top", "=", "in", ".", "left", "=", "in", ".", "right", "=", "0", ";", "return", "in", ";", "}", "else", "{", "in", ".", "bottom", "=", "v", ".", "contentMargins", ".", "bottom", ";", "in", ".", "top", "=", "v", ".", "contentMargins", ".", "top", ";", "in", ".", "left", "=", "v", ".", "contentMargins", ".", "left", ";", "in", ".", "right", "=", "v", ".", "contentMargins", ".", "right", ";", "// Account for scale", "// The key \"JComponent.sizeVariant\" is used to match Apple's LAF", "String", "scaleKey", "=", "SeaGlassStyle", ".", "getSizeVariant", "(", "ctx", ".", "getComponent", "(", ")", ")", ";", "if", "(", "scaleKey", "!=", "null", ")", "{", "if", "(", "LARGE_KEY", ".", "equals", "(", "scaleKey", ")", ")", "{", "in", ".", "bottom", "*=", "LARGE_SCALE", ";", "in", ".", "top", "*=", "LARGE_SCALE", ";", "in", ".", "left", "*=", "LARGE_SCALE", ";", "in", ".", "right", "*=", "LARGE_SCALE", ";", "}", "else", "if", "(", "SMALL_KEY", ".", "equals", "(", "scaleKey", ")", ")", "{", "in", ".", "bottom", "*=", "SMALL_SCALE", ";", "in", ".", "top", "*=", "SMALL_SCALE", ";", "in", ".", "left", "*=", "SMALL_SCALE", ";", "in", ".", "right", "*=", "SMALL_SCALE", ";", "}", "else", "if", "(", "MINI_KEY", ".", "equals", "(", "scaleKey", ")", ")", "{", "in", ".", "bottom", "*=", "MINI_SCALE", ";", "in", ".", "top", "*=", "MINI_SCALE", ";", "in", ".", "left", "*=", "MINI_SCALE", ";", "in", ".", "right", "*=", "MINI_SCALE", ";", "}", "}", "return", "in", ";", "}", "}" ]
Returns the Insets that are used to calculate sizing information. <p>Overridden to cause this style to populate itself with data from UIDefaults, if necessary.</p> @param ctx context SynthContext identifying requester @param in insets Insets to place return value in. @return Sizing Insets.
[ "Returns", "the", "Insets", "that", "are", "used", "to", "calculate", "sizing", "information", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L776-L818
771
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java
SeaGlassStyle.isOpaque
@Override public boolean isOpaque(SynthContext ctx) { // Force Table CellRenderers to be opaque if ("Table.cellRenderer".equals(ctx.getComponent().getName())) { return true; } Boolean opaque = (Boolean) get(ctx, "opaque"); return opaque == null ? false : opaque; }
java
@Override public boolean isOpaque(SynthContext ctx) { // Force Table CellRenderers to be opaque if ("Table.cellRenderer".equals(ctx.getComponent().getName())) { return true; } Boolean opaque = (Boolean) get(ctx, "opaque"); return opaque == null ? false : opaque; }
[ "@", "Override", "public", "boolean", "isOpaque", "(", "SynthContext", "ctx", ")", "{", "// Force Table CellRenderers to be opaque", "if", "(", "\"Table.cellRenderer\"", ".", "equals", "(", "ctx", ".", "getComponent", "(", ")", ".", "getName", "(", ")", ")", ")", "{", "return", "true", ";", "}", "Boolean", "opaque", "=", "(", "Boolean", ")", "get", "(", "ctx", ",", "\"opaque\"", ")", ";", "return", "opaque", "==", "null", "?", "false", ":", "opaque", ";", "}" ]
Returns true if the region is opaque. <p>Overridden to cause this style to populate itself with data from UIDefaults, if necessary. If opacity is not specified in UI defaults, then it defaults to being non-opaque.</p> @param ctx context SynthContext identifying requester @return true if region is opaque.
[ "Returns", "true", "if", "the", "region", "is", "opaque", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L940-L950
772
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java
SeaGlassStyle.get
@Override public Object get(SynthContext ctx, Object key) { Values v = getValues(ctx); // strip off the prefix, if there is one. String fullKey = key.toString(); String partialKey = fullKey.substring(fullKey.indexOf(".") + 1); Object obj = null; int xstate = getExtendedState(ctx, v); // check the cache tmpKey.init(partialKey, xstate); obj = v.cache.get(tmpKey); boolean wasInCache = obj != null; if (!wasInCache) { // Search exact matching states and then lesser matching states RuntimeState s = null; int[] lastIndex = new int[] { -1 }; while (obj == null && (s = getNextState(v.states, lastIndex, xstate)) != null) { obj = s.defaults.get(partialKey); } // Search Region Defaults if (obj == null && v.defaults != null) { obj = v.defaults.get(partialKey); } // return found object // Search UIManager Defaults if (obj == null) obj = UIManager.get(fullKey); // Search Synth Defaults for InputMaps if (obj == null && partialKey.equals("focusInputMap")) { obj = super.get(ctx, fullKey); } // if all we got was a null, store this fact for later use v.cache.put(new CacheKey(partialKey, xstate), obj == null ? NULL : obj); } // return found object return obj == NULL ? null : obj; }
java
@Override public Object get(SynthContext ctx, Object key) { Values v = getValues(ctx); // strip off the prefix, if there is one. String fullKey = key.toString(); String partialKey = fullKey.substring(fullKey.indexOf(".") + 1); Object obj = null; int xstate = getExtendedState(ctx, v); // check the cache tmpKey.init(partialKey, xstate); obj = v.cache.get(tmpKey); boolean wasInCache = obj != null; if (!wasInCache) { // Search exact matching states and then lesser matching states RuntimeState s = null; int[] lastIndex = new int[] { -1 }; while (obj == null && (s = getNextState(v.states, lastIndex, xstate)) != null) { obj = s.defaults.get(partialKey); } // Search Region Defaults if (obj == null && v.defaults != null) { obj = v.defaults.get(partialKey); } // return found object // Search UIManager Defaults if (obj == null) obj = UIManager.get(fullKey); // Search Synth Defaults for InputMaps if (obj == null && partialKey.equals("focusInputMap")) { obj = super.get(ctx, fullKey); } // if all we got was a null, store this fact for later use v.cache.put(new CacheKey(partialKey, xstate), obj == null ? NULL : obj); } // return found object return obj == NULL ? null : obj; }
[ "@", "Override", "public", "Object", "get", "(", "SynthContext", "ctx", ",", "Object", "key", ")", "{", "Values", "v", "=", "getValues", "(", "ctx", ")", ";", "// strip off the prefix, if there is one.", "String", "fullKey", "=", "key", ".", "toString", "(", ")", ";", "String", "partialKey", "=", "fullKey", ".", "substring", "(", "fullKey", ".", "indexOf", "(", "\".\"", ")", "+", "1", ")", ";", "Object", "obj", "=", "null", ";", "int", "xstate", "=", "getExtendedState", "(", "ctx", ",", "v", ")", ";", "// check the cache", "tmpKey", ".", "init", "(", "partialKey", ",", "xstate", ")", ";", "obj", "=", "v", ".", "cache", ".", "get", "(", "tmpKey", ")", ";", "boolean", "wasInCache", "=", "obj", "!=", "null", ";", "if", "(", "!", "wasInCache", ")", "{", "// Search exact matching states and then lesser matching states", "RuntimeState", "s", "=", "null", ";", "int", "[", "]", "lastIndex", "=", "new", "int", "[", "]", "{", "-", "1", "}", ";", "while", "(", "obj", "==", "null", "&&", "(", "s", "=", "getNextState", "(", "v", ".", "states", ",", "lastIndex", ",", "xstate", ")", ")", "!=", "null", ")", "{", "obj", "=", "s", ".", "defaults", ".", "get", "(", "partialKey", ")", ";", "}", "// Search Region Defaults", "if", "(", "obj", "==", "null", "&&", "v", ".", "defaults", "!=", "null", ")", "{", "obj", "=", "v", ".", "defaults", ".", "get", "(", "partialKey", ")", ";", "}", "// return found object", "// Search UIManager Defaults", "if", "(", "obj", "==", "null", ")", "obj", "=", "UIManager", ".", "get", "(", "fullKey", ")", ";", "// Search Synth Defaults for InputMaps", "if", "(", "obj", "==", "null", "&&", "partialKey", ".", "equals", "(", "\"focusInputMap\"", ")", ")", "{", "obj", "=", "super", ".", "get", "(", "ctx", ",", "fullKey", ")", ";", "}", "// if all we got was a null, store this fact for later use", "v", ".", "cache", ".", "put", "(", "new", "CacheKey", "(", "partialKey", ",", "xstate", ")", ",", "obj", "==", "null", "?", "NULL", ":", "obj", ")", ";", "}", "// return found object", "return", "obj", "==", "NULL", "?", "null", ":", "obj", ";", "}" ]
Getter for a region specific style property. <p>Overridden to cause this style to populate itself with data from UIDefaults, if necessary.</p> <p>Properties in UIDefaults may be specified in a chained manner. For example:</p> <pre> background Button.opacity Button.Enabled.foreground Button.Enabled+Selected.background </pre> <p>In this example, suppose you were in the Enabled+Selected state and searched for "foreground". In this case, we first check for Button.Enabled+Selected.foreground, but no such color exists. We then fall back to the next valid state, in this case, Button.Enabled.foreground, and have a match. So we return it.</p> <p>Again, if we were in the state Enabled and looked for "background", we wouldn't find it in Button.Enabled, or in Button, but would at the top level in UIManager. So we return that value.</p> <p>One special note: the "key" passed to this method could be of the form "background" or "Button.background" where "Button" equals the prefix passed to the SeaGlassStyle constructor. In either case, it looks for "background".</p> @param ctx SynthContext identifying requester @param key Property being requested. Must not be null. @return Value of the named property *
[ "Getter", "for", "a", "region", "specific", "style", "property", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L988-L1035
773
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ComboBoxArrowButtonPainter.java
ComboBoxArrowButtonPainter.paintButton
private void paintButton(Graphics2D g, JComponent c, int width, int height) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Shape s = createButtonPath(CornerSize.BORDER, 0, 2, width - 2, height - 4); g.setPaint(getComboBoxButtonBorderPaint(s, type)); g.fill(s); s = createButtonPath(CornerSize.INTERIOR, 1, 3, width - 4, height - 6); g.setPaint(getComboBoxButtonInteriorPaint(s, type)); g.fill(s); }
java
private void paintButton(Graphics2D g, JComponent c, int width, int height) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Shape s = createButtonPath(CornerSize.BORDER, 0, 2, width - 2, height - 4); g.setPaint(getComboBoxButtonBorderPaint(s, type)); g.fill(s); s = createButtonPath(CornerSize.INTERIOR, 1, 3, width - 4, height - 6); g.setPaint(getComboBoxButtonInteriorPaint(s, type)); g.fill(s); }
[ "private", "void", "paintButton", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "g", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_ANTIALIASING", ",", "RenderingHints", ".", "VALUE_ANTIALIAS_ON", ")", ";", "Shape", "s", "=", "createButtonPath", "(", "CornerSize", ".", "BORDER", ",", "0", ",", "2", ",", "width", "-", "2", ",", "height", "-", "4", ")", ";", "g", ".", "setPaint", "(", "getComboBoxButtonBorderPaint", "(", "s", ",", "type", ")", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "s", "=", "createButtonPath", "(", "CornerSize", ".", "INTERIOR", ",", "1", ",", "3", ",", "width", "-", "4", ",", "height", "-", "6", ")", ";", "g", ".", "setPaint", "(", "getComboBoxButtonInteriorPaint", "(", "s", ",", "type", ")", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "}" ]
Paint the button shape. @param g the Graphics2D context to paint with. @param c the component to paint. @param width the width. @param height the height.
[ "Paint", "the", "button", "shape", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ComboBoxArrowButtonPainter.java#L145-L156
774
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/ImageCache.java
ImageCache.getImage
public Image getImage(GraphicsConfiguration config, int w, int h, Object... args) { lock.readLock().lock(); try { PixelCountSoftReference ref = map.get(hash(config, w, h, args)); // check reference has not been lost and the key truly matches, in // case of false positive hash match if (ref != null && ref.equals(config, w, h, args)) { return ref.get(); } else { return null; } } finally { lock.readLock().unlock(); } }
java
public Image getImage(GraphicsConfiguration config, int w, int h, Object... args) { lock.readLock().lock(); try { PixelCountSoftReference ref = map.get(hash(config, w, h, args)); // check reference has not been lost and the key truly matches, in // case of false positive hash match if (ref != null && ref.equals(config, w, h, args)) { return ref.get(); } else { return null; } } finally { lock.readLock().unlock(); } }
[ "public", "Image", "getImage", "(", "GraphicsConfiguration", "config", ",", "int", "w", ",", "int", "h", ",", "Object", "...", "args", ")", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "PixelCountSoftReference", "ref", "=", "map", ".", "get", "(", "hash", "(", "config", ",", "w", ",", "h", ",", "args", ")", ")", ";", "// check reference has not been lost and the key truly matches, in", "// case of false positive hash match", "if", "(", "ref", "!=", "null", "&&", "ref", ".", "equals", "(", "config", ",", "w", ",", "h", ",", "args", ")", ")", "{", "return", "ref", ".", "get", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "finally", "{", "lock", ".", "readLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Get the cached image for given keys @param config The graphics configuration, needed if cached image is a Volatile Image. Used as part of cache key @param w The image width, used as part of cache key @param h The image height, used as part of cache key @param args Other arguments to use as part of the cache key @return Returns the cached Image, or null there is no cached image for key
[ "Get", "the", "cached", "image", "for", "given", "keys" ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/ImageCache.java#L133-L149
775
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/ImageCache.java
ImageCache.setImage
public boolean setImage(Image image, GraphicsConfiguration config, int w, int h, Object... args) { if (!isImageCachable(w, h)) return false; int hash = hash(config, w, h, args); lock.writeLock().lock(); try { PixelCountSoftReference ref = map.get(hash); // check if currently in map if (ref != null && ref.get() == image) { return true; } // clear out old if (ref != null) { currentPixelCount -= ref.pixelCount; map.remove(hash); } // add new image to pixel count int newPixelCount = image.getWidth(null) * image.getHeight(null); currentPixelCount += newPixelCount; // clean out lost references if not enough space if (currentPixelCount > maxPixelCount) { while ((ref = (PixelCountSoftReference) referenceQueue.poll()) != null) { // reference lost map.remove(ref.hash); currentPixelCount -= ref.pixelCount; } } // remove old items till there is enough free space if (currentPixelCount > maxPixelCount) { Iterator<Map.Entry<Integer, PixelCountSoftReference>> mapIter = map.entrySet().iterator(); while ((currentPixelCount > maxPixelCount) && mapIter.hasNext()) { Map.Entry<Integer, PixelCountSoftReference> entry = mapIter.next(); mapIter.remove(); Image img = entry.getValue().get(); if (img != null) img.flush(); currentPixelCount -= entry.getValue().pixelCount; } } // finaly put new in map map.put(hash, new PixelCountSoftReference(image, referenceQueue, newPixelCount, hash, config, w, h, args)); return true; } finally { lock.writeLock().unlock(); } }
java
public boolean setImage(Image image, GraphicsConfiguration config, int w, int h, Object... args) { if (!isImageCachable(w, h)) return false; int hash = hash(config, w, h, args); lock.writeLock().lock(); try { PixelCountSoftReference ref = map.get(hash); // check if currently in map if (ref != null && ref.get() == image) { return true; } // clear out old if (ref != null) { currentPixelCount -= ref.pixelCount; map.remove(hash); } // add new image to pixel count int newPixelCount = image.getWidth(null) * image.getHeight(null); currentPixelCount += newPixelCount; // clean out lost references if not enough space if (currentPixelCount > maxPixelCount) { while ((ref = (PixelCountSoftReference) referenceQueue.poll()) != null) { // reference lost map.remove(ref.hash); currentPixelCount -= ref.pixelCount; } } // remove old items till there is enough free space if (currentPixelCount > maxPixelCount) { Iterator<Map.Entry<Integer, PixelCountSoftReference>> mapIter = map.entrySet().iterator(); while ((currentPixelCount > maxPixelCount) && mapIter.hasNext()) { Map.Entry<Integer, PixelCountSoftReference> entry = mapIter.next(); mapIter.remove(); Image img = entry.getValue().get(); if (img != null) img.flush(); currentPixelCount -= entry.getValue().pixelCount; } } // finaly put new in map map.put(hash, new PixelCountSoftReference(image, referenceQueue, newPixelCount, hash, config, w, h, args)); return true; } finally { lock.writeLock().unlock(); } }
[ "public", "boolean", "setImage", "(", "Image", "image", ",", "GraphicsConfiguration", "config", ",", "int", "w", ",", "int", "h", ",", "Object", "...", "args", ")", "{", "if", "(", "!", "isImageCachable", "(", "w", ",", "h", ")", ")", "return", "false", ";", "int", "hash", "=", "hash", "(", "config", ",", "w", ",", "h", ",", "args", ")", ";", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "PixelCountSoftReference", "ref", "=", "map", ".", "get", "(", "hash", ")", ";", "// check if currently in map", "if", "(", "ref", "!=", "null", "&&", "ref", ".", "get", "(", ")", "==", "image", ")", "{", "return", "true", ";", "}", "// clear out old", "if", "(", "ref", "!=", "null", ")", "{", "currentPixelCount", "-=", "ref", ".", "pixelCount", ";", "map", ".", "remove", "(", "hash", ")", ";", "}", "// add new image to pixel count", "int", "newPixelCount", "=", "image", ".", "getWidth", "(", "null", ")", "*", "image", ".", "getHeight", "(", "null", ")", ";", "currentPixelCount", "+=", "newPixelCount", ";", "// clean out lost references if not enough space", "if", "(", "currentPixelCount", ">", "maxPixelCount", ")", "{", "while", "(", "(", "ref", "=", "(", "PixelCountSoftReference", ")", "referenceQueue", ".", "poll", "(", ")", ")", "!=", "null", ")", "{", "// reference lost", "map", ".", "remove", "(", "ref", ".", "hash", ")", ";", "currentPixelCount", "-=", "ref", ".", "pixelCount", ";", "}", "}", "// remove old items till there is enough free space", "if", "(", "currentPixelCount", ">", "maxPixelCount", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "Integer", ",", "PixelCountSoftReference", ">", ">", "mapIter", "=", "map", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "(", "currentPixelCount", ">", "maxPixelCount", ")", "&&", "mapIter", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "<", "Integer", ",", "PixelCountSoftReference", ">", "entry", "=", "mapIter", ".", "next", "(", ")", ";", "mapIter", ".", "remove", "(", ")", ";", "Image", "img", "=", "entry", ".", "getValue", "(", ")", ".", "get", "(", ")", ";", "if", "(", "img", "!=", "null", ")", "img", ".", "flush", "(", ")", ";", "currentPixelCount", "-=", "entry", ".", "getValue", "(", ")", ".", "pixelCount", ";", "}", "}", "// finaly put new in map", "map", ".", "put", "(", "hash", ",", "new", "PixelCountSoftReference", "(", "image", ",", "referenceQueue", ",", "newPixelCount", ",", "hash", ",", "config", ",", "w", ",", "h", ",", "args", ")", ")", ";", "return", "true", ";", "}", "finally", "{", "lock", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Sets the cached image for the specified constraints. @param image The image to store in cache @param config The graphics configuration, needed if cached image is a Volatile Image. Used as part of cache key @param w The image width, used as part of cache key @param h The image height, used as part of cache key @param args Other arguments to use as part of the cache key @return true if the image could be cached or false if the image is too big
[ "Sets", "the", "cached", "image", "for", "the", "specified", "constraints", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/ImageCache.java#L164-L226
776
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/ImageCache.java
ImageCache.hash
private int hash(GraphicsConfiguration config, int w, int h, Object... args) { int hash; hash = (config != null ? config.hashCode() : 0); hash = 31 * hash + w; hash = 31 * hash + h; hash = 31 * hash + Arrays.deepHashCode(args); return hash; }
java
private int hash(GraphicsConfiguration config, int w, int h, Object... args) { int hash; hash = (config != null ? config.hashCode() : 0); hash = 31 * hash + w; hash = 31 * hash + h; hash = 31 * hash + Arrays.deepHashCode(args); return hash; }
[ "private", "int", "hash", "(", "GraphicsConfiguration", "config", ",", "int", "w", ",", "int", "h", ",", "Object", "...", "args", ")", "{", "int", "hash", ";", "hash", "=", "(", "config", "!=", "null", "?", "config", ".", "hashCode", "(", ")", ":", "0", ")", ";", "hash", "=", "31", "*", "hash", "+", "w", ";", "hash", "=", "31", "*", "hash", "+", "h", ";", "hash", "=", "31", "*", "hash", "+", "Arrays", ".", "deepHashCode", "(", "args", ")", ";", "return", "hash", ";", "}" ]
Create a unique hash from all the input. @param config the graphics configuration. @param w the width. @param h the height. @param args the arguments for the image. @return the hash for the object instance.
[ "Create", "a", "unique", "hash", "from", "all", "the", "input", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/ImageCache.java#L238-L247
777
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassSplitPaneDivider.java
SeaGlassSplitPaneDivider.mapDirection
private int mapDirection(boolean isLeft) { if (isLeft) { if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { return SwingConstants.WEST; } return SwingConstants.NORTH; } if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { return SwingConstants.EAST; } return SwingConstants.SOUTH; }
java
private int mapDirection(boolean isLeft) { if (isLeft) { if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { return SwingConstants.WEST; } return SwingConstants.NORTH; } if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { return SwingConstants.EAST; } return SwingConstants.SOUTH; }
[ "private", "int", "mapDirection", "(", "boolean", "isLeft", ")", "{", "if", "(", "isLeft", ")", "{", "if", "(", "splitPane", ".", "getOrientation", "(", ")", "==", "JSplitPane", ".", "HORIZONTAL_SPLIT", ")", "{", "return", "SwingConstants", ".", "WEST", ";", "}", "return", "SwingConstants", ".", "NORTH", ";", "}", "if", "(", "splitPane", ".", "getOrientation", "(", ")", "==", "JSplitPane", ".", "HORIZONTAL_SPLIT", ")", "{", "return", "SwingConstants", ".", "EAST", ";", "}", "return", "SwingConstants", ".", "SOUTH", ";", "}" ]
Convert the orientation of the pane into compass points based on the pane orientation and the left-right orientation of the containter. @param isLeft {@code true} if the component's container is laid out left-to-right, otherwise {@code false}. @return the compass direction for increasing the divider.
[ "Convert", "the", "orientation", "of", "the", "pane", "into", "compass", "points", "based", "on", "the", "pane", "orientation", "and", "the", "left", "-", "right", "orientation", "of", "the", "containter", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassSplitPaneDivider.java#L157-L172
778
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassSplitPaneDivider.java
SeaGlassSplitPaneDivider.createRightOneTouchButton
protected JButton createRightOneTouchButton() { SeaGlassArrowButton b = new SeaGlassArrowButton(SwingConstants.NORTH); int oneTouchSize = lookupOneTouchSize(); b.setName("SplitPaneDivider.rightOneTouchButton"); b.setMinimumSize(new Dimension(oneTouchSize, oneTouchSize)); // Rossi: Change cursors on "one touch" buttons. Better would be an mouse over effect b.setCursor(Cursor.getPredefinedCursor( splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? Cursor.E_RESIZE_CURSOR:Cursor.S_RESIZE_CURSOR)); b.setFocusPainted(false); b.setBorderPainted(false); b.setRequestFocusEnabled(false); b.setDirection(mapDirection(false)); return b; }
java
protected JButton createRightOneTouchButton() { SeaGlassArrowButton b = new SeaGlassArrowButton(SwingConstants.NORTH); int oneTouchSize = lookupOneTouchSize(); b.setName("SplitPaneDivider.rightOneTouchButton"); b.setMinimumSize(new Dimension(oneTouchSize, oneTouchSize)); // Rossi: Change cursors on "one touch" buttons. Better would be an mouse over effect b.setCursor(Cursor.getPredefinedCursor( splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? Cursor.E_RESIZE_CURSOR:Cursor.S_RESIZE_CURSOR)); b.setFocusPainted(false); b.setBorderPainted(false); b.setRequestFocusEnabled(false); b.setDirection(mapDirection(false)); return b; }
[ "protected", "JButton", "createRightOneTouchButton", "(", ")", "{", "SeaGlassArrowButton", "b", "=", "new", "SeaGlassArrowButton", "(", "SwingConstants", ".", "NORTH", ")", ";", "int", "oneTouchSize", "=", "lookupOneTouchSize", "(", ")", ";", "b", ".", "setName", "(", "\"SplitPaneDivider.rightOneTouchButton\"", ")", ";", "b", ".", "setMinimumSize", "(", "new", "Dimension", "(", "oneTouchSize", ",", "oneTouchSize", ")", ")", ";", "// Rossi: Change cursors on \"one touch\" buttons. Better would be an mouse over effect", "b", ".", "setCursor", "(", "Cursor", ".", "getPredefinedCursor", "(", "splitPane", ".", "getOrientation", "(", ")", "==", "JSplitPane", ".", "HORIZONTAL_SPLIT", "?", "Cursor", ".", "E_RESIZE_CURSOR", ":", "Cursor", ".", "S_RESIZE_CURSOR", ")", ")", ";", "b", ".", "setFocusPainted", "(", "false", ")", ";", "b", ".", "setBorderPainted", "(", "false", ")", ";", "b", ".", "setRequestFocusEnabled", "(", "false", ")", ";", "b", ".", "setDirection", "(", "mapDirection", "(", "false", ")", ")", ";", "return", "b", ";", "}" ]
Creates and return an instance of JButton that can be used to collapse the right component in the split pane. @return a one-touch button
[ "Creates", "and", "return", "an", "instance", "of", "JButton", "that", "can", "be", "used", "to", "collapse", "the", "right", "component", "in", "the", "split", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassSplitPaneDivider.java#L213-L230
779
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/EffectUtils.java
EffectUtils.clearImage
static void clearImage(BufferedImage img) { Graphics2D g2 = img.createGraphics(); g2.setComposite(AlphaComposite.Clear); g2.fillRect(0, 0, img.getWidth(), img.getHeight()); g2.dispose(); }
java
static void clearImage(BufferedImage img) { Graphics2D g2 = img.createGraphics(); g2.setComposite(AlphaComposite.Clear); g2.fillRect(0, 0, img.getWidth(), img.getHeight()); g2.dispose(); }
[ "static", "void", "clearImage", "(", "BufferedImage", "img", ")", "{", "Graphics2D", "g2", "=", "img", ".", "createGraphics", "(", ")", ";", "g2", ".", "setComposite", "(", "AlphaComposite", ".", "Clear", ")", ";", "g2", ".", "fillRect", "(", "0", ",", "0", ",", "img", ".", "getWidth", "(", ")", ",", "img", ".", "getHeight", "(", ")", ")", ";", "g2", ".", "dispose", "(", ")", ";", "}" ]
Clear a transparent image to 100% transparent @param img The image to clear
[ "Clear", "a", "transparent", "image", "to", "100%", "transparent" ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/EffectUtils.java#L45-L51
780
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/EffectUtils.java
EffectUtils.gaussianBlur
static BufferedImage gaussianBlur(BufferedImage src, BufferedImage dst, int radius) { int width = src.getWidth(); int height = src.getHeight(); if (dst == null || dst.getWidth() != width || dst.getHeight() != height || src.getType() != dst.getType()) { dst = createColorModelCompatibleImage(src); } float[] kernel = createGaussianKernel(radius); if (src.getType() == BufferedImage.TYPE_INT_ARGB) { int[] srcPixels = new int[width * height]; int[] dstPixels = new int[width * height]; getPixels(src, 0, 0, width, height, srcPixels); // horizontal pass blur(srcPixels, dstPixels, width, height, kernel, radius); // vertical pass // noinspection SuspiciousNameCombination blur(dstPixels, srcPixels, height, width, kernel, radius); // the result is now stored in srcPixels due to the 2nd pass setPixels(dst, 0, 0, width, height, srcPixels); } else if (src.getType() == BufferedImage.TYPE_BYTE_GRAY) { byte[] srcPixels = new byte[width * height]; byte[] dstPixels = new byte[width * height]; getPixels(src, 0, 0, width, height, srcPixels); // horizontal pass blur(srcPixels, dstPixels, width, height, kernel, radius); // vertical pass // noinspection SuspiciousNameCombination blur(dstPixels, srcPixels, height, width, kernel, radius); // the result is now stored in srcPixels due to the 2nd pass setPixels(dst, 0, 0, width, height, srcPixels); } else { throw new IllegalArgumentException("EffectUtils.gaussianBlur() src image is not a supported type, type=[" + src.getType() + "]"); } return dst; }
java
static BufferedImage gaussianBlur(BufferedImage src, BufferedImage dst, int radius) { int width = src.getWidth(); int height = src.getHeight(); if (dst == null || dst.getWidth() != width || dst.getHeight() != height || src.getType() != dst.getType()) { dst = createColorModelCompatibleImage(src); } float[] kernel = createGaussianKernel(radius); if (src.getType() == BufferedImage.TYPE_INT_ARGB) { int[] srcPixels = new int[width * height]; int[] dstPixels = new int[width * height]; getPixels(src, 0, 0, width, height, srcPixels); // horizontal pass blur(srcPixels, dstPixels, width, height, kernel, radius); // vertical pass // noinspection SuspiciousNameCombination blur(dstPixels, srcPixels, height, width, kernel, radius); // the result is now stored in srcPixels due to the 2nd pass setPixels(dst, 0, 0, width, height, srcPixels); } else if (src.getType() == BufferedImage.TYPE_BYTE_GRAY) { byte[] srcPixels = new byte[width * height]; byte[] dstPixels = new byte[width * height]; getPixels(src, 0, 0, width, height, srcPixels); // horizontal pass blur(srcPixels, dstPixels, width, height, kernel, radius); // vertical pass // noinspection SuspiciousNameCombination blur(dstPixels, srcPixels, height, width, kernel, radius); // the result is now stored in srcPixels due to the 2nd pass setPixels(dst, 0, 0, width, height, srcPixels); } else { throw new IllegalArgumentException("EffectUtils.gaussianBlur() src image is not a supported type, type=[" + src.getType() + "]"); } return dst; }
[ "static", "BufferedImage", "gaussianBlur", "(", "BufferedImage", "src", ",", "BufferedImage", "dst", ",", "int", "radius", ")", "{", "int", "width", "=", "src", ".", "getWidth", "(", ")", ";", "int", "height", "=", "src", ".", "getHeight", "(", ")", ";", "if", "(", "dst", "==", "null", "||", "dst", ".", "getWidth", "(", ")", "!=", "width", "||", "dst", ".", "getHeight", "(", ")", "!=", "height", "||", "src", ".", "getType", "(", ")", "!=", "dst", ".", "getType", "(", ")", ")", "{", "dst", "=", "createColorModelCompatibleImage", "(", "src", ")", ";", "}", "float", "[", "]", "kernel", "=", "createGaussianKernel", "(", "radius", ")", ";", "if", "(", "src", ".", "getType", "(", ")", "==", "BufferedImage", ".", "TYPE_INT_ARGB", ")", "{", "int", "[", "]", "srcPixels", "=", "new", "int", "[", "width", "*", "height", "]", ";", "int", "[", "]", "dstPixels", "=", "new", "int", "[", "width", "*", "height", "]", ";", "getPixels", "(", "src", ",", "0", ",", "0", ",", "width", ",", "height", ",", "srcPixels", ")", ";", "// horizontal pass", "blur", "(", "srcPixels", ",", "dstPixels", ",", "width", ",", "height", ",", "kernel", ",", "radius", ")", ";", "// vertical pass", "// noinspection SuspiciousNameCombination", "blur", "(", "dstPixels", ",", "srcPixels", ",", "height", ",", "width", ",", "kernel", ",", "radius", ")", ";", "// the result is now stored in srcPixels due to the 2nd pass", "setPixels", "(", "dst", ",", "0", ",", "0", ",", "width", ",", "height", ",", "srcPixels", ")", ";", "}", "else", "if", "(", "src", ".", "getType", "(", ")", "==", "BufferedImage", ".", "TYPE_BYTE_GRAY", ")", "{", "byte", "[", "]", "srcPixels", "=", "new", "byte", "[", "width", "*", "height", "]", ";", "byte", "[", "]", "dstPixels", "=", "new", "byte", "[", "width", "*", "height", "]", ";", "getPixels", "(", "src", ",", "0", ",", "0", ",", "width", ",", "height", ",", "srcPixels", ")", ";", "// horizontal pass", "blur", "(", "srcPixels", ",", "dstPixels", ",", "width", ",", "height", ",", "kernel", ",", "radius", ")", ";", "// vertical pass", "// noinspection SuspiciousNameCombination", "blur", "(", "dstPixels", ",", "srcPixels", ",", "height", ",", "width", ",", "kernel", ",", "radius", ")", ";", "// the result is now stored in srcPixels due to the 2nd pass", "setPixels", "(", "dst", ",", "0", ",", "0", ",", "width", ",", "height", ",", "srcPixels", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"EffectUtils.gaussianBlur() src image is not a supported type, type=[\"", "+", "src", ".", "getType", "(", ")", "+", "\"]\"", ")", ";", "}", "return", "dst", ";", "}" ]
Apply Gaussian Blur to Image @param src The image tp @param dst The destination image to draw blured src image into, null if you want a new one created @param radius The blur kernel radius @return The blured image
[ "Apply", "Gaussian", "Blur", "to", "Image" ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/EffectUtils.java#L66-L112
781
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/EffectUtils.java
EffectUtils.createGaussianKernel
protected static float[] createGaussianKernel(int radius) { if (radius < 1) { throw new IllegalArgumentException("Radius must be >= 1"); } float[] data = new float[radius * 2 + 1]; float sigma = radius / 3.0f; float twoSigmaSquare = 2.0f * sigma * sigma; float sigmaRoot = (float) Math.sqrt(twoSigmaSquare * Math.PI); float total = 0.0f; for (int i = -radius; i <= radius; i++) { float distance = i * i; int index = i + radius; data[index] = (float) Math.exp(-distance / twoSigmaSquare) / sigmaRoot; total += data[index]; } for (int i = 0; i < data.length; i++) { data[i] /= total; } return data; }
java
protected static float[] createGaussianKernel(int radius) { if (radius < 1) { throw new IllegalArgumentException("Radius must be >= 1"); } float[] data = new float[radius * 2 + 1]; float sigma = radius / 3.0f; float twoSigmaSquare = 2.0f * sigma * sigma; float sigmaRoot = (float) Math.sqrt(twoSigmaSquare * Math.PI); float total = 0.0f; for (int i = -radius; i <= radius; i++) { float distance = i * i; int index = i + radius; data[index] = (float) Math.exp(-distance / twoSigmaSquare) / sigmaRoot; total += data[index]; } for (int i = 0; i < data.length; i++) { data[i] /= total; } return data; }
[ "protected", "static", "float", "[", "]", "createGaussianKernel", "(", "int", "radius", ")", "{", "if", "(", "radius", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Radius must be >= 1\"", ")", ";", "}", "float", "[", "]", "data", "=", "new", "float", "[", "radius", "*", "2", "+", "1", "]", ";", "float", "sigma", "=", "radius", "/", "3.0f", ";", "float", "twoSigmaSquare", "=", "2.0f", "*", "sigma", "*", "sigma", ";", "float", "sigmaRoot", "=", "(", "float", ")", "Math", ".", "sqrt", "(", "twoSigmaSquare", "*", "Math", ".", "PI", ")", ";", "float", "total", "=", "0.0f", ";", "for", "(", "int", "i", "=", "-", "radius", ";", "i", "<=", "radius", ";", "i", "++", ")", "{", "float", "distance", "=", "i", "*", "i", ";", "int", "index", "=", "i", "+", "radius", ";", "data", "[", "index", "]", "=", "(", "float", ")", "Math", ".", "exp", "(", "-", "distance", "/", "twoSigmaSquare", ")", "/", "sigmaRoot", ";", "total", "+=", "data", "[", "index", "]", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "data", ".", "length", ";", "i", "++", ")", "{", "data", "[", "i", "]", "/=", "total", ";", "}", "return", "data", ";", "}" ]
Create a Gaussian kernel for the transformation. @param radius the kernel radius. @return the Gaussian kernel.
[ "Create", "a", "Gaussian", "kernel", "for", "the", "transformation", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/EffectUtils.java#L234-L259
782
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/CheckBoxPainter.java
CheckBoxPainter.createCheckMark
private Shape createCheckMark(int x, int y, int size) { int markSize = (int) (size * SIZE_MULTIPLIER + 0.5); int markX = x + (int) (size * X_MULTIPLIER + 0.5); int markY = y + (int) (size * Y_MULTIPLIER + 0.5); return shapeGenerator.createCheckMark(markX, markY, markSize, markSize); }
java
private Shape createCheckMark(int x, int y, int size) { int markSize = (int) (size * SIZE_MULTIPLIER + 0.5); int markX = x + (int) (size * X_MULTIPLIER + 0.5); int markY = y + (int) (size * Y_MULTIPLIER + 0.5); return shapeGenerator.createCheckMark(markX, markY, markSize, markSize); }
[ "private", "Shape", "createCheckMark", "(", "int", "x", ",", "int", "y", ",", "int", "size", ")", "{", "int", "markSize", "=", "(", "int", ")", "(", "size", "*", "SIZE_MULTIPLIER", "+", "0.5", ")", ";", "int", "markX", "=", "x", "+", "(", "int", ")", "(", "size", "*", "X_MULTIPLIER", "+", "0.5", ")", ";", "int", "markY", "=", "y", "+", "(", "int", ")", "(", "size", "*", "Y_MULTIPLIER", "+", "0.5", ")", ";", "return", "shapeGenerator", ".", "createCheckMark", "(", "markX", ",", "markY", ",", "markSize", ",", "markSize", ")", ";", "}" ]
Create the check mark shape. @param x the x coordinate of the upper-left corner of the check mark. @param y the y coordinate of the upper-left corner of the check mark. @param size the check mark size in pixels. @return the check mark shape.
[ "Create", "the", "check", "mark", "shape", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/CheckBoxPainter.java#L188-L194
783
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/CheckBoxPainter.java
CheckBoxPainter.getCheckBoxBulletPaint
public Paint getCheckBoxBulletPaint(Shape s, CommonControlState type) { return createCheckMarkGradient(s, getCheckBoxBulletColors(type)); }
java
public Paint getCheckBoxBulletPaint(Shape s, CommonControlState type) { return createCheckMarkGradient(s, getCheckBoxBulletColors(type)); }
[ "public", "Paint", "getCheckBoxBulletPaint", "(", "Shape", "s", ",", "CommonControlState", "type", ")", "{", "return", "createCheckMarkGradient", "(", "s", ",", "getCheckBoxBulletColors", "(", "type", ")", ")", ";", "}" ]
Create the paint for the check mark. @param s the check mark shape. Used for bounds. @param type the color type to create. @return the paint to use for the check mark.
[ "Create", "the", "paint", "for", "the", "check", "mark", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/CheckBoxPainter.java#L204-L206
784
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/CheckBoxPainter.java
CheckBoxPainter.getCheckBoxBulletColors
private TwoColors getCheckBoxBulletColors(CommonControlState type) { switch (type) { case DISABLED: case DISABLED_SELECTED: return buttonbulletDisabled; case ENABLED: case PRESSED: case SELECTED: case PRESSED_SELECTED: return buttonBulletEnabled; } return null; }
java
private TwoColors getCheckBoxBulletColors(CommonControlState type) { switch (type) { case DISABLED: case DISABLED_SELECTED: return buttonbulletDisabled; case ENABLED: case PRESSED: case SELECTED: case PRESSED_SELECTED: return buttonBulletEnabled; } return null; }
[ "private", "TwoColors", "getCheckBoxBulletColors", "(", "CommonControlState", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "DISABLED", ":", "case", "DISABLED_SELECTED", ":", "return", "buttonbulletDisabled", ";", "case", "ENABLED", ":", "case", "PRESSED", ":", "case", "SELECTED", ":", "case", "PRESSED_SELECTED", ":", "return", "buttonBulletEnabled", ";", "}", "return", "null", ";", "}" ]
Get the colors to use for the check mark. @param type the state. @return the color set.
[ "Get", "the", "colors", "to", "use", "for", "the", "check", "mark", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/CheckBoxPainter.java#L215-L230
785
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.getComponentState
private int getComponentState(JComponent c) { if (frame != null) { if (frame.isSelected()) { return SELECTED; } } return SeaGlassLookAndFeel.getComponentState(c); }
java
private int getComponentState(JComponent c) { if (frame != null) { if (frame.isSelected()) { return SELECTED; } } return SeaGlassLookAndFeel.getComponentState(c); }
[ "private", "int", "getComponentState", "(", "JComponent", "c", ")", "{", "if", "(", "frame", "!=", "null", ")", "{", "if", "(", "frame", ".", "isSelected", "(", ")", ")", "{", "return", "SELECTED", ";", "}", "}", "return", "SeaGlassLookAndFeel", ".", "getComponentState", "(", "c", ")", ";", "}" ]
Get the state for the component. @param c the component. @return the state for the component.
[ "Get", "the", "state", "for", "the", "component", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L154-L163
786
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.installTitlePane
private void installTitlePane() { installDefaults(); installListeners(); createActions(); enableActions(); createActionMap(); setLayout(createLayout()); assembleSystemMenu(); createButtons(); addSubComponents(); }
java
private void installTitlePane() { installDefaults(); installListeners(); createActions(); enableActions(); createActionMap(); setLayout(createLayout()); assembleSystemMenu(); createButtons(); addSubComponents(); }
[ "private", "void", "installTitlePane", "(", ")", "{", "installDefaults", "(", ")", ";", "installListeners", "(", ")", ";", "createActions", "(", ")", ";", "enableActions", "(", ")", ";", "createActionMap", "(", ")", ";", "setLayout", "(", "createLayout", "(", ")", ")", ";", "assembleSystemMenu", "(", ")", ";", "createButtons", "(", ")", ";", "addSubComponents", "(", ")", ";", "}" ]
Install the UI and listeners for the title pane.
[ "Install", "the", "UI", "and", "listeners", "for", "the", "title", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L168-L181
787
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.addSubComponents
private void addSubComponents() { menuButton.setName("InternalFrameTitlePane.menuButton"); iconButton.setName("InternalFrameTitlePane.iconifyButton"); maxButton.setName("InternalFrameTitlePane.maximizeButton"); closeButton.setName("InternalFrameTitlePane.closeButton"); add(menuButton); add(iconButton); add(maxButton); add(closeButton); }
java
private void addSubComponents() { menuButton.setName("InternalFrameTitlePane.menuButton"); iconButton.setName("InternalFrameTitlePane.iconifyButton"); maxButton.setName("InternalFrameTitlePane.maximizeButton"); closeButton.setName("InternalFrameTitlePane.closeButton"); add(menuButton); add(iconButton); add(maxButton); add(closeButton); }
[ "private", "void", "addSubComponents", "(", ")", "{", "menuButton", ".", "setName", "(", "\"InternalFrameTitlePane.menuButton\"", ")", ";", "iconButton", ".", "setName", "(", "\"InternalFrameTitlePane.iconifyButton\"", ")", ";", "maxButton", ".", "setName", "(", "\"InternalFrameTitlePane.maximizeButton\"", ")", ";", "closeButton", ".", "setName", "(", "\"InternalFrameTitlePane.closeButton\"", ")", ";", "add", "(", "menuButton", ")", ";", "add", "(", "iconButton", ")", ";", "add", "(", "maxButton", ")", ";", "add", "(", "closeButton", ")", ";", "}" ]
Add the button subcomponents to the title pane.
[ "Add", "the", "button", "subcomponents", "to", "the", "title", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L186-L196
788
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.createActions
private void createActions() { maximizeAction = new MaximizeAction(); iconifyAction = new IconifyAction(); closeAction = new CloseAction(); restoreAction = new RestoreAction(); moveAction = new MoveAction(); sizeAction = new SizeAction(); }
java
private void createActions() { maximizeAction = new MaximizeAction(); iconifyAction = new IconifyAction(); closeAction = new CloseAction(); restoreAction = new RestoreAction(); moveAction = new MoveAction(); sizeAction = new SizeAction(); }
[ "private", "void", "createActions", "(", ")", "{", "maximizeAction", "=", "new", "MaximizeAction", "(", ")", ";", "iconifyAction", "=", "new", "IconifyAction", "(", ")", ";", "closeAction", "=", "new", "CloseAction", "(", ")", ";", "restoreAction", "=", "new", "RestoreAction", "(", ")", ";", "moveAction", "=", "new", "MoveAction", "(", ")", ";", "sizeAction", "=", "new", "SizeAction", "(", ")", ";", "}" ]
Create the actions for the buttons.
[ "Create", "the", "actions", "for", "the", "buttons", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L201-L208
789
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.createActionMap
ActionMap createActionMap() { ActionMap map = new ActionMapUIResource(); map.put("showSystemMenu", new ShowSystemMenuAction(true)); map.put("hideSystemMenu", new ShowSystemMenuAction(false)); return map; }
java
ActionMap createActionMap() { ActionMap map = new ActionMapUIResource(); map.put("showSystemMenu", new ShowSystemMenuAction(true)); map.put("hideSystemMenu", new ShowSystemMenuAction(false)); return map; }
[ "ActionMap", "createActionMap", "(", ")", "{", "ActionMap", "map", "=", "new", "ActionMapUIResource", "(", ")", ";", "map", ".", "put", "(", "\"showSystemMenu\"", ",", "new", "ShowSystemMenuAction", "(", "true", ")", ")", ";", "map", ".", "put", "(", "\"hideSystemMenu\"", ",", "new", "ShowSystemMenuAction", "(", "false", ")", ")", ";", "return", "map", ";", "}" ]
Create the action map for the system menu. @return the action map.
[ "Create", "the", "action", "map", "for", "the", "system", "menu", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L215-L222
790
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.uninstallDefaults
public void uninstallDefaults() { SeaGlassContext context = getContext(this, ENABLED); style.uninstallDefaults(context); context.dispose(); style = null; JInternalFrame.JDesktopIcon di = frame.getDesktopIcon(); if (di != null && di.getComponentPopupMenu() == systemPopupMenu) { // Release link to systemMenu from the JInternalFrame di.setComponentPopupMenu(null); } }
java
public void uninstallDefaults() { SeaGlassContext context = getContext(this, ENABLED); style.uninstallDefaults(context); context.dispose(); style = null; JInternalFrame.JDesktopIcon di = frame.getDesktopIcon(); if (di != null && di.getComponentPopupMenu() == systemPopupMenu) { // Release link to systemMenu from the JInternalFrame di.setComponentPopupMenu(null); } }
[ "public", "void", "uninstallDefaults", "(", ")", "{", "SeaGlassContext", "context", "=", "getContext", "(", "this", ",", "ENABLED", ")", ";", "style", ".", "uninstallDefaults", "(", "context", ")", ";", "context", ".", "dispose", "(", ")", ";", "style", "=", "null", ";", "JInternalFrame", ".", "JDesktopIcon", "di", "=", "frame", ".", "getDesktopIcon", "(", ")", ";", "if", "(", "di", "!=", "null", "&&", "di", ".", "getComponentPopupMenu", "(", ")", "==", "systemPopupMenu", ")", "{", "// Release link to systemMenu from the JInternalFrame", "di", ".", "setComponentPopupMenu", "(", "null", ")", ";", "}", "}" ]
Uninstall the defaults.
[ "Uninstall", "the", "defaults", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L258-L271
791
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.createButtons
private void createButtons() { iconButton = new NoFocusButton("InternalFrameTitlePane.iconifyButtonAccessibleName"); iconButton.addActionListener(iconifyAction); if (iconButtonToolTip != null && iconButtonToolTip.length() != 0) { iconButton.setToolTipText(iconButtonToolTip); } maxButton = new NoFocusButton("InternalFrameTitlePane.maximizeButtonAccessibleName"); maxButton.addActionListener(maximizeAction); closeButton = new NoFocusButton("InternalFrameTitlePane.closeButtonAccessibleName"); closeButton.addActionListener(closeAction); if (closeButtonToolTip != null && closeButtonToolTip.length() != 0) { closeButton.setToolTipText(closeButtonToolTip); } setButtonTooltips(); }
java
private void createButtons() { iconButton = new NoFocusButton("InternalFrameTitlePane.iconifyButtonAccessibleName"); iconButton.addActionListener(iconifyAction); if (iconButtonToolTip != null && iconButtonToolTip.length() != 0) { iconButton.setToolTipText(iconButtonToolTip); } maxButton = new NoFocusButton("InternalFrameTitlePane.maximizeButtonAccessibleName"); maxButton.addActionListener(maximizeAction); closeButton = new NoFocusButton("InternalFrameTitlePane.closeButtonAccessibleName"); closeButton.addActionListener(closeAction); if (closeButtonToolTip != null && closeButtonToolTip.length() != 0) { closeButton.setToolTipText(closeButtonToolTip); } setButtonTooltips(); }
[ "private", "void", "createButtons", "(", ")", "{", "iconButton", "=", "new", "NoFocusButton", "(", "\"InternalFrameTitlePane.iconifyButtonAccessibleName\"", ")", ";", "iconButton", ".", "addActionListener", "(", "iconifyAction", ")", ";", "if", "(", "iconButtonToolTip", "!=", "null", "&&", "iconButtonToolTip", ".", "length", "(", ")", "!=", "0", ")", "{", "iconButton", ".", "setToolTipText", "(", "iconButtonToolTip", ")", ";", "}", "maxButton", "=", "new", "NoFocusButton", "(", "\"InternalFrameTitlePane.maximizeButtonAccessibleName\"", ")", ";", "maxButton", ".", "addActionListener", "(", "maximizeAction", ")", ";", "closeButton", "=", "new", "NoFocusButton", "(", "\"InternalFrameTitlePane.closeButtonAccessibleName\"", ")", ";", "closeButton", ".", "addActionListener", "(", "closeAction", ")", ";", "if", "(", "closeButtonToolTip", "!=", "null", "&&", "closeButtonToolTip", ".", "length", "(", ")", "!=", "0", ")", "{", "closeButton", ".", "setToolTipText", "(", "closeButtonToolTip", ")", ";", "}", "setButtonTooltips", "(", ")", ";", "}" ]
Create the buttons and add action listeners.
[ "Create", "the", "buttons", "and", "add", "action", "listeners", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L294-L313
792
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.setButtonTooltips
private void setButtonTooltips() { if (frame.isIcon()) { if (restoreButtonToolTip != null && restoreButtonToolTip.length() != 0) { iconButton.setToolTipText(restoreButtonToolTip); } if (maxButtonToolTip != null && maxButtonToolTip.length() != 0) { maxButton.setToolTipText(maxButtonToolTip); } } else if (frame.isMaximum()) { if (iconButtonToolTip != null && iconButtonToolTip.length() != 0) { iconButton.setToolTipText(iconButtonToolTip); } if (restoreButtonToolTip != null && restoreButtonToolTip.length() != 0) { maxButton.setToolTipText(restoreButtonToolTip); } } else { if (iconButtonToolTip != null && iconButtonToolTip.length() != 0) { iconButton.setToolTipText(iconButtonToolTip); } if (maxButtonToolTip != null && maxButtonToolTip.length() != 0) { maxButton.setToolTipText(maxButtonToolTip); } } }
java
private void setButtonTooltips() { if (frame.isIcon()) { if (restoreButtonToolTip != null && restoreButtonToolTip.length() != 0) { iconButton.setToolTipText(restoreButtonToolTip); } if (maxButtonToolTip != null && maxButtonToolTip.length() != 0) { maxButton.setToolTipText(maxButtonToolTip); } } else if (frame.isMaximum()) { if (iconButtonToolTip != null && iconButtonToolTip.length() != 0) { iconButton.setToolTipText(iconButtonToolTip); } if (restoreButtonToolTip != null && restoreButtonToolTip.length() != 0) { maxButton.setToolTipText(restoreButtonToolTip); } } else { if (iconButtonToolTip != null && iconButtonToolTip.length() != 0) { iconButton.setToolTipText(iconButtonToolTip); } if (maxButtonToolTip != null && maxButtonToolTip.length() != 0) { maxButton.setToolTipText(maxButtonToolTip); } } }
[ "private", "void", "setButtonTooltips", "(", ")", "{", "if", "(", "frame", ".", "isIcon", "(", ")", ")", "{", "if", "(", "restoreButtonToolTip", "!=", "null", "&&", "restoreButtonToolTip", ".", "length", "(", ")", "!=", "0", ")", "{", "iconButton", ".", "setToolTipText", "(", "restoreButtonToolTip", ")", ";", "}", "if", "(", "maxButtonToolTip", "!=", "null", "&&", "maxButtonToolTip", ".", "length", "(", ")", "!=", "0", ")", "{", "maxButton", ".", "setToolTipText", "(", "maxButtonToolTip", ")", ";", "}", "}", "else", "if", "(", "frame", ".", "isMaximum", "(", ")", ")", "{", "if", "(", "iconButtonToolTip", "!=", "null", "&&", "iconButtonToolTip", ".", "length", "(", ")", "!=", "0", ")", "{", "iconButton", ".", "setToolTipText", "(", "iconButtonToolTip", ")", ";", "}", "if", "(", "restoreButtonToolTip", "!=", "null", "&&", "restoreButtonToolTip", ".", "length", "(", ")", "!=", "0", ")", "{", "maxButton", ".", "setToolTipText", "(", "restoreButtonToolTip", ")", ";", "}", "}", "else", "{", "if", "(", "iconButtonToolTip", "!=", "null", "&&", "iconButtonToolTip", ".", "length", "(", ")", "!=", "0", ")", "{", "iconButton", ".", "setToolTipText", "(", "iconButtonToolTip", ")", ";", "}", "if", "(", "maxButtonToolTip", "!=", "null", "&&", "maxButtonToolTip", ".", "length", "(", ")", "!=", "0", ")", "{", "maxButton", ".", "setToolTipText", "(", "maxButtonToolTip", ")", ";", "}", "}", "}" ]
Set the buttons' tooltip text.
[ "Set", "the", "buttons", "tooltip", "text", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L318-L347
793
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.assembleSystemMenu
private void assembleSystemMenu() { systemPopupMenu = new JPopupMenuUIResource(); addSystemMenuItems(systemPopupMenu); enableActions(); menuButton = new NoFocusButton("InternalFrameTitlePane.menuButtonAccessibleName"); updateMenuIcon(); menuButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { try { frame.setSelected(true); } catch (PropertyVetoException pve) { } showSystemMenu(); } }); JPopupMenu p = frame.getComponentPopupMenu(); if (p == null || p instanceof UIResource) { frame.setComponentPopupMenu(systemPopupMenu); } if (frame.getDesktopIcon() != null) { p = frame.getDesktopIcon().getComponentPopupMenu(); if (p == null || p instanceof UIResource) { frame.getDesktopIcon().setComponentPopupMenu(systemPopupMenu); } } setInheritsPopupMenu(true); }
java
private void assembleSystemMenu() { systemPopupMenu = new JPopupMenuUIResource(); addSystemMenuItems(systemPopupMenu); enableActions(); menuButton = new NoFocusButton("InternalFrameTitlePane.menuButtonAccessibleName"); updateMenuIcon(); menuButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { try { frame.setSelected(true); } catch (PropertyVetoException pve) { } showSystemMenu(); } }); JPopupMenu p = frame.getComponentPopupMenu(); if (p == null || p instanceof UIResource) { frame.setComponentPopupMenu(systemPopupMenu); } if (frame.getDesktopIcon() != null) { p = frame.getDesktopIcon().getComponentPopupMenu(); if (p == null || p instanceof UIResource) { frame.getDesktopIcon().setComponentPopupMenu(systemPopupMenu); } } setInheritsPopupMenu(true); }
[ "private", "void", "assembleSystemMenu", "(", ")", "{", "systemPopupMenu", "=", "new", "JPopupMenuUIResource", "(", ")", ";", "addSystemMenuItems", "(", "systemPopupMenu", ")", ";", "enableActions", "(", ")", ";", "menuButton", "=", "new", "NoFocusButton", "(", "\"InternalFrameTitlePane.menuButtonAccessibleName\"", ")", ";", "updateMenuIcon", "(", ")", ";", "menuButton", ".", "addMouseListener", "(", "new", "MouseAdapter", "(", ")", "{", "public", "void", "mousePressed", "(", "MouseEvent", "e", ")", "{", "try", "{", "frame", ".", "setSelected", "(", "true", ")", ";", "}", "catch", "(", "PropertyVetoException", "pve", ")", "{", "}", "showSystemMenu", "(", ")", ";", "}", "}", ")", ";", "JPopupMenu", "p", "=", "frame", ".", "getComponentPopupMenu", "(", ")", ";", "if", "(", "p", "==", "null", "||", "p", "instanceof", "UIResource", ")", "{", "frame", ".", "setComponentPopupMenu", "(", "systemPopupMenu", ")", ";", "}", "if", "(", "frame", ".", "getDesktopIcon", "(", ")", "!=", "null", ")", "{", "p", "=", "frame", ".", "getDesktopIcon", "(", ")", ".", "getComponentPopupMenu", "(", ")", ";", "if", "(", "p", "==", "null", "||", "p", "instanceof", "UIResource", ")", "{", "frame", ".", "getDesktopIcon", "(", ")", ".", "setComponentPopupMenu", "(", "systemPopupMenu", ")", ";", "}", "}", "setInheritsPopupMenu", "(", "true", ")", ";", "}" ]
Create the system menu.
[ "Create", "the", "system", "menu", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L352-L384
794
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.addSystemMenuItems
private void addSystemMenuItems(JPopupMenu menu) { // PENDING: this should all be localizable! JMenuItem mi = (JMenuItem) menu.add(restoreAction); mi.setMnemonic('R'); mi = (JMenuItem) menu.add(moveAction); mi.setMnemonic('M'); mi = (JMenuItem) menu.add(sizeAction); mi.setMnemonic('S'); mi = (JMenuItem) menu.add(iconifyAction); mi.setMnemonic('n'); mi = (JMenuItem) menu.add(maximizeAction); mi.setMnemonic('x'); menu.add(new JSeparator()); mi = (JMenuItem) menu.add(closeAction); mi.setMnemonic('C'); }
java
private void addSystemMenuItems(JPopupMenu menu) { // PENDING: this should all be localizable! JMenuItem mi = (JMenuItem) menu.add(restoreAction); mi.setMnemonic('R'); mi = (JMenuItem) menu.add(moveAction); mi.setMnemonic('M'); mi = (JMenuItem) menu.add(sizeAction); mi.setMnemonic('S'); mi = (JMenuItem) menu.add(iconifyAction); mi.setMnemonic('n'); mi = (JMenuItem) menu.add(maximizeAction); mi.setMnemonic('x'); menu.add(new JSeparator()); mi = (JMenuItem) menu.add(closeAction); mi.setMnemonic('C'); }
[ "private", "void", "addSystemMenuItems", "(", "JPopupMenu", "menu", ")", "{", "// PENDING: this should all be localizable!", "JMenuItem", "mi", "=", "(", "JMenuItem", ")", "menu", ".", "add", "(", "restoreAction", ")", ";", "mi", ".", "setMnemonic", "(", "'", "'", ")", ";", "mi", "=", "(", "JMenuItem", ")", "menu", ".", "add", "(", "moveAction", ")", ";", "mi", ".", "setMnemonic", "(", "'", "'", ")", ";", "mi", "=", "(", "JMenuItem", ")", "menu", ".", "add", "(", "sizeAction", ")", ";", "mi", ".", "setMnemonic", "(", "'", "'", ")", ";", "mi", "=", "(", "JMenuItem", ")", "menu", ".", "add", "(", "iconifyAction", ")", ";", "mi", ".", "setMnemonic", "(", "'", "'", ")", ";", "mi", "=", "(", "JMenuItem", ")", "menu", ".", "add", "(", "maximizeAction", ")", ";", "mi", ".", "setMnemonic", "(", "'", "'", ")", ";", "menu", ".", "add", "(", "new", "JSeparator", "(", ")", ")", ";", "mi", "=", "(", "JMenuItem", ")", "menu", ".", "add", "(", "closeAction", ")", ";", "mi", ".", "setMnemonic", "(", "'", "'", ")", ";", "}" ]
Add the items to the system menu. @param menu the system menu popup.
[ "Add", "the", "items", "to", "the", "system", "menu", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L391-L407
795
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.createLayout
private LayoutManager createLayout() { SeaGlassContext context = getContext(this); LayoutManager lm = (LayoutManager) style.get(context, "InternalFrameTitlePane.titlePaneLayout"); context.dispose(); return (lm != null) ? lm : new SeaGlassTitlePaneLayout(); }
java
private LayoutManager createLayout() { SeaGlassContext context = getContext(this); LayoutManager lm = (LayoutManager) style.get(context, "InternalFrameTitlePane.titlePaneLayout"); context.dispose(); return (lm != null) ? lm : new SeaGlassTitlePaneLayout(); }
[ "private", "LayoutManager", "createLayout", "(", ")", "{", "SeaGlassContext", "context", "=", "getContext", "(", "this", ")", ";", "LayoutManager", "lm", "=", "(", "LayoutManager", ")", "style", ".", "get", "(", "context", ",", "\"InternalFrameTitlePane.titlePaneLayout\"", ")", ";", "context", ".", "dispose", "(", ")", ";", "return", "(", "lm", "!=", "null", ")", "?", "lm", ":", "new", "SeaGlassTitlePaneLayout", "(", ")", ";", "}" ]
Create the layout manager for the title pane. @return the layout manager.
[ "Create", "the", "layout", "manager", "for", "the", "title", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L541-L548
796
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java
SeaGlassInternalFrameTitlePane.postClosingEvent
protected void postClosingEvent(JInternalFrame frame) { InternalFrameEvent e = new InternalFrameEvent(frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING); // Try posting event, unless there's a SecurityManager. if (JInternalFrame.class.getClassLoader() == null) { try { Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e); return; } catch (SecurityException se) { // Use dispatchEvent instead. } } frame.dispatchEvent(e); }
java
protected void postClosingEvent(JInternalFrame frame) { InternalFrameEvent e = new InternalFrameEvent(frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING); // Try posting event, unless there's a SecurityManager. if (JInternalFrame.class.getClassLoader() == null) { try { Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e); return; } catch (SecurityException se) { // Use dispatchEvent instead. } } frame.dispatchEvent(e); }
[ "protected", "void", "postClosingEvent", "(", "JInternalFrame", "frame", ")", "{", "InternalFrameEvent", "e", "=", "new", "InternalFrameEvent", "(", "frame", ",", "InternalFrameEvent", ".", "INTERNAL_FRAME_CLOSING", ")", ";", "// Try posting event, unless there's a SecurityManager.", "if", "(", "JInternalFrame", ".", "class", ".", "getClassLoader", "(", ")", "==", "null", ")", "{", "try", "{", "Toolkit", ".", "getDefaultToolkit", "(", ")", ".", "getSystemEventQueue", "(", ")", ".", "postEvent", "(", "e", ")", ";", "return", ";", "}", "catch", "(", "SecurityException", "se", ")", "{", "// Use dispatchEvent instead.", "}", "}", "frame", ".", "dispatchEvent", "(", "e", ")", ";", "}" ]
Post a WINDOW_CLOSING-like event to the frame, so that it can be treated like a regular Frame. @param frame the internal frame to be closed.
[ "Post", "a", "WINDOW_CLOSING", "-", "like", "event", "to", "the", "frame", "so", "that", "it", "can", "be", "treated", "like", "a", "regular", "Frame", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L644-L660
797
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/Effect.java
Effect.fill
public void fill(Graphics2D g, Shape s) { Rectangle bounds = s.getBounds(); int width = bounds.width; int height = bounds.height; BufferedImage bimage = Effect.createBufferedImage(width, height, true); Graphics2D gbi = bimage.createGraphics(); gbi.setColor(Color.BLACK); gbi.fill(s); g.drawImage(applyEffect(bimage, null, width, height), 0, 0, null); }
java
public void fill(Graphics2D g, Shape s) { Rectangle bounds = s.getBounds(); int width = bounds.width; int height = bounds.height; BufferedImage bimage = Effect.createBufferedImage(width, height, true); Graphics2D gbi = bimage.createGraphics(); gbi.setColor(Color.BLACK); gbi.fill(s); g.drawImage(applyEffect(bimage, null, width, height), 0, 0, null); }
[ "public", "void", "fill", "(", "Graphics2D", "g", ",", "Shape", "s", ")", "{", "Rectangle", "bounds", "=", "s", ".", "getBounds", "(", ")", ";", "int", "width", "=", "bounds", ".", "width", ";", "int", "height", "=", "bounds", ".", "height", ";", "BufferedImage", "bimage", "=", "Effect", ".", "createBufferedImage", "(", "width", ",", "height", ",", "true", ")", ";", "Graphics2D", "gbi", "=", "bimage", ".", "createGraphics", "(", ")", ";", "gbi", ".", "setColor", "(", "Color", ".", "BLACK", ")", ";", "gbi", ".", "fill", "(", "s", ")", ";", "g", ".", "drawImage", "(", "applyEffect", "(", "bimage", ",", "null", ",", "width", ",", "height", ")", ",", "0", ",", "0", ",", "null", ")", ";", "}" ]
Paint the effect based around a solid shape in the graphics supplied. @param g the graphics to paint into. @param s the shape to base the effect around.
[ "Paint", "the", "effect", "based", "around", "a", "solid", "shape", "in", "the", "graphics", "supplied", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/Effect.java#L104-L116
798
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/Effect.java
Effect.createBufferedImage
protected static BufferedImage createBufferedImage(int width, int height, boolean hasAlpha) { BufferedImage bimage = null; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); try { // Determine the type of transparency of the new buffered image int transparency = Transparency.OPAQUE; if (hasAlpha) { transparency = Transparency.TRANSLUCENT; } // Create the buffered image GraphicsDevice gs = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gs.getDefaultConfiguration(); bimage = gc.createCompatibleImage(width, height, transparency); } catch (HeadlessException e) { // The system does not have a screen } if (bimage == null) { // Create a buffered image using the default color model int type = BufferedImage.TYPE_INT_RGB; if (hasAlpha) { type = BufferedImage.TYPE_INT_ARGB; } bimage = new BufferedImage(width, height, type); } return bimage; }
java
protected static BufferedImage createBufferedImage(int width, int height, boolean hasAlpha) { BufferedImage bimage = null; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); try { // Determine the type of transparency of the new buffered image int transparency = Transparency.OPAQUE; if (hasAlpha) { transparency = Transparency.TRANSLUCENT; } // Create the buffered image GraphicsDevice gs = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gs.getDefaultConfiguration(); bimage = gc.createCompatibleImage(width, height, transparency); } catch (HeadlessException e) { // The system does not have a screen } if (bimage == null) { // Create a buffered image using the default color model int type = BufferedImage.TYPE_INT_RGB; if (hasAlpha) { type = BufferedImage.TYPE_INT_ARGB; } bimage = new BufferedImage(width, height, type); } return bimage; }
[ "protected", "static", "BufferedImage", "createBufferedImage", "(", "int", "width", ",", "int", "height", ",", "boolean", "hasAlpha", ")", "{", "BufferedImage", "bimage", "=", "null", ";", "GraphicsEnvironment", "ge", "=", "GraphicsEnvironment", ".", "getLocalGraphicsEnvironment", "(", ")", ";", "try", "{", "// Determine the type of transparency of the new buffered image", "int", "transparency", "=", "Transparency", ".", "OPAQUE", ";", "if", "(", "hasAlpha", ")", "{", "transparency", "=", "Transparency", ".", "TRANSLUCENT", ";", "}", "// Create the buffered image", "GraphicsDevice", "gs", "=", "ge", ".", "getDefaultScreenDevice", "(", ")", ";", "GraphicsConfiguration", "gc", "=", "gs", ".", "getDefaultConfiguration", "(", ")", ";", "bimage", "=", "gc", ".", "createCompatibleImage", "(", "width", ",", "height", ",", "transparency", ")", ";", "}", "catch", "(", "HeadlessException", "e", ")", "{", "// The system does not have a screen", "}", "if", "(", "bimage", "==", "null", ")", "{", "// Create a buffered image using the default color model", "int", "type", "=", "BufferedImage", ".", "TYPE_INT_RGB", ";", "if", "(", "hasAlpha", ")", "{", "type", "=", "BufferedImage", ".", "TYPE_INT_ARGB", ";", "}", "bimage", "=", "new", "BufferedImage", "(", "width", ",", "height", ",", "type", ")", ";", "}", "return", "bimage", ";", "}" ]
Create a buffered image of the given width and height, compatible with the alpha requirement. @param width the width of the new buffered image. @param height the height of the new buffered image. @param hasAlpha {@code true} if the new buffered image needs to support alpha transparency, {@code false} otherwise. @return the newly created buffered image.
[ "Create", "a", "buffered", "image", "of", "the", "given", "width", "and", "height", "compatible", "with", "the", "alpha", "requirement", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/Effect.java#L146-L181
799
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/effect/Effect.java
Effect.toBufferedImage
protected static BufferedImage toBufferedImage(Image image) { if (image instanceof BufferedImage) { return (BufferedImage) image; } // This code ensures that all the pixels in the image are loaded image = new ImageIcon(image).getImage(); // Determine if the image has transparent pixels; for this method's // implementation, see e661 Determining If an Image Has Transparent // Pixels boolean hasAlpha = hasAlpha(image); // Create a buffered image with a format that's compatible with the // screen BufferedImage bimage = null; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); try { // Determine the type of transparency of the new buffered image int transparency = Transparency.OPAQUE; if (hasAlpha) { transparency = Transparency.BITMASK; } // Create the buffered image GraphicsDevice gs = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gs.getDefaultConfiguration(); bimage = gc.createCompatibleImage(image.getWidth(null), image.getHeight(null), transparency); } catch (HeadlessException e) { // The system does not have a screen } if (bimage == null) { // Create a buffered image using the default color model int type = BufferedImage.TYPE_INT_RGB; if (hasAlpha) { type = BufferedImage.TYPE_INT_ARGB; } bimage = new BufferedImage(image.getWidth(null), image.getHeight(null), type); } // Copy image to buffered image Graphics g = bimage.createGraphics(); // Paint the image onto the buffered image g.drawImage(image, 0, 0, null); g.dispose(); return bimage; }
java
protected static BufferedImage toBufferedImage(Image image) { if (image instanceof BufferedImage) { return (BufferedImage) image; } // This code ensures that all the pixels in the image are loaded image = new ImageIcon(image).getImage(); // Determine if the image has transparent pixels; for this method's // implementation, see e661 Determining If an Image Has Transparent // Pixels boolean hasAlpha = hasAlpha(image); // Create a buffered image with a format that's compatible with the // screen BufferedImage bimage = null; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); try { // Determine the type of transparency of the new buffered image int transparency = Transparency.OPAQUE; if (hasAlpha) { transparency = Transparency.BITMASK; } // Create the buffered image GraphicsDevice gs = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gs.getDefaultConfiguration(); bimage = gc.createCompatibleImage(image.getWidth(null), image.getHeight(null), transparency); } catch (HeadlessException e) { // The system does not have a screen } if (bimage == null) { // Create a buffered image using the default color model int type = BufferedImage.TYPE_INT_RGB; if (hasAlpha) { type = BufferedImage.TYPE_INT_ARGB; } bimage = new BufferedImage(image.getWidth(null), image.getHeight(null), type); } // Copy image to buffered image Graphics g = bimage.createGraphics(); // Paint the image onto the buffered image g.drawImage(image, 0, 0, null); g.dispose(); return bimage; }
[ "protected", "static", "BufferedImage", "toBufferedImage", "(", "Image", "image", ")", "{", "if", "(", "image", "instanceof", "BufferedImage", ")", "{", "return", "(", "BufferedImage", ")", "image", ";", "}", "// This code ensures that all the pixels in the image are loaded", "image", "=", "new", "ImageIcon", "(", "image", ")", ".", "getImage", "(", ")", ";", "// Determine if the image has transparent pixels; for this method's", "// implementation, see e661 Determining If an Image Has Transparent", "// Pixels", "boolean", "hasAlpha", "=", "hasAlpha", "(", "image", ")", ";", "// Create a buffered image with a format that's compatible with the", "// screen", "BufferedImage", "bimage", "=", "null", ";", "GraphicsEnvironment", "ge", "=", "GraphicsEnvironment", ".", "getLocalGraphicsEnvironment", "(", ")", ";", "try", "{", "// Determine the type of transparency of the new buffered image", "int", "transparency", "=", "Transparency", ".", "OPAQUE", ";", "if", "(", "hasAlpha", ")", "{", "transparency", "=", "Transparency", ".", "BITMASK", ";", "}", "// Create the buffered image", "GraphicsDevice", "gs", "=", "ge", ".", "getDefaultScreenDevice", "(", ")", ";", "GraphicsConfiguration", "gc", "=", "gs", ".", "getDefaultConfiguration", "(", ")", ";", "bimage", "=", "gc", ".", "createCompatibleImage", "(", "image", ".", "getWidth", "(", "null", ")", ",", "image", ".", "getHeight", "(", "null", ")", ",", "transparency", ")", ";", "}", "catch", "(", "HeadlessException", "e", ")", "{", "// The system does not have a screen", "}", "if", "(", "bimage", "==", "null", ")", "{", "// Create a buffered image using the default color model", "int", "type", "=", "BufferedImage", ".", "TYPE_INT_RGB", ";", "if", "(", "hasAlpha", ")", "{", "type", "=", "BufferedImage", ".", "TYPE_INT_ARGB", ";", "}", "bimage", "=", "new", "BufferedImage", "(", "image", ".", "getWidth", "(", "null", ")", ",", "image", ".", "getHeight", "(", "null", ")", ",", "type", ")", ";", "}", "// Copy image to buffered image", "Graphics", "g", "=", "bimage", ".", "createGraphics", "(", ")", ";", "// Paint the image onto the buffered image", "g", ".", "drawImage", "(", "image", ",", "0", ",", "0", ",", "null", ")", ";", "g", ".", "dispose", "(", ")", ";", "return", "bimage", ";", "}" ]
This method returns a buffered image with the contents of an image @param image the image to copy into a buffered image. @return the buffered image containing the image.
[ "This", "method", "returns", "a", "buffered", "image", "with", "the", "contents", "of", "an", "image" ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/Effect.java#L190-L246