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
800
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/titlepaneforegound/TitlePaneButtonForegroundPainter.java
TitlePaneButtonForegroundPainter.paintEnabled
public void paintEnabled(Graphics2D g, JComponent c, int width, int height) { paint(g, c, width, height, enabledBorder, enabledCorner, enabledInterior); }
java
public void paintEnabled(Graphics2D g, JComponent c, int width, int height) { paint(g, c, width, height, enabledBorder, enabledCorner, enabledInterior); }
[ "public", "void", "paintEnabled", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "paint", "(", "g", ",", "c", ",", "width", ",", "height", ",", "enabledBorder", ",", "enabledCorner", ",", "enabledInterior", ")", ";", "}" ]
Paint the enabled state of the button foreground. @param g the Graphics2D context to paint with. @param c the button to paint. @param width the width to paint. @param height the height to paint.
[ "Paint", "the", "enabled", "state", "of", "the", "button", "foreground", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/titlepaneforegound/TitlePaneButtonForegroundPainter.java#L34-L36
801
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/titlepaneforegound/TitlePaneButtonForegroundPainter.java
TitlePaneButtonForegroundPainter.paintHover
public void paintHover(Graphics2D g, JComponent c, int width, int height) { paint(g, c, width, height, hoverBorder, hoverCorner, hoverInterior); }
java
public void paintHover(Graphics2D g, JComponent c, int width, int height) { paint(g, c, width, height, hoverBorder, hoverCorner, hoverInterior); }
[ "public", "void", "paintHover", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "paint", "(", "g", ",", "c", ",", "width", ",", "height", ",", "hoverBorder", ",", "hoverCorner", ",", "hoverInterior", ")", ";", "}" ]
Paint the mouse-over state of the button foreground. @param g the Graphics2D context to paint with. @param c the button to paint. @param width the width to paint. @param height the height to paint.
[ "Paint", "the", "mouse", "-", "over", "state", "of", "the", "button", "foreground", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/titlepaneforegound/TitlePaneButtonForegroundPainter.java#L46-L48
802
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/titlepaneforegound/TitlePaneButtonForegroundPainter.java
TitlePaneButtonForegroundPainter.paintPressed
public void paintPressed(Graphics2D g, JComponent c, int width, int height) { paint(g, c, width, height, pressedBorder, pressedCorner, pressedInterior); }
java
public void paintPressed(Graphics2D g, JComponent c, int width, int height) { paint(g, c, width, height, pressedBorder, pressedCorner, pressedInterior); }
[ "public", "void", "paintPressed", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "paint", "(", "g", ",", "c", ",", "width", ",", "height", ",", "pressedBorder", ",", "pressedCorner", ",", "pressedInterior", ")", ";", "}" ]
Paint the pressed state of the button foreground. @param g the Graphics2D context to paint with. @param c the button to paint. @param width the width to paint. @param height the height to paint.
[ "Paint", "the", "pressed", "state", "of", "the", "button", "foreground", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/titlepaneforegound/TitlePaneButtonForegroundPainter.java#L58-L60
803
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java
TitlePaneIconifyButtonPainter.paintMinimizeEnabled
private void paintMinimizeEnabled(Graphics2D g, JComponent c, int width, int height) { iconifyPainter.paintEnabled(g, c, width, height); }
java
private void paintMinimizeEnabled(Graphics2D g, JComponent c, int width, int height) { iconifyPainter.paintEnabled(g, c, width, height); }
[ "private", "void", "paintMinimizeEnabled", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "iconifyPainter", ".", "paintEnabled", "(", "g", ",", "c", ",", "width", ",", "height", ")", ";", "}" ]
Paint the foreground minimized button enabled state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "foreground", "minimized", "button", "enabled", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L171-L173
804
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java
TitlePaneIconifyButtonPainter.paintMinimizeHover
private void paintMinimizeHover(Graphics2D g, JComponent c, int width, int height) { iconifyPainter.paintHover(g, c, width, height); }
java
private void paintMinimizeHover(Graphics2D g, JComponent c, int width, int height) { iconifyPainter.paintHover(g, c, width, height); }
[ "private", "void", "paintMinimizeHover", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "iconifyPainter", ".", "paintHover", "(", "g", ",", "c", ",", "width", ",", "height", ")", ";", "}" ]
Paint the foreground minimized button mouse-over state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "foreground", "minimized", "button", "mouse", "-", "over", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L183-L185
805
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java
TitlePaneIconifyButtonPainter.paintMinimizePressed
private void paintMinimizePressed(Graphics2D g, JComponent c, int width, int height) { iconifyPainter.paintPressed(g, c, width, height); }
java
private void paintMinimizePressed(Graphics2D g, JComponent c, int width, int height) { iconifyPainter.paintPressed(g, c, width, height); }
[ "private", "void", "paintMinimizePressed", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "iconifyPainter", ".", "paintPressed", "(", "g", ",", "c", ",", "width", ",", "height", ")", ";", "}" ]
Paint the foreground minimize button pressed state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "foreground", "minimize", "button", "pressed", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L195-L197
806
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java
TitlePaneIconifyButtonPainter.paintRestoreEnabled
private void paintRestoreEnabled(Graphics2D g, JComponent c, int width, int height) { restorePainter.paintEnabled(g, c, width, height); }
java
private void paintRestoreEnabled(Graphics2D g, JComponent c, int width, int height) { restorePainter.paintEnabled(g, c, width, height); }
[ "private", "void", "paintRestoreEnabled", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "restorePainter", ".", "paintEnabled", "(", "g", ",", "c", ",", "width", ",", "height", ")", ";", "}" ]
Paint the foreground restore button enabled state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "foreground", "restore", "button", "enabled", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L207-L209
807
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java
TitlePaneIconifyButtonPainter.paintRestoreHover
private void paintRestoreHover(Graphics2D g, JComponent c, int width, int height) { restorePainter.paintHover(g, c, width, height); }
java
private void paintRestoreHover(Graphics2D g, JComponent c, int width, int height) { restorePainter.paintHover(g, c, width, height); }
[ "private", "void", "paintRestoreHover", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "restorePainter", ".", "paintHover", "(", "g", ",", "c", ",", "width", ",", "height", ")", ";", "}" ]
Paint the foreground restore button mouse-over state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "foreground", "restore", "button", "mouse", "-", "over", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L219-L221
808
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java
TitlePaneIconifyButtonPainter.paintRestorePressed
private void paintRestorePressed(Graphics2D g, JComponent c, int width, int height) { restorePainter.paintPressed(g, c, width, height); }
java
private void paintRestorePressed(Graphics2D g, JComponent c, int width, int height) { restorePainter.paintPressed(g, c, width, height); }
[ "private", "void", "paintRestorePressed", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "restorePainter", ".", "paintPressed", "(", "g", ",", "c", ",", "width", ",", "height", ")", ";", "}" ]
Paint the foreground restore button pressed state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "foreground", "restore", "button", "pressed", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L231-L233
809
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TableHeaderRendererPainter.java
TableHeaderRendererPainter.getButtonType
private CommonControlState getButtonType(Which state) { switch (state) { case BACKGROUND_DISABLED: return CommonControlState.DISABLED; case BACKGROUND_ENABLED: return CommonControlState.ENABLED; case BACKGROUND_ENABLED_FOCUSED: return CommonControlState.ENABLED; case BACKGROUND_PRESSED: return CommonControlState.PRESSED; case BACKGROUND_ENABLED_SORTED: return CommonControlState.ENABLED; case BACKGROUND_ENABLED_FOCUSED_SORTED: return CommonControlState.ENABLED; case BACKGROUND_DISABLED_SORTED: return CommonControlState.DISABLED; } return null; }
java
private CommonControlState getButtonType(Which state) { switch (state) { case BACKGROUND_DISABLED: return CommonControlState.DISABLED; case BACKGROUND_ENABLED: return CommonControlState.ENABLED; case BACKGROUND_ENABLED_FOCUSED: return CommonControlState.ENABLED; case BACKGROUND_PRESSED: return CommonControlState.PRESSED; case BACKGROUND_ENABLED_SORTED: return CommonControlState.ENABLED; case BACKGROUND_ENABLED_FOCUSED_SORTED: return CommonControlState.ENABLED; case BACKGROUND_DISABLED_SORTED: return CommonControlState.DISABLED; } return null; }
[ "private", "CommonControlState", "getButtonType", "(", "Which", "state", ")", "{", "switch", "(", "state", ")", "{", "case", "BACKGROUND_DISABLED", ":", "return", "CommonControlState", ".", "DISABLED", ";", "case", "BACKGROUND_ENABLED", ":", "return", "CommonControlState", ".", "ENABLED", ";", "case", "BACKGROUND_ENABLED_FOCUSED", ":", "return", "CommonControlState", ".", "ENABLED", ";", "case", "BACKGROUND_PRESSED", ":", "return", "CommonControlState", ".", "PRESSED", ";", "case", "BACKGROUND_ENABLED_SORTED", ":", "return", "CommonControlState", ".", "ENABLED", ";", "case", "BACKGROUND_ENABLED_FOCUSED_SORTED", ":", "return", "CommonControlState", ".", "ENABLED", ";", "case", "BACKGROUND_DISABLED_SORTED", ":", "return", "CommonControlState", ".", "DISABLED", ";", "}", "return", "null", ";", "}" ]
Get the common state from the specific state. @param state the state. @return the common state.
[ "Get", "the", "common", "state", "from", "the", "specific", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TableHeaderRendererPainter.java#L111-L137
810
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java
SeaGlassTextFieldUI.updateSearchStyle
private void updateSearchStyle(JTextComponent c, SeaGlassContext context, String prefix) { searchIconWidth = 0; Object o = style.get(context, prefix + ".searchIconWidth"); if (o != null && o instanceof Integer) { searchIconWidth = (Integer) o; } popupIconWidth = 0; o = style.get(context, prefix + ".popupIconWidth"); if (o != null && o instanceof Integer) { popupIconWidth = (Integer) o; } cancelIconWidth = 0; o = style.get(context, prefix + ".cancelIconWidth"); if (o != null && o instanceof Integer) { cancelIconWidth = (Integer) o; } searchLeftInnerMargin = 0; o = style.get(context, prefix + ".searchLeftInnerMargin"); if (o != null && o instanceof Integer) { searchLeftInnerMargin = (Integer) o; } searchRightInnerMargin = 0; o = style.get(context, prefix + ".searchRightInnerMargin"); if (o != null && o instanceof Integer) { searchRightInnerMargin = (Integer) o; } placeholderColor = Color.GRAY; o = style.get(context, "placeholderTextColor"); if (o != null && o instanceof Color) { placeholderColor = (Color) o; } Border border = c.getBorder(); if (border == null || border instanceof UIResource && !(border instanceof TextFieldBorder)) { c.setBorder(createTextFieldBorder(context)); } if (isSearchField.isInState(c)) { o = c.getClientProperty("JTextField.Search.PlaceholderText"); if (o != null && o instanceof String) { placeholderText = (String) o; } else if (placeholderText != null) { placeholderText = null; } o = c.getClientProperty("JTextField.Search.FindAction"); if (o != null && o instanceof ActionListener) { if (findAction == null) { findAction = (ActionListener) o; } } o = c.getClientProperty("JTextField.Search.FindPopup"); if (o != null && o instanceof JPopupMenu) { if (findPopup == null) { findPopup = (JPopupMenu) o; } } o = c.getClientProperty("JTextField.Search.CancelAction"); if (o != null && o instanceof ActionListener) { if (cancelAction == null) { cancelAction = (ActionListener) o; } } installMouseListeners(); } else { placeholderText = null; if (findAction != null) { findAction = null; } if (findPopup != null) { findPopup = null; } if (cancelAction != null) { cancelAction = null; } uninstallMouseListeners(); } }
java
private void updateSearchStyle(JTextComponent c, SeaGlassContext context, String prefix) { searchIconWidth = 0; Object o = style.get(context, prefix + ".searchIconWidth"); if (o != null && o instanceof Integer) { searchIconWidth = (Integer) o; } popupIconWidth = 0; o = style.get(context, prefix + ".popupIconWidth"); if (o != null && o instanceof Integer) { popupIconWidth = (Integer) o; } cancelIconWidth = 0; o = style.get(context, prefix + ".cancelIconWidth"); if (o != null && o instanceof Integer) { cancelIconWidth = (Integer) o; } searchLeftInnerMargin = 0; o = style.get(context, prefix + ".searchLeftInnerMargin"); if (o != null && o instanceof Integer) { searchLeftInnerMargin = (Integer) o; } searchRightInnerMargin = 0; o = style.get(context, prefix + ".searchRightInnerMargin"); if (o != null && o instanceof Integer) { searchRightInnerMargin = (Integer) o; } placeholderColor = Color.GRAY; o = style.get(context, "placeholderTextColor"); if (o != null && o instanceof Color) { placeholderColor = (Color) o; } Border border = c.getBorder(); if (border == null || border instanceof UIResource && !(border instanceof TextFieldBorder)) { c.setBorder(createTextFieldBorder(context)); } if (isSearchField.isInState(c)) { o = c.getClientProperty("JTextField.Search.PlaceholderText"); if (o != null && o instanceof String) { placeholderText = (String) o; } else if (placeholderText != null) { placeholderText = null; } o = c.getClientProperty("JTextField.Search.FindAction"); if (o != null && o instanceof ActionListener) { if (findAction == null) { findAction = (ActionListener) o; } } o = c.getClientProperty("JTextField.Search.FindPopup"); if (o != null && o instanceof JPopupMenu) { if (findPopup == null) { findPopup = (JPopupMenu) o; } } o = c.getClientProperty("JTextField.Search.CancelAction"); if (o != null && o instanceof ActionListener) { if (cancelAction == null) { cancelAction = (ActionListener) o; } } installMouseListeners(); } else { placeholderText = null; if (findAction != null) { findAction = null; } if (findPopup != null) { findPopup = null; } if (cancelAction != null) { cancelAction = null; } uninstallMouseListeners(); } }
[ "private", "void", "updateSearchStyle", "(", "JTextComponent", "c", ",", "SeaGlassContext", "context", ",", "String", "prefix", ")", "{", "searchIconWidth", "=", "0", ";", "Object", "o", "=", "style", ".", "get", "(", "context", ",", "prefix", "+", "\".searchIconWidth\"", ")", ";", "if", "(", "o", "!=", "null", "&&", "o", "instanceof", "Integer", ")", "{", "searchIconWidth", "=", "(", "Integer", ")", "o", ";", "}", "popupIconWidth", "=", "0", ";", "o", "=", "style", ".", "get", "(", "context", ",", "prefix", "+", "\".popupIconWidth\"", ")", ";", "if", "(", "o", "!=", "null", "&&", "o", "instanceof", "Integer", ")", "{", "popupIconWidth", "=", "(", "Integer", ")", "o", ";", "}", "cancelIconWidth", "=", "0", ";", "o", "=", "style", ".", "get", "(", "context", ",", "prefix", "+", "\".cancelIconWidth\"", ")", ";", "if", "(", "o", "!=", "null", "&&", "o", "instanceof", "Integer", ")", "{", "cancelIconWidth", "=", "(", "Integer", ")", "o", ";", "}", "searchLeftInnerMargin", "=", "0", ";", "o", "=", "style", ".", "get", "(", "context", ",", "prefix", "+", "\".searchLeftInnerMargin\"", ")", ";", "if", "(", "o", "!=", "null", "&&", "o", "instanceof", "Integer", ")", "{", "searchLeftInnerMargin", "=", "(", "Integer", ")", "o", ";", "}", "searchRightInnerMargin", "=", "0", ";", "o", "=", "style", ".", "get", "(", "context", ",", "prefix", "+", "\".searchRightInnerMargin\"", ")", ";", "if", "(", "o", "!=", "null", "&&", "o", "instanceof", "Integer", ")", "{", "searchRightInnerMargin", "=", "(", "Integer", ")", "o", ";", "}", "placeholderColor", "=", "Color", ".", "GRAY", ";", "o", "=", "style", ".", "get", "(", "context", ",", "\"placeholderTextColor\"", ")", ";", "if", "(", "o", "!=", "null", "&&", "o", "instanceof", "Color", ")", "{", "placeholderColor", "=", "(", "Color", ")", "o", ";", "}", "Border", "border", "=", "c", ".", "getBorder", "(", ")", ";", "if", "(", "border", "==", "null", "||", "border", "instanceof", "UIResource", "&&", "!", "(", "border", "instanceof", "TextFieldBorder", ")", ")", "{", "c", ".", "setBorder", "(", "createTextFieldBorder", "(", "context", ")", ")", ";", "}", "if", "(", "isSearchField", ".", "isInState", "(", "c", ")", ")", "{", "o", "=", "c", ".", "getClientProperty", "(", "\"JTextField.Search.PlaceholderText\"", ")", ";", "if", "(", "o", "!=", "null", "&&", "o", "instanceof", "String", ")", "{", "placeholderText", "=", "(", "String", ")", "o", ";", "}", "else", "if", "(", "placeholderText", "!=", "null", ")", "{", "placeholderText", "=", "null", ";", "}", "o", "=", "c", ".", "getClientProperty", "(", "\"JTextField.Search.FindAction\"", ")", ";", "if", "(", "o", "!=", "null", "&&", "o", "instanceof", "ActionListener", ")", "{", "if", "(", "findAction", "==", "null", ")", "{", "findAction", "=", "(", "ActionListener", ")", "o", ";", "}", "}", "o", "=", "c", ".", "getClientProperty", "(", "\"JTextField.Search.FindPopup\"", ")", ";", "if", "(", "o", "!=", "null", "&&", "o", "instanceof", "JPopupMenu", ")", "{", "if", "(", "findPopup", "==", "null", ")", "{", "findPopup", "=", "(", "JPopupMenu", ")", "o", ";", "}", "}", "o", "=", "c", ".", "getClientProperty", "(", "\"JTextField.Search.CancelAction\"", ")", ";", "if", "(", "o", "!=", "null", "&&", "o", "instanceof", "ActionListener", ")", "{", "if", "(", "cancelAction", "==", "null", ")", "{", "cancelAction", "=", "(", "ActionListener", ")", "o", ";", "}", "}", "installMouseListeners", "(", ")", ";", "}", "else", "{", "placeholderText", "=", "null", ";", "if", "(", "findAction", "!=", "null", ")", "{", "findAction", "=", "null", ";", "}", "if", "(", "findPopup", "!=", "null", ")", "{", "findPopup", "=", "null", ";", "}", "if", "(", "cancelAction", "!=", "null", ")", "{", "cancelAction", "=", "null", ";", "}", "uninstallMouseListeners", "(", ")", ";", "}", "}" ]
Sea Glass code to support the search JTextField.variant. @param c the JTextField component. @param context the SeaGlassContext. @param prefix the control prefix, e.g. "TextField", "FormattedTextField", or "PasswordField".
[ "Sea", "Glass", "code", "to", "support", "the", "search", "JTextField", ".", "variant", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java#L166-L257
811
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java
SeaGlassTextFieldUI.updateStyle
static void updateStyle(JTextComponent c, SeaGlassContext context, String prefix) { SeaGlassStyle style = (SeaGlassStyle) context.getStyle(); Color color = c.getCaretColor(); if (color == null || color instanceof UIResource) { c.setCaretColor((Color) style.get(context, prefix + ".caretForeground")); } Color fg = c.getForeground(); if (fg == null || fg instanceof UIResource) { fg = style.getColorForState(context, ColorType.TEXT_FOREGROUND); if (fg != null) { c.setForeground(fg); } } Object ar = style.get(context, prefix + ".caretAspectRatio"); if (ar instanceof Number) { c.putClientProperty("caretAspectRatio", ar); } context.setComponentState(SELECTED | FOCUSED); Color s = c.getSelectionColor(); if (s == null || s instanceof UIResource) { c.setSelectionColor(style.getColor(context, ColorType.TEXT_BACKGROUND)); } Color sfg = c.getSelectedTextColor(); if (sfg == null || sfg instanceof UIResource) { c.setSelectedTextColor(style.getColor(context, ColorType.TEXT_FOREGROUND)); } context.setComponentState(DISABLED); Color dfg = c.getDisabledTextColor(); if (dfg == null || dfg instanceof UIResource) { c.setDisabledTextColor(style.getColor(context, ColorType.TEXT_FOREGROUND)); } Insets margin = c.getMargin(); if (margin == null || margin instanceof UIResource) { margin = (Insets) style.get(context, prefix + ".margin"); if (margin == null) { // Some places assume margins are non-null. margin = SeaGlassLookAndFeel.EMPTY_UIRESOURCE_INSETS; } c.setMargin(margin); } Caret caret = c.getCaret(); if (caret instanceof UIResource) { Object o = style.get(context, prefix + ".caretBlinkRate"); if (o != null && o instanceof Integer) { Integer rate = (Integer) o; caret.setBlinkRate(rate.intValue()); } } }
java
static void updateStyle(JTextComponent c, SeaGlassContext context, String prefix) { SeaGlassStyle style = (SeaGlassStyle) context.getStyle(); Color color = c.getCaretColor(); if (color == null || color instanceof UIResource) { c.setCaretColor((Color) style.get(context, prefix + ".caretForeground")); } Color fg = c.getForeground(); if (fg == null || fg instanceof UIResource) { fg = style.getColorForState(context, ColorType.TEXT_FOREGROUND); if (fg != null) { c.setForeground(fg); } } Object ar = style.get(context, prefix + ".caretAspectRatio"); if (ar instanceof Number) { c.putClientProperty("caretAspectRatio", ar); } context.setComponentState(SELECTED | FOCUSED); Color s = c.getSelectionColor(); if (s == null || s instanceof UIResource) { c.setSelectionColor(style.getColor(context, ColorType.TEXT_BACKGROUND)); } Color sfg = c.getSelectedTextColor(); if (sfg == null || sfg instanceof UIResource) { c.setSelectedTextColor(style.getColor(context, ColorType.TEXT_FOREGROUND)); } context.setComponentState(DISABLED); Color dfg = c.getDisabledTextColor(); if (dfg == null || dfg instanceof UIResource) { c.setDisabledTextColor(style.getColor(context, ColorType.TEXT_FOREGROUND)); } Insets margin = c.getMargin(); if (margin == null || margin instanceof UIResource) { margin = (Insets) style.get(context, prefix + ".margin"); if (margin == null) { // Some places assume margins are non-null. margin = SeaGlassLookAndFeel.EMPTY_UIRESOURCE_INSETS; } c.setMargin(margin); } Caret caret = c.getCaret(); if (caret instanceof UIResource) { Object o = style.get(context, prefix + ".caretBlinkRate"); if (o != null && o instanceof Integer) { Integer rate = (Integer) o; caret.setBlinkRate(rate.intValue()); } } }
[ "static", "void", "updateStyle", "(", "JTextComponent", "c", ",", "SeaGlassContext", "context", ",", "String", "prefix", ")", "{", "SeaGlassStyle", "style", "=", "(", "SeaGlassStyle", ")", "context", ".", "getStyle", "(", ")", ";", "Color", "color", "=", "c", ".", "getCaretColor", "(", ")", ";", "if", "(", "color", "==", "null", "||", "color", "instanceof", "UIResource", ")", "{", "c", ".", "setCaretColor", "(", "(", "Color", ")", "style", ".", "get", "(", "context", ",", "prefix", "+", "\".caretForeground\"", ")", ")", ";", "}", "Color", "fg", "=", "c", ".", "getForeground", "(", ")", ";", "if", "(", "fg", "==", "null", "||", "fg", "instanceof", "UIResource", ")", "{", "fg", "=", "style", ".", "getColorForState", "(", "context", ",", "ColorType", ".", "TEXT_FOREGROUND", ")", ";", "if", "(", "fg", "!=", "null", ")", "{", "c", ".", "setForeground", "(", "fg", ")", ";", "}", "}", "Object", "ar", "=", "style", ".", "get", "(", "context", ",", "prefix", "+", "\".caretAspectRatio\"", ")", ";", "if", "(", "ar", "instanceof", "Number", ")", "{", "c", ".", "putClientProperty", "(", "\"caretAspectRatio\"", ",", "ar", ")", ";", "}", "context", ".", "setComponentState", "(", "SELECTED", "|", "FOCUSED", ")", ";", "Color", "s", "=", "c", ".", "getSelectionColor", "(", ")", ";", "if", "(", "s", "==", "null", "||", "s", "instanceof", "UIResource", ")", "{", "c", ".", "setSelectionColor", "(", "style", ".", "getColor", "(", "context", ",", "ColorType", ".", "TEXT_BACKGROUND", ")", ")", ";", "}", "Color", "sfg", "=", "c", ".", "getSelectedTextColor", "(", ")", ";", "if", "(", "sfg", "==", "null", "||", "sfg", "instanceof", "UIResource", ")", "{", "c", ".", "setSelectedTextColor", "(", "style", ".", "getColor", "(", "context", ",", "ColorType", ".", "TEXT_FOREGROUND", ")", ")", ";", "}", "context", ".", "setComponentState", "(", "DISABLED", ")", ";", "Color", "dfg", "=", "c", ".", "getDisabledTextColor", "(", ")", ";", "if", "(", "dfg", "==", "null", "||", "dfg", "instanceof", "UIResource", ")", "{", "c", ".", "setDisabledTextColor", "(", "style", ".", "getColor", "(", "context", ",", "ColorType", ".", "TEXT_FOREGROUND", ")", ")", ";", "}", "Insets", "margin", "=", "c", ".", "getMargin", "(", ")", ";", "if", "(", "margin", "==", "null", "||", "margin", "instanceof", "UIResource", ")", "{", "margin", "=", "(", "Insets", ")", "style", ".", "get", "(", "context", ",", "prefix", "+", "\".margin\"", ")", ";", "if", "(", "margin", "==", "null", ")", "{", "// Some places assume margins are non-null.", "margin", "=", "SeaGlassLookAndFeel", ".", "EMPTY_UIRESOURCE_INSETS", ";", "}", "c", ".", "setMargin", "(", "margin", ")", ";", "}", "Caret", "caret", "=", "c", ".", "getCaret", "(", ")", ";", "if", "(", "caret", "instanceof", "UIResource", ")", "{", "Object", "o", "=", "style", ".", "get", "(", "context", ",", "prefix", "+", "\".caretBlinkRate\"", ")", ";", "if", "(", "o", "!=", "null", "&&", "o", "instanceof", "Integer", ")", "{", "Integer", "rate", "=", "(", "Integer", ")", "o", ";", "caret", ".", "setBlinkRate", "(", "rate", ".", "intValue", "(", ")", ")", ";", "}", "}", "}" ]
Private method to update styles. @param c the JTextField component. @param context the SeaGlassContext. @param prefix the control prefix, e.g. "TextField", "FormattedTextField", or "PasswordField".
[ "Private", "method", "to", "update", "styles", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java#L267-L336
812
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java
SeaGlassTextFieldUI.getPlaceholderText
private String getPlaceholderText(Graphics g, int availTextWidth) { JTextComponent c = getComponent(); FontMetrics fm = SwingUtilities2.getFontMetrics(c, g); return SwingUtilities2.clipStringIfNecessary(c, fm, placeholderText, availTextWidth); }
java
private String getPlaceholderText(Graphics g, int availTextWidth) { JTextComponent c = getComponent(); FontMetrics fm = SwingUtilities2.getFontMetrics(c, g); return SwingUtilities2.clipStringIfNecessary(c, fm, placeholderText, availTextWidth); }
[ "private", "String", "getPlaceholderText", "(", "Graphics", "g", ",", "int", "availTextWidth", ")", "{", "JTextComponent", "c", "=", "getComponent", "(", ")", ";", "FontMetrics", "fm", "=", "SwingUtilities2", ".", "getFontMetrics", "(", "c", ",", "g", ")", ";", "return", "SwingUtilities2", ".", "clipStringIfNecessary", "(", "c", ",", "fm", ",", "placeholderText", ",", "availTextWidth", ")", ";", "}" ]
Get the placeholder text, clipped if necessary. @param g fm the font metrics to compute size with. @param availTextWidth the available space to display the title in. @return the text, clipped to fit the available space.
[ "Get", "the", "placeholder", "text", "clipped", "if", "necessary", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java#L513-L518
813
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createRectangle
public Shape createRectangle(final int x, final int y, final int w, final int h) { return createRoundRectangleInternal(x, y, w, h, 0, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.SQUARE); }
java
public Shape createRectangle(final int x, final int y, final int w, final int h) { return createRoundRectangleInternal(x, y, w, h, 0, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.SQUARE); }
[ "public", "Shape", "createRectangle", "(", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "w", ",", "final", "int", "h", ")", "{", "return", "createRoundRectangleInternal", "(", "x", ",", "y", ",", "w", ",", "h", ",", "0", ",", "CornerStyle", ".", "SQUARE", ",", "CornerStyle", ".", "SQUARE", ",", "CornerStyle", ".", "SQUARE", ",", "CornerStyle", ".", "SQUARE", ")", ";", "}" ]
Return a path for a rectangle with square corners. @param x the X coordinate of the upper-left corner of the rectangle @param y the Y coordinate of the upper-left corner of the rectangle @param w the width of the rectangle @param h the height of the rectangle @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "rectangle", "with", "square", "corners", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L194-L196
814
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createRoundRectangle
public Shape createRoundRectangle(final int x, final int y, final int w, final int h, final CornerSize size) { return createRoundRectangle(x, y, w, h, size, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.ROUNDED); }
java
public Shape createRoundRectangle(final int x, final int y, final int w, final int h, final CornerSize size) { return createRoundRectangle(x, y, w, h, size, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.ROUNDED); }
[ "public", "Shape", "createRoundRectangle", "(", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "w", ",", "final", "int", "h", ",", "final", "CornerSize", "size", ")", "{", "return", "createRoundRectangle", "(", "x", ",", "y", ",", "w", ",", "h", ",", "size", ",", "CornerStyle", ".", "ROUNDED", ",", "CornerStyle", ".", "ROUNDED", ",", "CornerStyle", ".", "ROUNDED", ",", "CornerStyle", ".", "ROUNDED", ")", ";", "}" ]
Return a path for a rectangle with rounded corners. @param x the X coordinate of the upper-left corner of the rectangle @param y the Y coordinate of the upper-left corner of the rectangle @param w the width of the rectangle @param h the height of the rectangle @param size the CornerSize value representing the amount of rounding @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "rectangle", "with", "rounded", "corners", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L209-L211
815
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createCheckMark
public Shape createCheckMark(final int x, final int y, final int w, final int h) { double xf = w / 12.0; double hf = h / 12.0; path.reset(); path.moveTo(x, y + 7.0 * hf); path.lineTo(x + 2.0 * xf, y + 7.0 * hf); path.lineTo(x + 4.75 * xf, y + 10.0 * hf); path.lineTo(x + 9.0 * xf, y); path.lineTo(x + 11.0 * xf, y); path.lineTo(x + 5.0 * xf, y + 12.0 * hf); path.closePath(); return path; }
java
public Shape createCheckMark(final int x, final int y, final int w, final int h) { double xf = w / 12.0; double hf = h / 12.0; path.reset(); path.moveTo(x, y + 7.0 * hf); path.lineTo(x + 2.0 * xf, y + 7.0 * hf); path.lineTo(x + 4.75 * xf, y + 10.0 * hf); path.lineTo(x + 9.0 * xf, y); path.lineTo(x + 11.0 * xf, y); path.lineTo(x + 5.0 * xf, y + 12.0 * hf); path.closePath(); return path; }
[ "public", "Shape", "createCheckMark", "(", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "w", ",", "final", "int", "h", ")", "{", "double", "xf", "=", "w", "/", "12.0", ";", "double", "hf", "=", "h", "/", "12.0", ";", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "x", ",", "y", "+", "7.0", "*", "hf", ")", ";", "path", ".", "lineTo", "(", "x", "+", "2.0", "*", "xf", ",", "y", "+", "7.0", "*", "hf", ")", ";", "path", ".", "lineTo", "(", "x", "+", "4.75", "*", "xf", ",", "y", "+", "10.0", "*", "hf", ")", ";", "path", ".", "lineTo", "(", "x", "+", "9.0", "*", "xf", ",", "y", ")", ";", "path", ".", "lineTo", "(", "x", "+", "11.0", "*", "xf", ",", "y", ")", ";", "path", ".", "lineTo", "(", "x", "+", "5.0", "*", "xf", ",", "y", "+", "12.0", "*", "hf", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Return a path for a check mark. @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 w the width of the check mark @param h the height of the check mark @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "check", "mark", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L278-L292
816
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createArrowLeft
public Shape createArrowLeft(final double x, final double y, final double w, final double h) { path.reset(); path.moveTo(x + w, y); path.lineTo(x, y + h / 2.0); path.lineTo(x + w, y + h); path.closePath(); return path; }
java
public Shape createArrowLeft(final double x, final double y, final double w, final double h) { path.reset(); path.moveTo(x + w, y); path.lineTo(x, y + h / 2.0); path.lineTo(x + w, y + h); path.closePath(); return path; }
[ "public", "Shape", "createArrowLeft", "(", "final", "double", "x", ",", "final", "double", "y", ",", "final", "double", "w", ",", "final", "double", "h", ")", "{", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "x", "+", "w", ",", "y", ")", ";", "path", ".", "lineTo", "(", "x", ",", "y", "+", "h", "/", "2.0", ")", ";", "path", ".", "lineTo", "(", "x", "+", "w", ",", "y", "+", "h", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Return a path for an arrow pointing to the left. @param x the X coordinate of the upper-left corner of the arrow @param y the Y coordinate of the upper-left corner of the arrow @param w the width of the arrow @param h the height of the arrow @return a path representing the shape.
[ "Return", "a", "path", "for", "an", "arrow", "pointing", "to", "the", "left", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L304-L312
817
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createProgressBarIndeterminatePattern
public Shape createProgressBarIndeterminatePattern(int x, int y, int w, int h) { final double wHalf = w / 2.0; final double xOffset = 5; path.reset(); path.moveTo(xOffset, 0); path.lineTo(xOffset+wHalf, 0); path.curveTo(xOffset+wHalf-5, h/2-4, xOffset+wHalf+5, h/2+4, xOffset+wHalf, h); path.lineTo(xOffset, h); path.curveTo(xOffset+5, h/2+4, xOffset-5, h/2-4, xOffset, 0); path.closePath(); return path; }
java
public Shape createProgressBarIndeterminatePattern(int x, int y, int w, int h) { final double wHalf = w / 2.0; final double xOffset = 5; path.reset(); path.moveTo(xOffset, 0); path.lineTo(xOffset+wHalf, 0); path.curveTo(xOffset+wHalf-5, h/2-4, xOffset+wHalf+5, h/2+4, xOffset+wHalf, h); path.lineTo(xOffset, h); path.curveTo(xOffset+5, h/2+4, xOffset-5, h/2-4, xOffset, 0); path.closePath(); return path; }
[ "public", "Shape", "createProgressBarIndeterminatePattern", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "final", "double", "wHalf", "=", "w", "/", "2.0", ";", "final", "double", "xOffset", "=", "5", ";", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "xOffset", ",", "0", ")", ";", "path", ".", "lineTo", "(", "xOffset", "+", "wHalf", ",", "0", ")", ";", "path", ".", "curveTo", "(", "xOffset", "+", "wHalf", "-", "5", ",", "h", "/", "2", "-", "4", ",", "xOffset", "+", "wHalf", "+", "5", ",", "h", "/", "2", "+", "4", ",", "xOffset", "+", "wHalf", ",", "h", ")", ";", "path", ".", "lineTo", "(", "xOffset", ",", "h", ")", ";", "path", ".", "curveTo", "(", "xOffset", "+", "5", ",", "h", "/", "2", "+", "4", ",", "xOffset", "-", "5", ",", "h", "/", "2", "-", "4", ",", "xOffset", ",", "0", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Return a path for the patterned portion of an indeterminate progress bar. @param x the X coordinate of the upper-left corner of the region @param y the Y coordinate of the upper-left corner of the region @param w the width of the region @param h the height of the region @return a path representing the shape.
[ "Return", "a", "path", "for", "the", "patterned", "portion", "of", "an", "indeterminate", "progress", "bar", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L384-L396
818
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createInternalDropShadowRounded
public Shape createInternalDropShadowRounded(final int x, final int y, final int w, final int h) { final double radius = h / 2; final int right = x + w; final double bottom = y + radius; path.reset(); // Upper edge. path.moveTo(x, bottom); path.quadTo(x, y, x + radius, y); path.lineTo(right - radius, y); path.quadTo(right, y, right, bottom); // Lower edge. path.lineTo(right - 1, bottom); path.quadTo(right - 2, y + 2, right - radius - 1, y + 2); path.lineTo(x + radius + 1, y + 2); path.quadTo(x + 2, y + 2, x + 1, bottom); path.closePath(); return path; }
java
public Shape createInternalDropShadowRounded(final int x, final int y, final int w, final int h) { final double radius = h / 2; final int right = x + w; final double bottom = y + radius; path.reset(); // Upper edge. path.moveTo(x, bottom); path.quadTo(x, y, x + radius, y); path.lineTo(right - radius, y); path.quadTo(right, y, right, bottom); // Lower edge. path.lineTo(right - 1, bottom); path.quadTo(right - 2, y + 2, right - radius - 1, y + 2); path.lineTo(x + radius + 1, y + 2); path.quadTo(x + 2, y + 2, x + 1, bottom); path.closePath(); return path; }
[ "public", "Shape", "createInternalDropShadowRounded", "(", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "w", ",", "final", "int", "h", ")", "{", "final", "double", "radius", "=", "h", "/", "2", ";", "final", "int", "right", "=", "x", "+", "w", ";", "final", "double", "bottom", "=", "y", "+", "radius", ";", "path", ".", "reset", "(", ")", ";", "// Upper edge.", "path", ".", "moveTo", "(", "x", ",", "bottom", ")", ";", "path", ".", "quadTo", "(", "x", ",", "y", ",", "x", "+", "radius", ",", "y", ")", ";", "path", ".", "lineTo", "(", "right", "-", "radius", ",", "y", ")", ";", "path", ".", "quadTo", "(", "right", ",", "y", ",", "right", ",", "bottom", ")", ";", "// Lower edge.", "path", ".", "lineTo", "(", "right", "-", "1", ",", "bottom", ")", ";", "path", ".", "quadTo", "(", "right", "-", "2", ",", "y", "+", "2", ",", "right", "-", "radius", "-", "1", ",", "y", "+", "2", ")", ";", "path", ".", "lineTo", "(", "x", "+", "radius", "+", "1", ",", "y", "+", "2", ")", ";", "path", ".", "quadTo", "(", "x", "+", "2", ",", "y", "+", "2", ",", "x", "+", "1", ",", "bottom", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Return a path for a rounded internal drop shadow. This is used for progress bar tracks and search fields. @param x the X coordinate of the upper-left corner of the shadow @param y the Y coordinate of the upper-left corner of the shadow @param w the width of the shadow @param h the height of the rectangle @return a path representing the shadow.
[ "Return", "a", "path", "for", "a", "rounded", "internal", "drop", "shadow", ".", "This", "is", "used", "for", "progress", "bar", "tracks", "and", "search", "fields", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L409-L431
819
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createFillableFocusRectangle
public Shape createFillableFocusRectangle(int x, int y, int w, int h) { final int left = x; final int top = y; final int right = x + w; final int bottom = y + h; path.reset(); path.moveTo(left, top); path.lineTo(left, bottom); path.lineTo(right, bottom); path.lineTo(right, top); final float offset = 1.4f; final float left2 = left + offset; final float top2 = top + offset; final float right2 = right - offset; final float bottom2 = bottom - offset; // TODO These two lines were curveTo in Nimbus. Perhaps we should // revisit this? path.lineTo(right2, top); path.lineTo(right2, bottom2); path.lineTo(left2, bottom2); path.lineTo(left2, top2); path.lineTo(right2, top2); path.lineTo(right2, top); path.closePath(); return path; }
java
public Shape createFillableFocusRectangle(int x, int y, int w, int h) { final int left = x; final int top = y; final int right = x + w; final int bottom = y + h; path.reset(); path.moveTo(left, top); path.lineTo(left, bottom); path.lineTo(right, bottom); path.lineTo(right, top); final float offset = 1.4f; final float left2 = left + offset; final float top2 = top + offset; final float right2 = right - offset; final float bottom2 = bottom - offset; // TODO These two lines were curveTo in Nimbus. Perhaps we should // revisit this? path.lineTo(right2, top); path.lineTo(right2, bottom2); path.lineTo(left2, bottom2); path.lineTo(left2, top2); path.lineTo(right2, top2); path.lineTo(right2, top); path.closePath(); return path; }
[ "public", "Shape", "createFillableFocusRectangle", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "final", "int", "left", "=", "x", ";", "final", "int", "top", "=", "y", ";", "final", "int", "right", "=", "x", "+", "w", ";", "final", "int", "bottom", "=", "y", "+", "h", ";", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "left", ",", "top", ")", ";", "path", ".", "lineTo", "(", "left", ",", "bottom", ")", ";", "path", ".", "lineTo", "(", "right", ",", "bottom", ")", ";", "path", ".", "lineTo", "(", "right", ",", "top", ")", ";", "final", "float", "offset", "=", "1.4f", ";", "final", "float", "left2", "=", "left", "+", "offset", ";", "final", "float", "top2", "=", "top", "+", "offset", ";", "final", "float", "right2", "=", "right", "-", "offset", ";", "final", "float", "bottom2", "=", "bottom", "-", "offset", ";", "// TODO These two lines were curveTo in Nimbus. Perhaps we should", "// revisit this?", "path", ".", "lineTo", "(", "right2", ",", "top", ")", ";", "path", ".", "lineTo", "(", "right2", ",", "bottom2", ")", ";", "path", ".", "lineTo", "(", "left2", ",", "bottom2", ")", ";", "path", ".", "lineTo", "(", "left2", ",", "top2", ")", ";", "path", ".", "lineTo", "(", "right2", ",", "top2", ")", ";", "path", ".", "lineTo", "(", "right2", ",", "top", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Return a path for a focus rectangle. <p>This path is suitable for filling.</p> @param x the X coordinate of the upper-left corner of the rectangle @param y the Y coordinate of the upper-left corner of the rectangle @param w the width of the rectangle @param h the height of the rectangle @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "focus", "rectangle", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L445-L475
820
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createBullet
public Shape createBullet(int x, int y, int diameter) { return createEllipseInternal(x, y, diameter, diameter); }
java
public Shape createBullet(int x, int y, int diameter) { return createEllipseInternal(x, y, diameter, diameter); }
[ "public", "Shape", "createBullet", "(", "int", "x", ",", "int", "y", ",", "int", "diameter", ")", "{", "return", "createEllipseInternal", "(", "x", ",", "y", ",", "diameter", ",", "diameter", ")", ";", "}" ]
Return a path for a simple bullet. @param x the X coordinate of the upper-left corner of the bullet @param y the Y coordinate of the upper-left corner of the bullet @param diameter the diameter of the bullet @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "simple", "bullet", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L486-L488
821
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createRadioButton
public Shape createRadioButton(int x, int y, int diameter) { return createEllipseInternal(x, y, diameter, diameter); }
java
public Shape createRadioButton(int x, int y, int diameter) { return createEllipseInternal(x, y, diameter, diameter); }
[ "public", "Shape", "createRadioButton", "(", "int", "x", ",", "int", "y", ",", "int", "diameter", ")", "{", "return", "createEllipseInternal", "(", "x", ",", "y", ",", "diameter", ",", "diameter", ")", ";", "}" ]
Return a path for a radio button's concentric sections. @param x the X coordinate of the upper-left corner of the section @param y the Y coordinate of the upper-left corner of the section @param diameter the diameter of the section @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "radio", "button", "s", "concentric", "sections", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L499-L501
822
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createSliderThumbContinuous
public Shape createSliderThumbContinuous(final int x, final int y, final int diameter) { return createEllipseInternal(x, y, diameter, diameter); }
java
public Shape createSliderThumbContinuous(final int x, final int y, final int diameter) { return createEllipseInternal(x, y, diameter, diameter); }
[ "public", "Shape", "createSliderThumbContinuous", "(", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "diameter", ")", "{", "return", "createEllipseInternal", "(", "x", ",", "y", ",", "diameter", ",", "diameter", ")", ";", "}" ]
Return a path for a continuous slider thumb's concentric sections. @param x the X coordinate of the upper-left corner of the section @param y the Y coordinate of the upper-left corner of the section @param diameter the diameter of the section @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "continuous", "slider", "thumb", "s", "concentric", "sections", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L512-L514
823
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createSliderThumbDiscrete
public Shape createSliderThumbDiscrete(final int x, final int y, final int w, final int h, final CornerSize size) { final double topArc = size.getRadius(w, h); final double bottomArcH = size == CornerSize.INTERIOR ? 0 : 1; final double bottomArcW = 3; path.reset(); path.moveTo(x, y + topArc); path.quadTo(x, y, x + topArc, y); path.lineTo(x + w - topArc, y); path.quadTo(x + w, y, x + w, y + topArc); path.lineTo(x + w, y + h / 2.0); path.quadTo(x + w - bottomArcW, y + h - bottomArcH, x + w / 2.0, y + h); path.quadTo(x + bottomArcW, y + h - bottomArcH, x, y + h / 2.0); path.closePath(); return path; }
java
public Shape createSliderThumbDiscrete(final int x, final int y, final int w, final int h, final CornerSize size) { final double topArc = size.getRadius(w, h); final double bottomArcH = size == CornerSize.INTERIOR ? 0 : 1; final double bottomArcW = 3; path.reset(); path.moveTo(x, y + topArc); path.quadTo(x, y, x + topArc, y); path.lineTo(x + w - topArc, y); path.quadTo(x + w, y, x + w, y + topArc); path.lineTo(x + w, y + h / 2.0); path.quadTo(x + w - bottomArcW, y + h - bottomArcH, x + w / 2.0, y + h); path.quadTo(x + bottomArcW, y + h - bottomArcH, x, y + h / 2.0); path.closePath(); return path; }
[ "public", "Shape", "createSliderThumbDiscrete", "(", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "w", ",", "final", "int", "h", ",", "final", "CornerSize", "size", ")", "{", "final", "double", "topArc", "=", "size", ".", "getRadius", "(", "w", ",", "h", ")", ";", "final", "double", "bottomArcH", "=", "size", "==", "CornerSize", ".", "INTERIOR", "?", "0", ":", "1", ";", "final", "double", "bottomArcW", "=", "3", ";", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "x", ",", "y", "+", "topArc", ")", ";", "path", ".", "quadTo", "(", "x", ",", "y", ",", "x", "+", "topArc", ",", "y", ")", ";", "path", ".", "lineTo", "(", "x", "+", "w", "-", "topArc", ",", "y", ")", ";", "path", ".", "quadTo", "(", "x", "+", "w", ",", "y", ",", "x", "+", "w", ",", "y", "+", "topArc", ")", ";", "path", ".", "lineTo", "(", "x", "+", "w", ",", "y", "+", "h", "/", "2.0", ")", ";", "path", ".", "quadTo", "(", "x", "+", "w", "-", "bottomArcW", ",", "y", "+", "h", "-", "bottomArcH", ",", "x", "+", "w", "/", "2.0", ",", "y", "+", "h", ")", ";", "path", ".", "quadTo", "(", "x", "+", "bottomArcW", ",", "y", "+", "h", "-", "bottomArcH", ",", "x", ",", "y", "+", "h", "/", "2.0", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Return a path for a discrete slider thumb's concentric sections. @param x the X coordinate of the upper-left corner of the section @param y the Y coordinate of the upper-left corner of the section @param w the width of the section @param h the height of the section @param size the CornerSize representing the rounding amount for the section @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "discrete", "slider", "thumb", "s", "concentric", "sections", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L528-L544
824
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createTabCloseIcon
public Shape createTabCloseIcon(int x, int y, int w, int h) { final double xMid = x + w / 2.0; final double yMid = y + h / 2.0; path.reset(); final double xOffsetL = w / 2.0; final double xOffsetS = w / 2.0 - 1; final double yOffsetL = h / 2.0; final double yOffsetS = h / 2.0 - 1; final double offsetC = 1; path.moveTo(xMid, yMid - offsetC); path.lineTo(xMid + xOffsetS, yMid - yOffsetL); path.lineTo(yMid + xOffsetL, yMid - yOffsetS); path.lineTo(xMid + offsetC, yMid); path.lineTo(xMid + xOffsetL, yMid + yOffsetS); path.lineTo(xMid + xOffsetS, yMid + yOffsetL); path.lineTo(xMid, yMid + offsetC); path.lineTo(xMid - xOffsetS, yMid + yOffsetL); path.lineTo(xMid - xOffsetL, yMid + yOffsetS); path.lineTo(xMid - offsetC, yMid); path.lineTo(xMid - xOffsetL, yMid - yOffsetS); path.lineTo(xMid - xOffsetS, yMid - yOffsetL); path.closePath(); return path; }
java
public Shape createTabCloseIcon(int x, int y, int w, int h) { final double xMid = x + w / 2.0; final double yMid = y + h / 2.0; path.reset(); final double xOffsetL = w / 2.0; final double xOffsetS = w / 2.0 - 1; final double yOffsetL = h / 2.0; final double yOffsetS = h / 2.0 - 1; final double offsetC = 1; path.moveTo(xMid, yMid - offsetC); path.lineTo(xMid + xOffsetS, yMid - yOffsetL); path.lineTo(yMid + xOffsetL, yMid - yOffsetS); path.lineTo(xMid + offsetC, yMid); path.lineTo(xMid + xOffsetL, yMid + yOffsetS); path.lineTo(xMid + xOffsetS, yMid + yOffsetL); path.lineTo(xMid, yMid + offsetC); path.lineTo(xMid - xOffsetS, yMid + yOffsetL); path.lineTo(xMid - xOffsetL, yMid + yOffsetS); path.lineTo(xMid - offsetC, yMid); path.lineTo(xMid - xOffsetL, yMid - yOffsetS); path.lineTo(xMid - xOffsetS, yMid - yOffsetL); path.closePath(); return path; }
[ "public", "Shape", "createTabCloseIcon", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "final", "double", "xMid", "=", "x", "+", "w", "/", "2.0", ";", "final", "double", "yMid", "=", "y", "+", "h", "/", "2.0", ";", "path", ".", "reset", "(", ")", ";", "final", "double", "xOffsetL", "=", "w", "/", "2.0", ";", "final", "double", "xOffsetS", "=", "w", "/", "2.0", "-", "1", ";", "final", "double", "yOffsetL", "=", "h", "/", "2.0", ";", "final", "double", "yOffsetS", "=", "h", "/", "2.0", "-", "1", ";", "final", "double", "offsetC", "=", "1", ";", "path", ".", "moveTo", "(", "xMid", ",", "yMid", "-", "offsetC", ")", ";", "path", ".", "lineTo", "(", "xMid", "+", "xOffsetS", ",", "yMid", "-", "yOffsetL", ")", ";", "path", ".", "lineTo", "(", "yMid", "+", "xOffsetL", ",", "yMid", "-", "yOffsetS", ")", ";", "path", ".", "lineTo", "(", "xMid", "+", "offsetC", ",", "yMid", ")", ";", "path", ".", "lineTo", "(", "xMid", "+", "xOffsetL", ",", "yMid", "+", "yOffsetS", ")", ";", "path", ".", "lineTo", "(", "xMid", "+", "xOffsetS", ",", "yMid", "+", "yOffsetL", ")", ";", "path", ".", "lineTo", "(", "xMid", ",", "yMid", "+", "offsetC", ")", ";", "path", ".", "lineTo", "(", "xMid", "-", "xOffsetS", ",", "yMid", "+", "yOffsetL", ")", ";", "path", ".", "lineTo", "(", "xMid", "-", "xOffsetL", ",", "yMid", "+", "yOffsetS", ")", ";", "path", ".", "lineTo", "(", "xMid", "-", "offsetC", ",", "yMid", ")", ";", "path", ".", "lineTo", "(", "xMid", "-", "xOffsetL", ",", "yMid", "-", "yOffsetS", ")", ";", "path", ".", "lineTo", "(", "xMid", "-", "xOffsetS", ",", "yMid", "-", "yOffsetL", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Return a path for a "cancel" icon. This is a circle with a punched out "x" in it. @param x the X coordinate of the upper-left corner of the icon @param y the Y coordinate of the upper-left corner of the icon @param w the width of the icon @param h the height of the icon @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "cancel", "icon", ".", "This", "is", "a", "circle", "with", "a", "punched", "out", "x", "in", "it", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L605-L632
825
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createScrollCap
public Shape createScrollCap(int x, int y, int w, int h) { path.reset(); path.moveTo(x, y); path.lineTo(x, y + h); path.lineTo(x + w, y + h); addScrollGapPath(x, y, w, h, true); path.closePath(); return path; }
java
public Shape createScrollCap(int x, int y, int w, int h) { path.reset(); path.moveTo(x, y); path.lineTo(x, y + h); path.lineTo(x + w, y + h); addScrollGapPath(x, y, w, h, true); path.closePath(); return path; }
[ "public", "Shape", "createScrollCap", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "x", ",", "y", ")", ";", "path", ".", "lineTo", "(", "x", ",", "y", "+", "h", ")", ";", "path", ".", "lineTo", "(", "x", "+", "w", ",", "y", "+", "h", ")", ";", "addScrollGapPath", "(", "x", ",", "y", ",", "w", ",", "h", ",", "true", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Return a path for a scroll bar cap. This is used when the buttons are placed together at the opposite end of the scroll bar. @param x the X coordinate of the upper-left corner of the cap @param y the Y coordinate of the upper-left corner of the cap @param w the width of the cap @param h the height of the cap @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "scroll", "bar", "cap", ".", "This", "is", "used", "when", "the", "buttons", "are", "placed", "together", "at", "the", "opposite", "end", "of", "the", "scroll", "bar", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L645-L654
826
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createScrollButtonTogetherDecrease
public Shape createScrollButtonTogetherDecrease(int x, int y, int w, int h) { path.reset(); path.moveTo(x + w, y); path.lineTo(x + w, y + h); path.lineTo(x, y + h); addScrollGapPath(x, y, w, h, false); path.closePath(); return path; }
java
public Shape createScrollButtonTogetherDecrease(int x, int y, int w, int h) { path.reset(); path.moveTo(x + w, y); path.lineTo(x + w, y + h); path.lineTo(x, y + h); addScrollGapPath(x, y, w, h, false); path.closePath(); return path; }
[ "public", "Shape", "createScrollButtonTogetherDecrease", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "x", "+", "w", ",", "y", ")", ";", "path", ".", "lineTo", "(", "x", "+", "w", ",", "y", "+", "h", ")", ";", "path", ".", "lineTo", "(", "x", ",", "y", "+", "h", ")", ";", "addScrollGapPath", "(", "x", ",", "y", ",", "w", ",", "h", ",", "false", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Return a path for a scroll bar decrease button. This is used when the buttons are placed together at one end of the scroll bar. @param x the X coordinate of the upper-left corner of the button @param y the Y coordinate of the upper-left corner of the button @param w the width of the button @param h the height of the button @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "scroll", "bar", "decrease", "button", ".", "This", "is", "used", "when", "the", "buttons", "are", "placed", "together", "at", "one", "end", "of", "the", "scroll", "bar", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L690-L699
827
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createScrollButtonTogetherIncrease
public Shape createScrollButtonTogetherIncrease(int x, int y, int w, int h) { return createRectangle(x, y, w, h); }
java
public Shape createScrollButtonTogetherIncrease(int x, int y, int w, int h) { return createRectangle(x, y, w, h); }
[ "public", "Shape", "createScrollButtonTogetherIncrease", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "return", "createRectangle", "(", "x", ",", "y", ",", "w", ",", "h", ")", ";", "}" ]
Return a path for a scroll bar increase button. This is used when the buttons are placed together at one end of the scroll bar. @param x the X coordinate of the upper-left corner of the button @param y the Y coordinate of the upper-left corner of the button @param w the width of the button @param h the height of the button @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "scroll", "bar", "increase", "button", ".", "This", "is", "used", "when", "the", "buttons", "are", "placed", "together", "at", "one", "end", "of", "the", "scroll", "bar", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L712-L714
828
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.addScrollGapPath
private void addScrollGapPath(int x, int y, int w, int h, boolean isAtLeft) { final double hHalf = h / 2.0; final double wFull = isAtLeft ? w : 0; final double wHalfOff = isAtLeft ? w - hHalf : hHalf; path.quadTo(x + wHalfOff, y + h, x + wHalfOff, y + hHalf); path.quadTo(x + wHalfOff, y, x + wFull, y); }
java
private void addScrollGapPath(int x, int y, int w, int h, boolean isAtLeft) { final double hHalf = h / 2.0; final double wFull = isAtLeft ? w : 0; final double wHalfOff = isAtLeft ? w - hHalf : hHalf; path.quadTo(x + wHalfOff, y + h, x + wHalfOff, y + hHalf); path.quadTo(x + wHalfOff, y, x + wFull, y); }
[ "private", "void", "addScrollGapPath", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "boolean", "isAtLeft", ")", "{", "final", "double", "hHalf", "=", "h", "/", "2.0", ";", "final", "double", "wFull", "=", "isAtLeft", "?", "w", ":", "0", ";", "final", "double", "wHalfOff", "=", "isAtLeft", "?", "w", "-", "hHalf", ":", "hHalf", ";", "path", ".", "quadTo", "(", "x", "+", "wHalfOff", ",", "y", "+", "h", ",", "x", "+", "wHalfOff", ",", "y", "+", "hHalf", ")", ";", "path", ".", "quadTo", "(", "x", "+", "wHalfOff", ",", "y", ",", "x", "+", "wFull", ",", "y", ")", ";", "}" ]
Adds a hemispherical section to the current path. This is used to create the gap in a scroll bar button or cap into which the scroll bar thumb will fit. @param x the X coordinate of the upper-left corner of the button or cap @param y the Y coordinate of the upper-left corner of the button or cap @param w the width of the button or cap @param h the height of the button or cap @param isAtLeft {@code true} if the gap is at the left end of the button, {@code false} if it is at the right.
[ "Adds", "a", "hemispherical", "section", "to", "the", "current", "path", ".", "This", "is", "used", "to", "create", "the", "gap", "in", "a", "scroll", "bar", "button", "or", "cap", "into", "which", "the", "scroll", "bar", "thumb", "will", "fit", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L730-L737
829
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createEllipseInternal
private Shape createEllipseInternal(int x, int y, int w, int h) { ellipse.setFrame(x, y, w, h); return ellipse; }
java
private Shape createEllipseInternal(int x, int y, int w, int h) { ellipse.setFrame(x, y, w, h); return ellipse; }
[ "private", "Shape", "createEllipseInternal", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "ellipse", ".", "setFrame", "(", "x", ",", "y", ",", "w", ",", "h", ")", ";", "return", "ellipse", ";", "}" ]
Return a path for an ellipse. @param x the X coordinate of the upper-left corner of the ellipse @param y the Y coordinate of the upper-left corner of the ellipse @param w the width of the ellipse @param h the height of the ellipse @return a path representing the shape.
[ "Return", "a", "path", "for", "an", "ellipse", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L749-L753
830
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.getComponentState
private int getComponentState(JComponent c) { if (rootParent != null) { if (isParentSelected()) { return SELECTED; } } return SeaGlassLookAndFeel.getComponentState(c); }
java
private int getComponentState(JComponent c) { if (rootParent != null) { if (isParentSelected()) { return SELECTED; } } return SeaGlassLookAndFeel.getComponentState(c); }
[ "private", "int", "getComponentState", "(", "JComponent", "c", ")", "{", "if", "(", "rootParent", "!=", "null", ")", "{", "if", "(", "isParentSelected", "(", ")", ")", "{", "return", "SELECTED", ";", "}", "}", "return", "SeaGlassLookAndFeel", ".", "getComponentState", "(", "c", ")", ";", "}" ]
Compute the state for the title pane. @param c the title pane. @return the state.
[ "Compute", "the", "state", "for", "the", "title", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L181-L190
831
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.isParentSelected
private boolean isParentSelected() { if (rootParent instanceof JFrame) { return ((JFrame) rootParent).isActive(); } else if (rootParent instanceof JDialog) { return ((JDialog) rootParent).isActive(); } else { return true; } }
java
private boolean isParentSelected() { if (rootParent instanceof JFrame) { return ((JFrame) rootParent).isActive(); } else if (rootParent instanceof JDialog) { return ((JDialog) rootParent).isActive(); } else { return true; } }
[ "private", "boolean", "isParentSelected", "(", ")", "{", "if", "(", "rootParent", "instanceof", "JFrame", ")", "{", "return", "(", "(", "JFrame", ")", "rootParent", ")", ".", "isActive", "(", ")", ";", "}", "else", "if", "(", "rootParent", "instanceof", "JDialog", ")", "{", "return", "(", "(", "JDialog", ")", "rootParent", ")", ".", "isActive", "(", ")", ";", "}", "else", "{", "return", "true", ";", "}", "}" ]
Determine if the title pane's parent is active. @return {@code true} if the parent is active, {@code false} otherwise.
[ "Determine", "if", "the", "title", "pane", "s", "parent", "is", "active", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L197-L205
832
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.isParentLeftToRight
private boolean isParentLeftToRight() { if (rootParent instanceof JFrame) { return SeaGlassLookAndFeel.isLeftToRight((JFrame) rootParent); } else if (rootParent instanceof JDialog) { return SeaGlassLookAndFeel.isLeftToRight((JDialog) rootParent); } else { return false; } }
java
private boolean isParentLeftToRight() { if (rootParent instanceof JFrame) { return SeaGlassLookAndFeel.isLeftToRight((JFrame) rootParent); } else if (rootParent instanceof JDialog) { return SeaGlassLookAndFeel.isLeftToRight((JDialog) rootParent); } else { return false; } }
[ "private", "boolean", "isParentLeftToRight", "(", ")", "{", "if", "(", "rootParent", "instanceof", "JFrame", ")", "{", "return", "SeaGlassLookAndFeel", ".", "isLeftToRight", "(", "(", "JFrame", ")", "rootParent", ")", ";", "}", "else", "if", "(", "rootParent", "instanceof", "JDialog", ")", "{", "return", "SeaGlassLookAndFeel", ".", "isLeftToRight", "(", "(", "JDialog", ")", "rootParent", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Is the parent window laid out left-to-right? @return {@code true} if the parent is laid out left-to-right, {@code false} otherwise.
[ "Is", "the", "parent", "window", "laid", "out", "left", "-", "to", "-", "right?" ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L241-L249
833
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.addParentPropertyChangeListener
private void addParentPropertyChangeListener(PropertyChangeListener listener) { if (rootParent instanceof JFrame) { ((JFrame) rootParent).addPropertyChangeListener(listener); } else if (rootParent instanceof JDialog) { ((JDialog) rootParent).addPropertyChangeListener(listener); } rootPane.addPropertyChangeListener(listener); }
java
private void addParentPropertyChangeListener(PropertyChangeListener listener) { if (rootParent instanceof JFrame) { ((JFrame) rootParent).addPropertyChangeListener(listener); } else if (rootParent instanceof JDialog) { ((JDialog) rootParent).addPropertyChangeListener(listener); } rootPane.addPropertyChangeListener(listener); }
[ "private", "void", "addParentPropertyChangeListener", "(", "PropertyChangeListener", "listener", ")", "{", "if", "(", "rootParent", "instanceof", "JFrame", ")", "{", "(", "(", "JFrame", ")", "rootParent", ")", ".", "addPropertyChangeListener", "(", "listener", ")", ";", "}", "else", "if", "(", "rootParent", "instanceof", "JDialog", ")", "{", "(", "(", "JDialog", ")", "rootParent", ")", ".", "addPropertyChangeListener", "(", "listener", ")", ";", "}", "rootPane", ".", "addPropertyChangeListener", "(", "listener", ")", ";", "}" ]
Add a property change listener to the root pane. @param listener the propertiy change listener to add.
[ "Add", "a", "property", "change", "listener", "to", "the", "root", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L305-L313
834
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.removeParentPropertyChangeListener
private void removeParentPropertyChangeListener(PropertyChangeListener listener) { if (rootParent instanceof JFrame) { ((JFrame) rootParent).removePropertyChangeListener(listener); } else if (rootParent instanceof JDialog) { ((JDialog) rootParent).removePropertyChangeListener(listener); } }
java
private void removeParentPropertyChangeListener(PropertyChangeListener listener) { if (rootParent instanceof JFrame) { ((JFrame) rootParent).removePropertyChangeListener(listener); } else if (rootParent instanceof JDialog) { ((JDialog) rootParent).removePropertyChangeListener(listener); } }
[ "private", "void", "removeParentPropertyChangeListener", "(", "PropertyChangeListener", "listener", ")", "{", "if", "(", "rootParent", "instanceof", "JFrame", ")", "{", "(", "(", "JFrame", ")", "rootParent", ")", ".", "removePropertyChangeListener", "(", "listener", ")", ";", "}", "else", "if", "(", "rootParent", "instanceof", "JDialog", ")", "{", "(", "(", "JDialog", ")", "rootParent", ")", ".", "removePropertyChangeListener", "(", "listener", ")", ";", "}", "}" ]
Remove the property change listener from the root pane. @param listener the property change listener to remove.
[ "Remove", "the", "property", "change", "listener", "from", "the", "root", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L320-L326
835
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.installDefaults
private void installDefaults() { // Basic setFont(UIManager.getFont("InternalFrame.titleFont")); closeButtonToolTip = UIManager.getString("InternalFrame.closeButtonToolTip"); iconButtonToolTip = UIManager.getString("InternalFrame.iconButtonToolTip"); restoreButtonToolTip = UIManager.getString("InternalFrame.restoreButtonToolTip"); maxButtonToolTip = UIManager.getString("InternalFrame.maxButtonToolTip"); // Synth updateStyle(this); }
java
private void installDefaults() { // Basic setFont(UIManager.getFont("InternalFrame.titleFont")); closeButtonToolTip = UIManager.getString("InternalFrame.closeButtonToolTip"); iconButtonToolTip = UIManager.getString("InternalFrame.iconButtonToolTip"); restoreButtonToolTip = UIManager.getString("InternalFrame.restoreButtonToolTip"); maxButtonToolTip = UIManager.getString("InternalFrame.maxButtonToolTip"); // Synth updateStyle(this); }
[ "private", "void", "installDefaults", "(", ")", "{", "// Basic\r", "setFont", "(", "UIManager", ".", "getFont", "(", "\"InternalFrame.titleFont\"", ")", ")", ";", "closeButtonToolTip", "=", "UIManager", ".", "getString", "(", "\"InternalFrame.closeButtonToolTip\"", ")", ";", "iconButtonToolTip", "=", "UIManager", ".", "getString", "(", "\"InternalFrame.iconButtonToolTip\"", ")", ";", "restoreButtonToolTip", "=", "UIManager", ".", "getString", "(", "\"InternalFrame.restoreButtonToolTip\"", ")", ";", "maxButtonToolTip", "=", "UIManager", ".", "getString", "(", "\"InternalFrame.maxButtonToolTip\"", ")", ";", "// Synth\r", "updateStyle", "(", "this", ")", ";", "}" ]
Install the defaults and update the Synth Style.
[ "Install", "the", "defaults", "and", "update", "the", "Synth", "Style", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L518-L528
836
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.updateStyle
private void updateStyle(JComponent c) { SeaGlassContext context = getContext(this, ENABLED); SynthStyle oldStyle = style; style = SeaGlassLookAndFeel.updateSeaglassStyle(context, this); if (style != oldStyle) { titleSpacing = style.getInt(context, "InternalFrameTitlePane.titleSpacing", 2); } context.dispose(); }
java
private void updateStyle(JComponent c) { SeaGlassContext context = getContext(this, ENABLED); SynthStyle oldStyle = style; style = SeaGlassLookAndFeel.updateSeaglassStyle(context, this); if (style != oldStyle) { titleSpacing = style.getInt(context, "InternalFrameTitlePane.titleSpacing", 2); } context.dispose(); }
[ "private", "void", "updateStyle", "(", "JComponent", "c", ")", "{", "SeaGlassContext", "context", "=", "getContext", "(", "this", ",", "ENABLED", ")", ";", "SynthStyle", "oldStyle", "=", "style", ";", "style", "=", "SeaGlassLookAndFeel", ".", "updateSeaglassStyle", "(", "context", ",", "this", ")", ";", "if", "(", "style", "!=", "oldStyle", ")", "{", "titleSpacing", "=", "style", ".", "getInt", "(", "context", ",", "\"InternalFrameTitlePane.titleSpacing\"", ",", "2", ")", ";", "}", "context", ".", "dispose", "(", ")", ";", "}" ]
Update the Synth Style. @param c the title pane.
[ "Update", "the", "Synth", "Style", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L546-L557
837
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.setButtonTooltips
private void setButtonTooltips() { if (isParentIcon()) { if (restoreButtonToolTip != null && restoreButtonToolTip.length() != 0) { iconButton.setToolTipText(restoreButtonToolTip); } if (maxButtonToolTip != null && maxButtonToolTip.length() != 0) { maxButton.setToolTipText(maxButtonToolTip); } } else if (isParentMaximum()) { 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 (isParentIcon()) { if (restoreButtonToolTip != null && restoreButtonToolTip.length() != 0) { iconButton.setToolTipText(restoreButtonToolTip); } if (maxButtonToolTip != null && maxButtonToolTip.length() != 0) { maxButton.setToolTipText(maxButtonToolTip); } } else if (isParentMaximum()) { 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", "(", "isParentIcon", "(", ")", ")", "{", "if", "(", "restoreButtonToolTip", "!=", "null", "&&", "restoreButtonToolTip", ".", "length", "(", ")", "!=", "0", ")", "{", "iconButton", ".", "setToolTipText", "(", "restoreButtonToolTip", ")", ";", "}", "if", "(", "maxButtonToolTip", "!=", "null", "&&", "maxButtonToolTip", ".", "length", "(", ")", "!=", "0", ")", "{", "maxButton", ".", "setToolTipText", "(", "maxButtonToolTip", ")", ";", "}", "}", "else", "if", "(", "isParentMaximum", "(", ")", ")", "{", "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 tooltips for the buttons.
[ "Set", "the", "tooltips", "for", "the", "buttons", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L586-L615
838
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.getTitle
private String getTitle() { if (rootParent instanceof JFrame) { return ((JFrame) rootParent).getTitle(); } else if (rootParent instanceof JDialog) { return ((JDialog) rootParent).getTitle(); } return null; }
java
private String getTitle() { if (rootParent instanceof JFrame) { return ((JFrame) rootParent).getTitle(); } else if (rootParent instanceof JDialog) { return ((JDialog) rootParent).getTitle(); } return null; }
[ "private", "String", "getTitle", "(", ")", "{", "if", "(", "rootParent", "instanceof", "JFrame", ")", "{", "return", "(", "(", "JFrame", ")", "rootParent", ")", ".", "getTitle", "(", ")", ";", "}", "else", "if", "(", "rootParent", "instanceof", "JDialog", ")", "{", "return", "(", "(", "JDialog", ")", "rootParent", ")", ".", "getTitle", "(", ")", ";", "}", "return", "null", ";", "}" ]
Returns the String to display as the title. @return the title String.
[ "Returns", "the", "String", "to", "display", "as", "the", "title", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L717-L725
839
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.getParentInsets
private Insets getParentInsets() { if (rootParent instanceof JApplet) { return ((JApplet) rootParent).getInsets(); } return ((Window) rootParent).getInsets(); }
java
private Insets getParentInsets() { if (rootParent instanceof JApplet) { return ((JApplet) rootParent).getInsets(); } return ((Window) rootParent).getInsets(); }
[ "private", "Insets", "getParentInsets", "(", ")", "{", "if", "(", "rootParent", "instanceof", "JApplet", ")", "{", "return", "(", "(", "JApplet", ")", "rootParent", ")", ".", "getInsets", "(", ")", ";", "}", "return", "(", "(", "Window", ")", "rootParent", ")", ".", "getInsets", "(", ")", ";", "}" ]
Get the parent insets. @return the insets.
[ "Get", "the", "parent", "insets", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L732-L738
840
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java
SeaGlassTitlePane.getTitle
private String getTitle(String text, FontMetrics fm, int availTextWidth) { return SwingUtilities2.clipStringIfNecessary(rootPane, fm, text, availTextWidth); }
java
private String getTitle(String text, FontMetrics fm, int availTextWidth) { return SwingUtilities2.clipStringIfNecessary(rootPane, fm, text, availTextWidth); }
[ "private", "String", "getTitle", "(", "String", "text", ",", "FontMetrics", "fm", ",", "int", "availTextWidth", ")", "{", "return", "SwingUtilities2", ".", "clipStringIfNecessary", "(", "rootPane", ",", "fm", ",", "text", ",", "availTextWidth", ")", ";", "}" ]
Get the title text, clipped if necessary. @param text the title text. @param fm the font metrics to compute size with. @param availTextWidth the available space to display the title in. @return the text, clipped to fit the available space.
[ "Get", "the", "title", "text", "clipped", "if", "necessary", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassTitlePane.java#L762-L764
841
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java
SeaGlassButtonUI.updateStyle
public void updateStyle(AbstractButton b) { SeaGlassContext context = getContext(b, SynthConstants.ENABLED); SynthStyle oldStyle = style; style = SeaGlassLookAndFeel.updateStyle(context, this); if (style != oldStyle) { if (b.getMargin() == null || (b.getMargin() instanceof UIResource)) { Insets margin = (Insets) style.get(context, getPropertyPrefix() + "margin"); if (margin == null) { // Some places assume margins are non-null. margin = SeaGlassLookAndFeel.EMPTY_UIRESOURCE_INSETS; } b.setMargin(margin); } Object value = style.get(context, getPropertyPrefix() + "iconTextGap"); if (value != null) { LookAndFeel.installProperty(b, "iconTextGap", value); } value = style.get(context, getPropertyPrefix() + "contentAreaFilled"); LookAndFeel.installProperty(b, "contentAreaFilled", value != null ? value : Boolean.TRUE); value = b.getClientProperty(APPLE_PREFIX + "buttonType"); if (value != null) { if ("segmented".equals(value)) { b.setMargin(SeaGlassLookAndFeel.EMPTY_UIRESOURCE_INSETS); } } if (oldStyle != null) { uninstallKeyboardActions(b); installKeyboardActions(b); } } context.dispose(); }
java
public void updateStyle(AbstractButton b) { SeaGlassContext context = getContext(b, SynthConstants.ENABLED); SynthStyle oldStyle = style; style = SeaGlassLookAndFeel.updateStyle(context, this); if (style != oldStyle) { if (b.getMargin() == null || (b.getMargin() instanceof UIResource)) { Insets margin = (Insets) style.get(context, getPropertyPrefix() + "margin"); if (margin == null) { // Some places assume margins are non-null. margin = SeaGlassLookAndFeel.EMPTY_UIRESOURCE_INSETS; } b.setMargin(margin); } Object value = style.get(context, getPropertyPrefix() + "iconTextGap"); if (value != null) { LookAndFeel.installProperty(b, "iconTextGap", value); } value = style.get(context, getPropertyPrefix() + "contentAreaFilled"); LookAndFeel.installProperty(b, "contentAreaFilled", value != null ? value : Boolean.TRUE); value = b.getClientProperty(APPLE_PREFIX + "buttonType"); if (value != null) { if ("segmented".equals(value)) { b.setMargin(SeaGlassLookAndFeel.EMPTY_UIRESOURCE_INSETS); } } if (oldStyle != null) { uninstallKeyboardActions(b); installKeyboardActions(b); } } context.dispose(); }
[ "public", "void", "updateStyle", "(", "AbstractButton", "b", ")", "{", "SeaGlassContext", "context", "=", "getContext", "(", "b", ",", "SynthConstants", ".", "ENABLED", ")", ";", "SynthStyle", "oldStyle", "=", "style", ";", "style", "=", "SeaGlassLookAndFeel", ".", "updateStyle", "(", "context", ",", "this", ")", ";", "if", "(", "style", "!=", "oldStyle", ")", "{", "if", "(", "b", ".", "getMargin", "(", ")", "==", "null", "||", "(", "b", ".", "getMargin", "(", ")", "instanceof", "UIResource", ")", ")", "{", "Insets", "margin", "=", "(", "Insets", ")", "style", ".", "get", "(", "context", ",", "getPropertyPrefix", "(", ")", "+", "\"margin\"", ")", ";", "if", "(", "margin", "==", "null", ")", "{", "// Some places assume margins are non-null.", "margin", "=", "SeaGlassLookAndFeel", ".", "EMPTY_UIRESOURCE_INSETS", ";", "}", "b", ".", "setMargin", "(", "margin", ")", ";", "}", "Object", "value", "=", "style", ".", "get", "(", "context", ",", "getPropertyPrefix", "(", ")", "+", "\"iconTextGap\"", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "LookAndFeel", ".", "installProperty", "(", "b", ",", "\"iconTextGap\"", ",", "value", ")", ";", "}", "value", "=", "style", ".", "get", "(", "context", ",", "getPropertyPrefix", "(", ")", "+", "\"contentAreaFilled\"", ")", ";", "LookAndFeel", ".", "installProperty", "(", "b", ",", "\"contentAreaFilled\"", ",", "value", "!=", "null", "?", "value", ":", "Boolean", ".", "TRUE", ")", ";", "value", "=", "b", ".", "getClientProperty", "(", "APPLE_PREFIX", "+", "\"buttonType\"", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "\"segmented\"", ".", "equals", "(", "value", ")", ")", "{", "b", ".", "setMargin", "(", "SeaGlassLookAndFeel", ".", "EMPTY_UIRESOURCE_INSETS", ")", ";", "}", "}", "if", "(", "oldStyle", "!=", "null", ")", "{", "uninstallKeyboardActions", "(", "b", ")", ";", "installKeyboardActions", "(", "b", ")", ";", "}", "}", "context", ".", "dispose", "(", ")", ";", "}" ]
Update the style of the button. @param b the button.
[ "Update", "the", "style", "of", "the", "button", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java#L96-L136
842
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java
SeaGlassButtonUI.paint
protected void paint(SeaGlassContext context, Graphics g) { AbstractButton b = (AbstractButton) context.getComponent(); g.setColor(context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND)); g.setFont(style.getFont(context)); context.getStyle().getGraphicsUtils(context).paintText(context, g, b.getText(), getIcon(b), b.getHorizontalAlignment(), b.getVerticalAlignment(), b.getHorizontalTextPosition(), b.getVerticalTextPosition(), b.getIconTextGap(), b.getDisplayedMnemonicIndex(), getTextShiftOffset(context)); }
java
protected void paint(SeaGlassContext context, Graphics g) { AbstractButton b = (AbstractButton) context.getComponent(); g.setColor(context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND)); g.setFont(style.getFont(context)); context.getStyle().getGraphicsUtils(context).paintText(context, g, b.getText(), getIcon(b), b.getHorizontalAlignment(), b.getVerticalAlignment(), b.getHorizontalTextPosition(), b.getVerticalTextPosition(), b.getIconTextGap(), b.getDisplayedMnemonicIndex(), getTextShiftOffset(context)); }
[ "protected", "void", "paint", "(", "SeaGlassContext", "context", ",", "Graphics", "g", ")", "{", "AbstractButton", "b", "=", "(", "AbstractButton", ")", "context", ".", "getComponent", "(", ")", ";", "g", ".", "setColor", "(", "context", ".", "getStyle", "(", ")", ".", "getColor", "(", "context", ",", "ColorType", ".", "TEXT_FOREGROUND", ")", ")", ";", "g", ".", "setFont", "(", "style", ".", "getFont", "(", "context", ")", ")", ";", "context", ".", "getStyle", "(", ")", ".", "getGraphicsUtils", "(", "context", ")", ".", "paintText", "(", "context", ",", "g", ",", "b", ".", "getText", "(", ")", ",", "getIcon", "(", "b", ")", ",", "b", ".", "getHorizontalAlignment", "(", ")", ",", "b", ".", "getVerticalAlignment", "(", ")", ",", "b", ".", "getHorizontalTextPosition", "(", ")", ",", "b", ".", "getVerticalTextPosition", "(", ")", ",", "b", ".", "getIconTextGap", "(", ")", ",", "b", ".", "getDisplayedMnemonicIndex", "(", ")", ",", "getTextShiftOffset", "(", "context", ")", ")", ";", "}" ]
Paint the button. @param context the Synth context. @param g the Graphics context.
[ "Paint", "the", "button", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java#L323-L332
843
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java
SeaGlassButtonUI.paintBackground
void paintBackground(SeaGlassContext context, Graphics g, JComponent c) { if (((AbstractButton) c).isContentAreaFilled()) { context.getPainter().paintButtonBackground(context, g, 0, 0, c.getWidth(), c.getHeight()); } }
java
void paintBackground(SeaGlassContext context, Graphics g, JComponent c) { if (((AbstractButton) c).isContentAreaFilled()) { context.getPainter().paintButtonBackground(context, g, 0, 0, c.getWidth(), c.getHeight()); } }
[ "void", "paintBackground", "(", "SeaGlassContext", "context", ",", "Graphics", "g", ",", "JComponent", "c", ")", "{", "if", "(", "(", "(", "AbstractButton", ")", "c", ")", ".", "isContentAreaFilled", "(", ")", ")", "{", "context", ".", "getPainter", "(", ")", ".", "paintButtonBackground", "(", "context", ",", "g", ",", "0", ",", "0", ",", "c", ".", "getWidth", "(", ")", ",", "c", ".", "getHeight", "(", ")", ")", ";", "}", "}" ]
Paint the button background. @param context the Synth context. @param g the Graphics context. @param c the button component.
[ "Paint", "the", "button", "background", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java#L341-L345
844
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java
SeaGlassButtonUI.getDefaultIcon
protected Icon getDefaultIcon(AbstractButton b) { SeaGlassContext context = getContext(b); Icon icon = context.getStyle().getIcon(context, getPropertyPrefix() + "icon"); context.dispose(); return icon; }
java
protected Icon getDefaultIcon(AbstractButton b) { SeaGlassContext context = getContext(b); Icon icon = context.getStyle().getIcon(context, getPropertyPrefix() + "icon"); context.dispose(); return icon; }
[ "protected", "Icon", "getDefaultIcon", "(", "AbstractButton", "b", ")", "{", "SeaGlassContext", "context", "=", "getContext", "(", "b", ")", ";", "Icon", "icon", "=", "context", ".", "getStyle", "(", ")", ".", "getIcon", "(", "context", ",", "getPropertyPrefix", "(", ")", "+", "\"icon\"", ")", ";", "context", ".", "dispose", "(", ")", ";", "return", "icon", ";", "}" ]
Returns the default icon. This should NOT callback to the JComponent. @param b AbstractButton the iocn is associated with. @return the default icon.
[ "Returns", "the", "default", "icon", ".", "This", "should", "NOT", "callback", "to", "the", "JComponent", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java#L363-L369
845
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java
SeaGlassButtonUI.getIcon
protected Icon getIcon(AbstractButton b) { Icon icon = b.getIcon(); ButtonModel model = b.getModel(); if (!model.isEnabled()) { icon = getSynthDisabledIcon(b, icon); } else if (model.isPressed() && model.isArmed()) { icon = getPressedIcon(b, getSelectedIcon(b, icon)); } else if (b.isRolloverEnabled() && model.isRollover()) { icon = getRolloverIcon(b, getSelectedIcon(b, icon)); } else if (model.isSelected()) { icon = getSelectedIcon(b, icon); } else { icon = getEnabledIcon(b, icon); } if (icon == null) { return getDefaultIcon(b); } return icon; }
java
protected Icon getIcon(AbstractButton b) { Icon icon = b.getIcon(); ButtonModel model = b.getModel(); if (!model.isEnabled()) { icon = getSynthDisabledIcon(b, icon); } else if (model.isPressed() && model.isArmed()) { icon = getPressedIcon(b, getSelectedIcon(b, icon)); } else if (b.isRolloverEnabled() && model.isRollover()) { icon = getRolloverIcon(b, getSelectedIcon(b, icon)); } else if (model.isSelected()) { icon = getSelectedIcon(b, icon); } else { icon = getEnabledIcon(b, icon); } if (icon == null) { return getDefaultIcon(b); } return icon; }
[ "protected", "Icon", "getIcon", "(", "AbstractButton", "b", ")", "{", "Icon", "icon", "=", "b", ".", "getIcon", "(", ")", ";", "ButtonModel", "model", "=", "b", ".", "getModel", "(", ")", ";", "if", "(", "!", "model", ".", "isEnabled", "(", ")", ")", "{", "icon", "=", "getSynthDisabledIcon", "(", "b", ",", "icon", ")", ";", "}", "else", "if", "(", "model", ".", "isPressed", "(", ")", "&&", "model", ".", "isArmed", "(", ")", ")", "{", "icon", "=", "getPressedIcon", "(", "b", ",", "getSelectedIcon", "(", "b", ",", "icon", ")", ")", ";", "}", "else", "if", "(", "b", ".", "isRolloverEnabled", "(", ")", "&&", "model", ".", "isRollover", "(", ")", ")", "{", "icon", "=", "getRolloverIcon", "(", "b", ",", "getSelectedIcon", "(", "b", ",", "icon", ")", ")", ";", "}", "else", "if", "(", "model", ".", "isSelected", "(", ")", ")", "{", "icon", "=", "getSelectedIcon", "(", "b", ",", "icon", ")", ";", "}", "else", "{", "icon", "=", "getEnabledIcon", "(", "b", ",", "icon", ")", ";", "}", "if", "(", "icon", "==", "null", ")", "{", "return", "getDefaultIcon", "(", "b", ")", ";", "}", "return", "icon", ";", "}" ]
Returns the Icon to use in painting the button. @param b the button. @return the icon.
[ "Returns", "the", "Icon", "to", "use", "in", "painting", "the", "button", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java#L378-L399
846
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassMenuUI.java
SeaGlassMenuUI.paint
protected void paint(SynthContext context, Graphics g) { SeaGlassContext accContext = getContext(menuItem, Region.MENU_ITEM_ACCELERATOR); // Refetch the appropriate check indicator for the current state String prefix = getPropertyPrefix(); Icon checkIcon = style.getIcon(context, prefix + ".checkIcon"); Icon arrowIcon = style.getIcon(context, prefix + ".arrowIcon"); SeaGlassGraphicsUtils.paint(context, accContext, g, checkIcon, arrowIcon, acceleratorDelimiter, defaultTextIconGap, getPropertyPrefix()); accContext.dispose(); }
java
protected void paint(SynthContext context, Graphics g) { SeaGlassContext accContext = getContext(menuItem, Region.MENU_ITEM_ACCELERATOR); // Refetch the appropriate check indicator for the current state String prefix = getPropertyPrefix(); Icon checkIcon = style.getIcon(context, prefix + ".checkIcon"); Icon arrowIcon = style.getIcon(context, prefix + ".arrowIcon"); SeaGlassGraphicsUtils.paint(context, accContext, g, checkIcon, arrowIcon, acceleratorDelimiter, defaultTextIconGap, getPropertyPrefix()); accContext.dispose(); }
[ "protected", "void", "paint", "(", "SynthContext", "context", ",", "Graphics", "g", ")", "{", "SeaGlassContext", "accContext", "=", "getContext", "(", "menuItem", ",", "Region", ".", "MENU_ITEM_ACCELERATOR", ")", ";", "// Refetch the appropriate check indicator for the current state\r", "String", "prefix", "=", "getPropertyPrefix", "(", ")", ";", "Icon", "checkIcon", "=", "style", ".", "getIcon", "(", "context", ",", "prefix", "+", "\".checkIcon\"", ")", ";", "Icon", "arrowIcon", "=", "style", ".", "getIcon", "(", "context", ",", "prefix", "+", "\".arrowIcon\"", ")", ";", "SeaGlassGraphicsUtils", ".", "paint", "(", "context", ",", "accContext", ",", "g", ",", "checkIcon", ",", "arrowIcon", ",", "acceleratorDelimiter", ",", "defaultTextIconGap", ",", "getPropertyPrefix", "(", ")", ")", ";", "accContext", ".", "dispose", "(", ")", ";", "}" ]
Paints the specified component. This implementation does nothing. @param context context for the component being painted @param g the {@code Graphics} object used for painting @see #update(Graphics,JComponent)
[ "Paints", "the", "specified", "component", ".", "This", "implementation", "does", "nothing", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassMenuUI.java#L278-L287
847
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paint
private void paint(SeaGlassPainter p, SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) { if (p != null) { if (g instanceof Graphics2D) { Graphics2D gfx = (Graphics2D) g; if (transform != null) { gfx.transform(transform); } gfx.translate(x, y); p.paint(gfx, ctx.getComponent(), w, h); gfx.translate(-x, -y); if (transform != null) { try { gfx.transform(transform.createInverse()); } catch (NoninvertibleTransformException e) { // this should never happen as we are in control of all // calls into this method and only ever pass in simple // transforms of rotate, flip and translates e.printStackTrace(); } } } else { // use image if we are printing to a Java 1.1 PrintGraphics as // it is not a instance of Graphics2D BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); Graphics2D gfx = img.createGraphics(); if (transform != null) { gfx.transform(transform); } p.paint(gfx, ctx.getComponent(), w, h); gfx.dispose(); g.drawImage(img, x, y, null); img = null; } } }
java
private void paint(SeaGlassPainter p, SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) { if (p != null) { if (g instanceof Graphics2D) { Graphics2D gfx = (Graphics2D) g; if (transform != null) { gfx.transform(transform); } gfx.translate(x, y); p.paint(gfx, ctx.getComponent(), w, h); gfx.translate(-x, -y); if (transform != null) { try { gfx.transform(transform.createInverse()); } catch (NoninvertibleTransformException e) { // this should never happen as we are in control of all // calls into this method and only ever pass in simple // transforms of rotate, flip and translates e.printStackTrace(); } } } else { // use image if we are printing to a Java 1.1 PrintGraphics as // it is not a instance of Graphics2D BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); Graphics2D gfx = img.createGraphics(); if (transform != null) { gfx.transform(transform); } p.paint(gfx, ctx.getComponent(), w, h); gfx.dispose(); g.drawImage(img, x, y, null); img = null; } } }
[ "private", "void", "paint", "(", "SeaGlassPainter", "p", ",", "SynthContext", "ctx", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "AffineTransform", "transform", ")", "{", "if", "(", "p", "!=", "null", ")", "{", "if", "(", "g", "instanceof", "Graphics2D", ")", "{", "Graphics2D", "gfx", "=", "(", "Graphics2D", ")", "g", ";", "if", "(", "transform", "!=", "null", ")", "{", "gfx", ".", "transform", "(", "transform", ")", ";", "}", "gfx", ".", "translate", "(", "x", ",", "y", ")", ";", "p", ".", "paint", "(", "gfx", ",", "ctx", ".", "getComponent", "(", ")", ",", "w", ",", "h", ")", ";", "gfx", ".", "translate", "(", "-", "x", ",", "-", "y", ")", ";", "if", "(", "transform", "!=", "null", ")", "{", "try", "{", "gfx", ".", "transform", "(", "transform", ".", "createInverse", "(", ")", ")", ";", "}", "catch", "(", "NoninvertibleTransformException", "e", ")", "{", "// this should never happen as we are in control of all", "// calls into this method and only ever pass in simple", "// transforms of rotate, flip and translates", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "else", "{", "// use image if we are printing to a Java 1.1 PrintGraphics as", "// it is not a instance of Graphics2D", "BufferedImage", "img", "=", "new", "BufferedImage", "(", "w", ",", "h", ",", "BufferedImage", ".", "TYPE_INT_ARGB", ")", ";", "Graphics2D", "gfx", "=", "img", ".", "createGraphics", "(", ")", ";", "if", "(", "transform", "!=", "null", ")", "{", "gfx", ".", "transform", "(", "transform", ")", ";", "}", "p", ".", "paint", "(", "gfx", ",", "ctx", ".", "getComponent", "(", ")", ",", "w", ",", "h", ")", ";", "gfx", ".", "dispose", "(", ")", ";", "g", ".", "drawImage", "(", "img", ",", "x", ",", "y", ",", "null", ")", ";", "img", "=", "null", ";", "}", "}", "}" ]
Paint the provided painter using the provided transform at the specified position and size. Handles if g is a non 2D Graphics by painting via a BufferedImage. @param p the painter to use. @param ctx the SynthContext describing the component/region, the style, and the state. @param g the Graphics context to paint with. @param x the left-most portion of the object to paint. @param y the upper-most portion of the object to paint. @param w the width to paint. @param h the height to paint. @param transform the affine transform to apply, or {@code null} if none is to be applied.
[ "Paint", "the", "provided", "painter", "using", "the", "provided", "transform", "at", "the", "specified", "position", "and", "size", ".", "Handles", "if", "g", "is", "a", "non", "2D", "Graphics", "by", "painting", "via", "a", "BufferedImage", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L74-L117
848
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintForeground
private void paintForeground(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) { SeaGlassPainter foregroundPainter = style.getForegroundPainter(ctx); if (foregroundPainter != null) { paint(foregroundPainter, ctx, g, x, y, w, h, transform); } }
java
private void paintForeground(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) { SeaGlassPainter foregroundPainter = style.getForegroundPainter(ctx); if (foregroundPainter != null) { paint(foregroundPainter, ctx, g, x, y, w, h, transform); } }
[ "private", "void", "paintForeground", "(", "SynthContext", "ctx", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "AffineTransform", "transform", ")", "{", "SeaGlassPainter", "foregroundPainter", "=", "style", ".", "getForegroundPainter", "(", "ctx", ")", ";", "if", "(", "foregroundPainter", "!=", "null", ")", "{", "paint", "(", "foregroundPainter", ",", "ctx", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "transform", ")", ";", "}", "}" ]
Paint the object's foreground. @param ctx the SynthContext. @param g the Graphics context. @param x the x location corresponding to the upper-left coordinate to paint. @param y the y location corresponding to the upper left coordinate to paint. @param w the width to paint. @param h the height to paint. @param transform the affine transform to apply, or {@code null} if none is to be applied.
[ "Paint", "the", "object", "s", "foreground", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L164-L170
849
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintBorder
private void paintBorder(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) { SeaGlassPainter borderPainter = style.getBorderPainter(ctx); if (borderPainter != null) { paint(borderPainter, ctx, g, x, y, w, h, transform); } }
java
private void paintBorder(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) { SeaGlassPainter borderPainter = style.getBorderPainter(ctx); if (borderPainter != null) { paint(borderPainter, ctx, g, x, y, w, h, transform); } }
[ "private", "void", "paintBorder", "(", "SynthContext", "ctx", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "AffineTransform", "transform", ")", "{", "SeaGlassPainter", "borderPainter", "=", "style", ".", "getBorderPainter", "(", "ctx", ")", ";", "if", "(", "borderPainter", "!=", "null", ")", "{", "paint", "(", "borderPainter", ",", "ctx", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "transform", ")", ";", "}", "}" ]
Paint the object's border. @param ctx the SynthContext. @param g the Graphics context. @param x the x location corresponding to the upper-left coordinate to paint. @param y the y location corresponding to the upper left coordinate to paint. @param w the width to paint. @param h the height to paint. @param transform the affine transform to apply, or {@code null} if none is to be applied.
[ "Paint", "the", "object", "s", "border", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L186-L192
850
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintSearchButtonForeground
public void paintSearchButtonForeground(SynthContext context, Graphics g, int x, int y, int w, int h) { paintForeground(context, g, x, y, w, h, null); }
java
public void paintSearchButtonForeground(SynthContext context, Graphics g, int x, int y, int w, int h) { paintForeground(context, g, x, y, w, h, null); }
[ "public", "void", "paintSearchButtonForeground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "paintForeground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}" ]
Paints the foreground of a search field button. This method is responsible for drawing a graphical representation of a find or cancel button. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to
[ "Paints", "the", "foreground", "of", "a", "search", "field", "button", ".", "This", "method", "is", "responsible", "for", "drawing", "a", "graphical", "representation", "of", "a", "find", "or", "cancel", "button", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L450-L452
851
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintSeparatorForeground
public void paintSeparatorForeground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { paintForeground(context, g, x, y, w, h, orientation); }
java
public void paintSeparatorForeground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { paintForeground(context, g, x, y, w, h, orientation); }
[ "public", "void", "paintSeparatorForeground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "orientation", ")", "{", "paintForeground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "orientation", ")", ";", "}" ]
Paints the foreground of a separator. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JSeparator.HORIZONTAL</code> or <code> JSeparator.VERTICAL</code>
[ "Paints", "the", "foreground", "of", "a", "separator", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1598-L1600
852
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintSliderThumbBackground
public void paintSliderThumbBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { if (context.getComponent().getClientProperty("Slider.paintThumbArrowShape") == Boolean.TRUE) { if (orientation == JSlider.HORIZONTAL) { orientation = JSlider.VERTICAL; } else { orientation = JSlider.HORIZONTAL; } paintBackground(context, g, x, y, w, h, orientation); } else { paintBackground(context, g, x, y, w, h, orientation); } }
java
public void paintSliderThumbBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { if (context.getComponent().getClientProperty("Slider.paintThumbArrowShape") == Boolean.TRUE) { if (orientation == JSlider.HORIZONTAL) { orientation = JSlider.VERTICAL; } else { orientation = JSlider.HORIZONTAL; } paintBackground(context, g, x, y, w, h, orientation); } else { paintBackground(context, g, x, y, w, h, orientation); } }
[ "public", "void", "paintSliderThumbBackground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "orientation", ")", "{", "if", "(", "context", ".", "getComponent", "(", ")", ".", "getClientProperty", "(", "\"Slider.paintThumbArrowShape\"", ")", "==", "Boolean", ".", "TRUE", ")", "{", "if", "(", "orientation", "==", "JSlider", ".", "HORIZONTAL", ")", "{", "orientation", "=", "JSlider", ".", "VERTICAL", ";", "}", "else", "{", "orientation", "=", "JSlider", ".", "HORIZONTAL", ";", "}", "paintBackground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "orientation", ")", ";", "}", "else", "{", "paintBackground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "orientation", ")", ";", "}", "}" ]
Paints the background of the thumb of a slider. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JSlider.HORIZONTAL</code> or <code> JSlider.VERTICAL</code>
[ "Paints", "the", "background", "of", "the", "thumb", "of", "a", "slider", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1681-L1694
853
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintSplitPaneDividerBackground
public void paintSplitPaneDividerBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { if (orientation == JSplitPane.HORIZONTAL_SPLIT) { AffineTransform transform = new AffineTransform(); transform.scale(-1, 1); transform.rotate(Math.toRadians(90)); paintBackground(context, g, y, x, h, w, transform); } else { paintBackground(context, g, x, y, w, h, null); } }
java
public void paintSplitPaneDividerBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { if (orientation == JSplitPane.HORIZONTAL_SPLIT) { AffineTransform transform = new AffineTransform(); transform.scale(-1, 1); transform.rotate(Math.toRadians(90)); paintBackground(context, g, y, x, h, w, transform); } else { paintBackground(context, g, x, y, w, h, null); } }
[ "public", "void", "paintSplitPaneDividerBackground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "orientation", ")", "{", "if", "(", "orientation", "==", "JSplitPane", ".", "HORIZONTAL_SPLIT", ")", "{", "AffineTransform", "transform", "=", "new", "AffineTransform", "(", ")", ";", "transform", ".", "scale", "(", "-", "1", ",", "1", ")", ";", "transform", ".", "rotate", "(", "Math", ".", "toRadians", "(", "90", ")", ")", ";", "paintBackground", "(", "context", ",", "g", ",", "y", ",", "x", ",", "h", ",", "w", ",", "transform", ")", ";", "}", "else", "{", "paintBackground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}", "}" ]
Paints the background of the divider of a split pane. This implementation invokes the method of the same name without the orientation. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JSplitPane.HORIZONTAL_SPLIT</code> or <code>JSplitPane.VERTICAL_SPLIT</code>
[ "Paints", "the", "background", "of", "the", "divider", "of", "a", "split", "pane", ".", "This", "implementation", "invokes", "the", "method", "of", "the", "same", "name", "without", "the", "orientation", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1838-L1848
854
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintSplitPaneDividerForeground
public void paintSplitPaneDividerForeground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { paintForeground(context, g, x, y, w, h, null); }
java
public void paintSplitPaneDividerForeground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { paintForeground(context, g, x, y, w, h, null); }
[ "public", "void", "paintSplitPaneDividerForeground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "orientation", ")", "{", "paintForeground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}" ]
Paints the foreground of the divider of a split pane. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JSplitPane.HORIZONTAL_SPLIT</code> or <code>JSplitPane.VERTICAL_SPLIT</code>
[ "Paints", "the", "foreground", "of", "the", "divider", "of", "a", "split", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1863-L1865
855
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintSplitPaneDragDivider
public void paintSplitPaneDragDivider(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { paintBackground(context, g, x, y, w, h, null); }
java
public void paintSplitPaneDragDivider(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { paintBackground(context, g, x, y, w, h, null); }
[ "public", "void", "paintSplitPaneDragDivider", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "orientation", ")", "{", "paintBackground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}" ]
Paints the divider, when the user is dragging the divider, of a split pane. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JSplitPane.HORIZONTAL_SPLIT</code> or <code>JSplitPane.VERTICAL_SPLIT</code>
[ "Paints", "the", "divider", "when", "the", "user", "is", "dragging", "the", "divider", "of", "a", "split", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1881-L1883
856
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintTabbedPaneBorder
public void paintTabbedPaneBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { paintBorder(context, g, x, y, w, h, null); }
java
public void paintTabbedPaneBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { paintBorder(context, g, x, y, w, h, null); }
[ "public", "void", "paintTabbedPaneBorder", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "paintBorder", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}" ]
Paints the border of a tabbed pane. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to
[ "Paints", "the", "border", "of", "a", "tabbed", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1941-L1943
857
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintTabbedPaneTabAreaBackground
public void paintTabbedPaneTabAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { paintBackground(context, g, x, y, w, h, null); }
java
public void paintTabbedPaneTabAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { paintBackground(context, g, x, y, w, h, null); }
[ "public", "void", "paintTabbedPaneTabAreaBackground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "paintBackground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}" ]
Paints the background of the area behind the tabs of a tabbed pane. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to
[ "Paints", "the", "background", "of", "the", "area", "behind", "the", "tabs", "of", "a", "tabbed", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1956-L1958
858
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintTabbedPaneTabAreaBackground
public void paintTabbedPaneTabAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { if (orientation == JTabbedPane.LEFT) { AffineTransform transform = new AffineTransform(); transform.scale(-1, 1); transform.rotate(Math.toRadians(90)); paintBackground(context, g, y, x, h, w, transform); } else if (orientation == JTabbedPane.RIGHT) { AffineTransform transform = new AffineTransform(); transform.rotate(Math.toRadians(90)); transform.translate(0, -(x + w)); paintBackground(context, g, y, 0, h, w, transform); } else if (orientation == JTabbedPane.BOTTOM) { AffineTransform transform = new AffineTransform(); transform.translate(x, y); paintBackground(context, g, 0, 0, w, h, transform); } else { paintBackground(context, g, x, y, w, h, null); } }
java
public void paintTabbedPaneTabAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { if (orientation == JTabbedPane.LEFT) { AffineTransform transform = new AffineTransform(); transform.scale(-1, 1); transform.rotate(Math.toRadians(90)); paintBackground(context, g, y, x, h, w, transform); } else if (orientation == JTabbedPane.RIGHT) { AffineTransform transform = new AffineTransform(); transform.rotate(Math.toRadians(90)); transform.translate(0, -(x + w)); paintBackground(context, g, y, 0, h, w, transform); } else if (orientation == JTabbedPane.BOTTOM) { AffineTransform transform = new AffineTransform(); transform.translate(x, y); paintBackground(context, g, 0, 0, w, h, transform); } else { paintBackground(context, g, x, y, w, h, null); } }
[ "public", "void", "paintTabbedPaneTabAreaBackground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "orientation", ")", "{", "if", "(", "orientation", "==", "JTabbedPane", ".", "LEFT", ")", "{", "AffineTransform", "transform", "=", "new", "AffineTransform", "(", ")", ";", "transform", ".", "scale", "(", "-", "1", ",", "1", ")", ";", "transform", ".", "rotate", "(", "Math", ".", "toRadians", "(", "90", ")", ")", ";", "paintBackground", "(", "context", ",", "g", ",", "y", ",", "x", ",", "h", ",", "w", ",", "transform", ")", ";", "}", "else", "if", "(", "orientation", "==", "JTabbedPane", ".", "RIGHT", ")", "{", "AffineTransform", "transform", "=", "new", "AffineTransform", "(", ")", ";", "transform", ".", "rotate", "(", "Math", ".", "toRadians", "(", "90", ")", ")", ";", "transform", ".", "translate", "(", "0", ",", "-", "(", "x", "+", "w", ")", ")", ";", "paintBackground", "(", "context", ",", "g", ",", "y", ",", "0", ",", "h", ",", "w", ",", "transform", ")", ";", "}", "else", "if", "(", "orientation", "==", "JTabbedPane", ".", "BOTTOM", ")", "{", "AffineTransform", "transform", "=", "new", "AffineTransform", "(", ")", ";", "transform", ".", "translate", "(", "x", ",", "y", ")", ";", "paintBackground", "(", "context", ",", "g", ",", "0", ",", "0", ",", "w", ",", "h", ",", "transform", ")", ";", "}", "else", "{", "paintBackground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}", "}" ]
Paints the background of the area behind the tabs of a tabbed pane. This implementation invokes the method of the same name without the orientation. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JTabbedPane.TOP</code>, <code> JTabbedPane.LEFT</code>, <code> JTabbedPane.BOTTOM</code> , or <code> JTabbedPane.RIGHT</code>
[ "Paints", "the", "background", "of", "the", "area", "behind", "the", "tabs", "of", "a", "tabbed", "pane", ".", "This", "implementation", "invokes", "the", "method", "of", "the", "same", "name", "without", "the", "orientation", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1977-L1998
859
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintTabbedPaneTabBackground
public void paintTabbedPaneTabBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex) { paintBackground(context, g, x, y, w, h, null); }
java
public void paintTabbedPaneTabBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex) { paintBackground(context, g, x, y, w, h, null); }
[ "public", "void", "paintTabbedPaneTabBackground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "tabIndex", ")", "{", "paintBackground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}" ]
Paints the background of a tab of a tabbed pane. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param tabIndex Index of tab being painted.
[ "Paints", "the", "background", "of", "a", "tab", "of", "a", "tabbed", "pane", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L2048-L2050
860
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintTabbedPaneTabBorder
public void paintTabbedPaneTabBorder(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex, int orientation) { paintBorder(context, g, x, y, w, h, null); }
java
public void paintTabbedPaneTabBorder(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex, int orientation) { paintBorder(context, g, x, y, w, h, null); }
[ "public", "void", "paintTabbedPaneTabBorder", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "tabIndex", ",", "int", "orientation", ")", "{", "paintBorder", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}" ]
Paints the border of a tab of a tabbed pane. This implementation invokes the method of the same name without the orientation. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param tabIndex Index of tab being painted. @param orientation One of <code>JTabbedPane.TOP</code>, <code> JTabbedPane.LEFT</code>, <code> JTabbedPane.BOTTOM</code> , or <code> JTabbedPane.RIGHT</code>
[ "Paints", "the", "border", "of", "a", "tab", "of", "a", "tabbed", "pane", ".", "This", "implementation", "invokes", "the", "method", "of", "the", "same", "name", "without", "the", "orientation", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L2127-L2129
861
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java
ArrowButtonPainter.paintForegroundDisabled
private void paintForegroundDisabled(Graphics2D g, int width, int height) { Shape s = decodeArrowPath(width, height); g.setPaint(disabledColor); g.fill(s); }
java
private void paintForegroundDisabled(Graphics2D g, int width, int height) { Shape s = decodeArrowPath(width, height); g.setPaint(disabledColor); g.fill(s); }
[ "private", "void", "paintForegroundDisabled", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ")", "{", "Shape", "s", "=", "decodeArrowPath", "(", "width", ",", "height", ")", ";", "g", ".", "setPaint", "(", "disabledColor", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "}" ]
Paint the arrow in disabled state. @param g the Graphics2D context to paint with. @param width the width. @param height the height.
[ "Paint", "the", "arrow", "in", "disabled", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java#L94-L100
862
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java
ArrowButtonPainter.paintForegroundEnabled
private void paintForegroundEnabled(Graphics2D g, int width, int height) { Shape s = decodeArrowPath(width, height); g.setPaint(enabledColor); g.fill(s); }
java
private void paintForegroundEnabled(Graphics2D g, int width, int height) { Shape s = decodeArrowPath(width, height); g.setPaint(enabledColor); g.fill(s); }
[ "private", "void", "paintForegroundEnabled", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ")", "{", "Shape", "s", "=", "decodeArrowPath", "(", "width", ",", "height", ")", ";", "g", ".", "setPaint", "(", "enabledColor", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "}" ]
Paint the arrow in enabled state. @param g the Graphics2D context to paint with. @param width the width. @param height the height.
[ "Paint", "the", "arrow", "in", "enabled", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java#L109-L115
863
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java
ArrowButtonPainter.paintForegroundPressed
private void paintForegroundPressed(Graphics2D g, int width, int height) { Shape s = decodeArrowPath(width, height); g.setPaint(pressedColor); g.fill(s); }
java
private void paintForegroundPressed(Graphics2D g, int width, int height) { Shape s = decodeArrowPath(width, height); g.setPaint(pressedColor); g.fill(s); }
[ "private", "void", "paintForegroundPressed", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ")", "{", "Shape", "s", "=", "decodeArrowPath", "(", "width", ",", "height", ")", ";", "g", ".", "setPaint", "(", "pressedColor", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "}" ]
Paint the arrow in pressed state. @param g the Graphics2D context to paint with. @param width the width. @param height the height.
[ "Paint", "the", "arrow", "in", "pressed", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java#L124-L130
864
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java
ArrowButtonPainter.decodeArrowPath
private Shape decodeArrowPath(int width, int height) { return shapeGenerator.createArrowLeft(width * 0.2, height * 0.2, width * 0.6, height * 0.6); }
java
private Shape decodeArrowPath(int width, int height) { return shapeGenerator.createArrowLeft(width * 0.2, height * 0.2, width * 0.6, height * 0.6); }
[ "private", "Shape", "decodeArrowPath", "(", "int", "width", ",", "int", "height", ")", "{", "return", "shapeGenerator", ".", "createArrowLeft", "(", "width", "*", "0.2", ",", "height", "*", "0.2", ",", "width", "*", "0.6", ",", "height", "*", "0.6", ")", ";", "}" ]
Create the arrow path. @param width the width. @param height the height. @return the arrow path.
[ "Create", "the", "arrow", "path", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java#L140-L142
865
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassComboPopup.java
SeaGlassComboPopup.configureList
@Override protected void configureList() { list.setFont(comboBox.getFont()); list.setBorder(null); list.setCellRenderer(comboBox.getRenderer()); list.setFocusable(false); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); int selectedIndex = comboBox.getSelectedIndex(); if (selectedIndex == -1) { list.clearSelection(); } else { list.setSelectedIndex(selectedIndex); list.ensureIndexIsVisible(selectedIndex); } installListListeners(); }
java
@Override protected void configureList() { list.setFont(comboBox.getFont()); list.setBorder(null); list.setCellRenderer(comboBox.getRenderer()); list.setFocusable(false); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); int selectedIndex = comboBox.getSelectedIndex(); if (selectedIndex == -1) { list.clearSelection(); } else { list.setSelectedIndex(selectedIndex); list.ensureIndexIsVisible(selectedIndex); } installListListeners(); }
[ "@", "Override", "protected", "void", "configureList", "(", ")", "{", "list", ".", "setFont", "(", "comboBox", ".", "getFont", "(", ")", ")", ";", "list", ".", "setBorder", "(", "null", ")", ";", "list", ".", "setCellRenderer", "(", "comboBox", ".", "getRenderer", "(", ")", ")", ";", "list", ".", "setFocusable", "(", "false", ")", ";", "list", ".", "setSelectionMode", "(", "ListSelectionModel", ".", "SINGLE_SELECTION", ")", ";", "int", "selectedIndex", "=", "comboBox", ".", "getSelectedIndex", "(", ")", ";", "if", "(", "selectedIndex", "==", "-", "1", ")", "{", "list", ".", "clearSelection", "(", ")", ";", "}", "else", "{", "list", ".", "setSelectedIndex", "(", "selectedIndex", ")", ";", "list", ".", "ensureIndexIsVisible", "(", "selectedIndex", ")", ";", "}", "installListListeners", "(", ")", ";", "}" ]
Configures the list which is used to hold the combo box items in the popup. This method is called when the UI class is created.
[ "Configures", "the", "list", "which", "is", "used", "to", "hold", "the", "combo", "box", "items", "in", "the", "popup", ".", "This", "method", "is", "called", "when", "the", "UI", "class", "is", "created", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassComboPopup.java#L111-L128
866
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassComboPopup.java
SeaGlassComboPopup.configurePopup
protected void configurePopup() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorderPainted(true); setBorder(LIST_BORDER); setOpaque(false); add(scroller); setDoubleBuffered(true); setFocusable(false); }
java
protected void configurePopup() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorderPainted(true); setBorder(LIST_BORDER); setOpaque(false); add(scroller); setDoubleBuffered(true); setFocusable(false); }
[ "protected", "void", "configurePopup", "(", ")", "{", "setLayout", "(", "new", "BoxLayout", "(", "this", ",", "BoxLayout", ".", "Y_AXIS", ")", ")", ";", "setBorderPainted", "(", "true", ")", ";", "setBorder", "(", "LIST_BORDER", ")", ";", "setOpaque", "(", "false", ")", ";", "add", "(", "scroller", ")", ";", "setDoubleBuffered", "(", "true", ")", ";", "setFocusable", "(", "false", ")", ";", "}" ]
Configures the popup portion of the combo box. This method is called when the UI class is created.
[ "Configures", "the", "popup", "portion", "of", "the", "combo", "box", ".", "This", "method", "is", "called", "when", "the", "UI", "class", "is", "created", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassComboPopup.java#L134-L142
867
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassComboPopup.java
SeaGlassComboPopup.computePopupBounds
protected Rectangle computePopupBounds(int px, int py, int pw, int ph) { Toolkit toolkit = Toolkit.getDefaultToolkit(); Rectangle screenBounds; int listWidth = getList().getPreferredSize().width; Insets margin = comboBox.getInsets(); if (hasScrollBars()) { px += margin.left; pw = Math.max(pw - margin.left - margin.right, listWidth + 16); } else { px += margin.left; pw = Math.max(pw - LEFT_SHIFT - margin.left, listWidth); } // Calculate the desktop dimensions relative to the combo box. GraphicsConfiguration gc = comboBox.getGraphicsConfiguration(); Point p = new Point(); SwingUtilities.convertPointFromScreen(p, comboBox); if (gc == null) { screenBounds = new Rectangle(p, toolkit.getScreenSize()); } else { // Get the screen insets. Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc); screenBounds = new Rectangle(gc.getBounds()); screenBounds.width -= (screenInsets.left + screenInsets.right); screenBounds.height -= (screenInsets.top + screenInsets.bottom); screenBounds.x += screenInsets.left; screenBounds.y += screenInsets.top; } if (isDropDown()) { if (isEditable()) { py -= margin.bottom + 2; } else { py -= margin.bottom; } } else { int yOffset = -margin.top; int selectedIndex = comboBox.getSelectedIndex(); if (selectedIndex <= 0) { py = -yOffset; } else { py = -yOffset - list.getCellBounds(0, selectedIndex - 1).height; } } // Compute the rectangle for the popup menu Rectangle rect = new Rectangle(px, Math.max(py, p.y + screenBounds.y), Math.min(screenBounds.width, pw), Math.min(screenBounds.height - 40, ph)); // Add the preferred scroll bar width, if the popup does not fit // on the available rectangle. if (rect.height < ph) { rect.width += 16; } return rect; }
java
protected Rectangle computePopupBounds(int px, int py, int pw, int ph) { Toolkit toolkit = Toolkit.getDefaultToolkit(); Rectangle screenBounds; int listWidth = getList().getPreferredSize().width; Insets margin = comboBox.getInsets(); if (hasScrollBars()) { px += margin.left; pw = Math.max(pw - margin.left - margin.right, listWidth + 16); } else { px += margin.left; pw = Math.max(pw - LEFT_SHIFT - margin.left, listWidth); } // Calculate the desktop dimensions relative to the combo box. GraphicsConfiguration gc = comboBox.getGraphicsConfiguration(); Point p = new Point(); SwingUtilities.convertPointFromScreen(p, comboBox); if (gc == null) { screenBounds = new Rectangle(p, toolkit.getScreenSize()); } else { // Get the screen insets. Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc); screenBounds = new Rectangle(gc.getBounds()); screenBounds.width -= (screenInsets.left + screenInsets.right); screenBounds.height -= (screenInsets.top + screenInsets.bottom); screenBounds.x += screenInsets.left; screenBounds.y += screenInsets.top; } if (isDropDown()) { if (isEditable()) { py -= margin.bottom + 2; } else { py -= margin.bottom; } } else { int yOffset = -margin.top; int selectedIndex = comboBox.getSelectedIndex(); if (selectedIndex <= 0) { py = -yOffset; } else { py = -yOffset - list.getCellBounds(0, selectedIndex - 1).height; } } // Compute the rectangle for the popup menu Rectangle rect = new Rectangle(px, Math.max(py, p.y + screenBounds.y), Math.min(screenBounds.width, pw), Math.min(screenBounds.height - 40, ph)); // Add the preferred scroll bar width, if the popup does not fit // on the available rectangle. if (rect.height < ph) { rect.width += 16; } return rect; }
[ "protected", "Rectangle", "computePopupBounds", "(", "int", "px", ",", "int", "py", ",", "int", "pw", ",", "int", "ph", ")", "{", "Toolkit", "toolkit", "=", "Toolkit", ".", "getDefaultToolkit", "(", ")", ";", "Rectangle", "screenBounds", ";", "int", "listWidth", "=", "getList", "(", ")", ".", "getPreferredSize", "(", ")", ".", "width", ";", "Insets", "margin", "=", "comboBox", ".", "getInsets", "(", ")", ";", "if", "(", "hasScrollBars", "(", ")", ")", "{", "px", "+=", "margin", ".", "left", ";", "pw", "=", "Math", ".", "max", "(", "pw", "-", "margin", ".", "left", "-", "margin", ".", "right", ",", "listWidth", "+", "16", ")", ";", "}", "else", "{", "px", "+=", "margin", ".", "left", ";", "pw", "=", "Math", ".", "max", "(", "pw", "-", "LEFT_SHIFT", "-", "margin", ".", "left", ",", "listWidth", ")", ";", "}", "// Calculate the desktop dimensions relative to the combo box.", "GraphicsConfiguration", "gc", "=", "comboBox", ".", "getGraphicsConfiguration", "(", ")", ";", "Point", "p", "=", "new", "Point", "(", ")", ";", "SwingUtilities", ".", "convertPointFromScreen", "(", "p", ",", "comboBox", ")", ";", "if", "(", "gc", "==", "null", ")", "{", "screenBounds", "=", "new", "Rectangle", "(", "p", ",", "toolkit", ".", "getScreenSize", "(", ")", ")", ";", "}", "else", "{", "// Get the screen insets.", "Insets", "screenInsets", "=", "Toolkit", ".", "getDefaultToolkit", "(", ")", ".", "getScreenInsets", "(", "gc", ")", ";", "screenBounds", "=", "new", "Rectangle", "(", "gc", ".", "getBounds", "(", ")", ")", ";", "screenBounds", ".", "width", "-=", "(", "screenInsets", ".", "left", "+", "screenInsets", ".", "right", ")", ";", "screenBounds", ".", "height", "-=", "(", "screenInsets", ".", "top", "+", "screenInsets", ".", "bottom", ")", ";", "screenBounds", ".", "x", "+=", "screenInsets", ".", "left", ";", "screenBounds", ".", "y", "+=", "screenInsets", ".", "top", ";", "}", "if", "(", "isDropDown", "(", ")", ")", "{", "if", "(", "isEditable", "(", ")", ")", "{", "py", "-=", "margin", ".", "bottom", "+", "2", ";", "}", "else", "{", "py", "-=", "margin", ".", "bottom", ";", "}", "}", "else", "{", "int", "yOffset", "=", "-", "margin", ".", "top", ";", "int", "selectedIndex", "=", "comboBox", ".", "getSelectedIndex", "(", ")", ";", "if", "(", "selectedIndex", "<=", "0", ")", "{", "py", "=", "-", "yOffset", ";", "}", "else", "{", "py", "=", "-", "yOffset", "-", "list", ".", "getCellBounds", "(", "0", ",", "selectedIndex", "-", "1", ")", ".", "height", ";", "}", "}", "// Compute the rectangle for the popup menu", "Rectangle", "rect", "=", "new", "Rectangle", "(", "px", ",", "Math", ".", "max", "(", "py", ",", "p", ".", "y", "+", "screenBounds", ".", "y", ")", ",", "Math", ".", "min", "(", "screenBounds", ".", "width", ",", "pw", ")", ",", "Math", ".", "min", "(", "screenBounds", ".", "height", "-", "40", ",", "ph", ")", ")", ";", "// Add the preferred scroll bar width, if the popup does not fit", "// on the available rectangle.", "if", "(", "rect", ".", "height", "<", "ph", ")", "{", "rect", ".", "width", "+=", "16", ";", "}", "return", "rect", ";", "}" ]
Calculate the placement and size of the popup portion of the combo box based on the combo box location and the enclosing screen bounds. If no transformations are required, then the returned rectangle will have the same values as the parameters. @param px starting x location @param py starting y location @param pw starting width @param ph starting height @return a rectangle which represents the placement and size of the popup
[ "Calculate", "the", "placement", "and", "size", "of", "the", "popup", "portion", "of", "the", "combo", "box", "based", "on", "the", "combo", "box", "location", "and", "the", "enclosing", "screen", "bounds", ".", "If", "no", "transformations", "are", "required", "then", "the", "returned", "rectangle", "will", "have", "the", "same", "values", "as", "the", "parameters", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassComboPopup.java#L157-L221
868
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassComboPopup.java
SeaGlassComboPopup.setListSelection
private void setListSelection(int selectedIndex) { if (selectedIndex == -1) { list.clearSelection(); } else { list.setSelectedIndex(selectedIndex); list.ensureIndexIsVisible(selectedIndex); } }
java
private void setListSelection(int selectedIndex) { if (selectedIndex == -1) { list.clearSelection(); } else { list.setSelectedIndex(selectedIndex); list.ensureIndexIsVisible(selectedIndex); } }
[ "private", "void", "setListSelection", "(", "int", "selectedIndex", ")", "{", "if", "(", "selectedIndex", "==", "-", "1", ")", "{", "list", ".", "clearSelection", "(", ")", ";", "}", "else", "{", "list", ".", "setSelectedIndex", "(", "selectedIndex", ")", ";", "list", ".", "ensureIndexIsVisible", "(", "selectedIndex", ")", ";", "}", "}" ]
Sets the list selection index to the selectedIndex. This method is used to synchronize the list selection with the combo box selection. @param selectedIndex the index to set the list
[ "Sets", "the", "list", "selection", "index", "to", "the", "selectedIndex", ".", "This", "method", "is", "used", "to", "synchronize", "the", "list", "selection", "with", "the", "combo", "box", "selection", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassComboPopup.java#L229-L236
869
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassComboPopup.java
SeaGlassComboPopup.getPopupLocation
private Point getPopupLocation() { Dimension popupSize = comboBox.getSize(); Insets insets = getInsets(); // reduce the width of the scrollpane by the insets so that the popup // is the same width as the combo box. popupSize.setSize(popupSize.width - (insets.right + insets.left), getPopupHeightForRowCount(getMaximumRowCount())); Rectangle popupBounds = computePopupBounds(0, comboBox.getBounds().height, popupSize.width, popupSize.height); Dimension scrollSize = popupBounds.getSize(); Point popupLocation = popupBounds.getLocation(); scroller.setMaximumSize(scrollSize); scroller.setPreferredSize(scrollSize); scroller.setMinimumSize(scrollSize); list.revalidate(); return popupLocation; }
java
private Point getPopupLocation() { Dimension popupSize = comboBox.getSize(); Insets insets = getInsets(); // reduce the width of the scrollpane by the insets so that the popup // is the same width as the combo box. popupSize.setSize(popupSize.width - (insets.right + insets.left), getPopupHeightForRowCount(getMaximumRowCount())); Rectangle popupBounds = computePopupBounds(0, comboBox.getBounds().height, popupSize.width, popupSize.height); Dimension scrollSize = popupBounds.getSize(); Point popupLocation = popupBounds.getLocation(); scroller.setMaximumSize(scrollSize); scroller.setPreferredSize(scrollSize); scroller.setMinimumSize(scrollSize); list.revalidate(); return popupLocation; }
[ "private", "Point", "getPopupLocation", "(", ")", "{", "Dimension", "popupSize", "=", "comboBox", ".", "getSize", "(", ")", ";", "Insets", "insets", "=", "getInsets", "(", ")", ";", "// reduce the width of the scrollpane by the insets so that the popup", "// is the same width as the combo box.", "popupSize", ".", "setSize", "(", "popupSize", ".", "width", "-", "(", "insets", ".", "right", "+", "insets", ".", "left", ")", ",", "getPopupHeightForRowCount", "(", "getMaximumRowCount", "(", ")", ")", ")", ";", "Rectangle", "popupBounds", "=", "computePopupBounds", "(", "0", ",", "comboBox", ".", "getBounds", "(", ")", ".", "height", ",", "popupSize", ".", "width", ",", "popupSize", ".", "height", ")", ";", "Dimension", "scrollSize", "=", "popupBounds", ".", "getSize", "(", ")", ";", "Point", "popupLocation", "=", "popupBounds", ".", "getLocation", "(", ")", ";", "scroller", ".", "setMaximumSize", "(", "scrollSize", ")", ";", "scroller", ".", "setPreferredSize", "(", "scrollSize", ")", ";", "scroller", ".", "setMinimumSize", "(", "scrollSize", ")", ";", "list", ".", "revalidate", "(", ")", ";", "return", "popupLocation", ";", "}" ]
Calculates the upper left location of the Popup. @return the Point representing the upper-left coordinate of the Popup.
[ "Calculates", "the", "upper", "left", "location", "of", "the", "Popup", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassComboPopup.java#L268-L286
870
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassPanelUI.java
SeaGlassPanelUI.updateStyle
private void updateStyle(JPanel c) { SeaGlassContext context = getContext(c, ENABLED); style = SeaGlassLookAndFeel.updateStyle(context, this); context.dispose(); // Set the opacity according to whether the background has been set. // Don't set it if the user has already set it. LookAndFeel.installProperty(c, "opaque", !(c.getBackground() instanceof UIResource)); }
java
private void updateStyle(JPanel c) { SeaGlassContext context = getContext(c, ENABLED); style = SeaGlassLookAndFeel.updateStyle(context, this); context.dispose(); // Set the opacity according to whether the background has been set. // Don't set it if the user has already set it. LookAndFeel.installProperty(c, "opaque", !(c.getBackground() instanceof UIResource)); }
[ "private", "void", "updateStyle", "(", "JPanel", "c", ")", "{", "SeaGlassContext", "context", "=", "getContext", "(", "c", ",", "ENABLED", ")", ";", "style", "=", "SeaGlassLookAndFeel", ".", "updateStyle", "(", "context", ",", "this", ")", ";", "context", ".", "dispose", "(", ")", ";", "// Set the opacity according to whether the background has been set.", "// Don't set it if the user has already set it.", "LookAndFeel", ".", "installProperty", "(", "c", ",", "\"opaque\"", ",", "!", "(", "c", ".", "getBackground", "(", ")", "instanceof", "UIResource", ")", ")", ";", "}" ]
Update the Synth style if a property changes. @param c the panel.
[ "Update", "the", "Synth", "style", "if", "a", "property", "changes", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassPanelUI.java#L124-L133
871
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java
TabbedPaneTabCloseButtonPainter.drawBorder
private void drawBorder(Graphics2D g, int width, int height, Color color, float size) { int max = (int) (Math.min((height - 2) * size, height / 2.0f) + 0.5); int alphaDelta = color.getAlpha() / max; for (int i = 0; i < max; i++) { Shape s = shapeGenerator.createRoundRectangle(i, i, width - 2 * i - 1, height - 2 * i - 1, CornerSize.CHECKBOX_INTERIOR); Color newColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() - i * alphaDelta); g.setPaint(newColor); g.draw(s); } }
java
private void drawBorder(Graphics2D g, int width, int height, Color color, float size) { int max = (int) (Math.min((height - 2) * size, height / 2.0f) + 0.5); int alphaDelta = color.getAlpha() / max; for (int i = 0; i < max; i++) { Shape s = shapeGenerator.createRoundRectangle(i, i, width - 2 * i - 1, height - 2 * i - 1, CornerSize.CHECKBOX_INTERIOR); Color newColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() - i * alphaDelta); g.setPaint(newColor); g.draw(s); } }
[ "private", "void", "drawBorder", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ",", "Color", "color", ",", "float", "size", ")", "{", "int", "max", "=", "(", "int", ")", "(", "Math", ".", "min", "(", "(", "height", "-", "2", ")", "*", "size", ",", "height", "/", "2.0f", ")", "+", "0.5", ")", ";", "int", "alphaDelta", "=", "color", ".", "getAlpha", "(", ")", "/", "max", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "{", "Shape", "s", "=", "shapeGenerator", ".", "createRoundRectangle", "(", "i", ",", "i", ",", "width", "-", "2", "*", "i", "-", "1", ",", "height", "-", "2", "*", "i", "-", "1", ",", "CornerSize", ".", "CHECKBOX_INTERIOR", ")", ";", "Color", "newColor", "=", "new", "Color", "(", "color", ".", "getRed", "(", ")", ",", "color", ".", "getGreen", "(", ")", ",", "color", ".", "getBlue", "(", ")", ",", "color", ".", "getAlpha", "(", ")", "-", "i", "*", "alphaDelta", ")", ";", "g", ".", "setPaint", "(", "newColor", ")", ";", "g", ".", "draw", "(", "s", ")", ";", "}", "}" ]
Draw a border around the graphic. @param g the Graphic context. @param width the width of the border. @param height the height of the border. @param color the color of the border. @param size the spread of the border from outside in, expressed as a percentage of the height.
[ "Draw", "a", "border", "around", "the", "graphic", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java#L120-L131
872
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java
TabbedPaneTabCloseButtonPainter.drawEnabledGraphic
private void drawEnabledGraphic(Graphics2D g, int width, int height) { Shape s = shapeGenerator.createTabCloseIcon(2, 2, width - 4, height - 4); g.setPaint(createGraphicInnerShadowGradient(s)); g.fill(s); }
java
private void drawEnabledGraphic(Graphics2D g, int width, int height) { Shape s = shapeGenerator.createTabCloseIcon(2, 2, width - 4, height - 4); g.setPaint(createGraphicInnerShadowGradient(s)); g.fill(s); }
[ "private", "void", "drawEnabledGraphic", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ")", "{", "Shape", "s", "=", "shapeGenerator", ".", "createTabCloseIcon", "(", "2", ",", "2", ",", "width", "-", "4", ",", "height", "-", "4", ")", ";", "g", ".", "setPaint", "(", "createGraphicInnerShadowGradient", "(", "s", ")", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "}" ]
Draw the "close" graphic for the simple enabled state. @param g the Graphic context. @param width the width of the graphic. @param height the height of the graphic.
[ "Draw", "the", "close", "graphic", "for", "the", "simple", "enabled", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java#L140-L145
873
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java
TabbedPaneTabCloseButtonPainter.drawOverlayGraphic
private void drawOverlayGraphic(Graphics2D g, int width, int height) { Shape s = shapeGenerator.createTabCloseIcon(2, 2, width - 4, height - 4); g.setPaint(graphicBase); g.fill(s); s = shapeGenerator.createTabCloseIcon(2, 3, width - 4, height - 4); g.setPaint(createGraphicDropShadowGradient(s)); Shape oldClip = g.getClip(); g.setClip(2, 3, width - 4, height - 4); g.fill(s); g.setClip(oldClip); }
java
private void drawOverlayGraphic(Graphics2D g, int width, int height) { Shape s = shapeGenerator.createTabCloseIcon(2, 2, width - 4, height - 4); g.setPaint(graphicBase); g.fill(s); s = shapeGenerator.createTabCloseIcon(2, 3, width - 4, height - 4); g.setPaint(createGraphicDropShadowGradient(s)); Shape oldClip = g.getClip(); g.setClip(2, 3, width - 4, height - 4); g.fill(s); g.setClip(oldClip); }
[ "private", "void", "drawOverlayGraphic", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ")", "{", "Shape", "s", "=", "shapeGenerator", ".", "createTabCloseIcon", "(", "2", ",", "2", ",", "width", "-", "4", ",", "height", "-", "4", ")", ";", "g", ".", "setPaint", "(", "graphicBase", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "s", "=", "shapeGenerator", ".", "createTabCloseIcon", "(", "2", ",", "3", ",", "width", "-", "4", ",", "height", "-", "4", ")", ";", "g", ".", "setPaint", "(", "createGraphicDropShadowGradient", "(", "s", ")", ")", ";", "Shape", "oldClip", "=", "g", ".", "getClip", "(", ")", ";", "g", ".", "setClip", "(", "2", ",", "3", ",", "width", "-", "4", ",", "height", "-", "4", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "g", ".", "setClip", "(", "oldClip", ")", ";", "}" ]
Draw the "close" graphic for a state where it overlays a border. @param g the Graphic context. @param width the width of the graphic. @param height the height of the graphic.
[ "Draw", "the", "close", "graphic", "for", "a", "state", "where", "it", "overlays", "a", "border", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java#L154-L167
874
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java
TabbedPaneTabCloseButtonPainter.createGraphicInnerShadowGradient
private Paint createGraphicInnerShadowGradient(Shape s) { Rectangle2D b = s.getBounds2D(); float midX = (float) b.getCenterX(); float y1 = (float) b.getMinY(); float y2 = (float) b.getMaxY(); return createGradient(midX, y1, midX, y2, new float[] { 0f, 0.43f, 0.57f, 1f }, new Color[] { graphicInnerShadow1, graphicInnerShadow2, graphicInnerShadow3, graphicInnerShadow4 }); }
java
private Paint createGraphicInnerShadowGradient(Shape s) { Rectangle2D b = s.getBounds2D(); float midX = (float) b.getCenterX(); float y1 = (float) b.getMinY(); float y2 = (float) b.getMaxY(); return createGradient(midX, y1, midX, y2, new float[] { 0f, 0.43f, 0.57f, 1f }, new Color[] { graphicInnerShadow1, graphicInnerShadow2, graphicInnerShadow3, graphicInnerShadow4 }); }
[ "private", "Paint", "createGraphicInnerShadowGradient", "(", "Shape", "s", ")", "{", "Rectangle2D", "b", "=", "s", ".", "getBounds2D", "(", ")", ";", "float", "midX", "=", "(", "float", ")", "b", ".", "getCenterX", "(", ")", ";", "float", "y1", "=", "(", "float", ")", "b", ".", "getMinY", "(", ")", ";", "float", "y2", "=", "(", "float", ")", "b", ".", "getMaxY", "(", ")", ";", "return", "createGradient", "(", "midX", ",", "y1", ",", "midX", ",", "y2", ",", "new", "float", "[", "]", "{", "0f", ",", "0.43f", ",", "0.57f", ",", "1f", "}", ",", "new", "Color", "[", "]", "{", "graphicInnerShadow1", ",", "graphicInnerShadow2", ",", "graphicInnerShadow3", ",", "graphicInnerShadow4", "}", ")", ";", "}" ]
Create the gradient for the "x" inner shadow. @param s the Shape for the gradient. @return the gradient paint.
[ "Create", "the", "gradient", "for", "the", "x", "inner", "shadow", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java#L176-L184
875
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java
TabbedPaneTabCloseButtonPainter.createGraphicDropShadowGradient
private Paint createGraphicDropShadowGradient(Shape s) { Rectangle2D b = s.getBounds2D(); float midX = (float) b.getCenterX(); float y1 = (float) b.getMinY(); float y2 = (float) b.getMaxY(); return createGradient(midX, y1, midX, y2, new float[] { 0f, 0.43f, 0.57f, 1f }, new Color[] { graphicDropShadow1, graphicDropShadow2, graphicDropShadow3, graphicDropShadow4 }); }
java
private Paint createGraphicDropShadowGradient(Shape s) { Rectangle2D b = s.getBounds2D(); float midX = (float) b.getCenterX(); float y1 = (float) b.getMinY(); float y2 = (float) b.getMaxY(); return createGradient(midX, y1, midX, y2, new float[] { 0f, 0.43f, 0.57f, 1f }, new Color[] { graphicDropShadow1, graphicDropShadow2, graphicDropShadow3, graphicDropShadow4 }); }
[ "private", "Paint", "createGraphicDropShadowGradient", "(", "Shape", "s", ")", "{", "Rectangle2D", "b", "=", "s", ".", "getBounds2D", "(", ")", ";", "float", "midX", "=", "(", "float", ")", "b", ".", "getCenterX", "(", ")", ";", "float", "y1", "=", "(", "float", ")", "b", ".", "getMinY", "(", ")", ";", "float", "y2", "=", "(", "float", ")", "b", ".", "getMaxY", "(", ")", ";", "return", "createGradient", "(", "midX", ",", "y1", ",", "midX", ",", "y2", ",", "new", "float", "[", "]", "{", "0f", ",", "0.43f", ",", "0.57f", ",", "1f", "}", ",", "new", "Color", "[", "]", "{", "graphicDropShadow1", ",", "graphicDropShadow2", ",", "graphicDropShadow3", ",", "graphicDropShadow4", "}", ")", ";", "}" ]
Create the gradient for the "x" drop shadow. @param s the Shape for the gradient. @return the gradient paint.
[ "Create", "the", "gradient", "for", "the", "x", "drop", "shadow", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java#L193-L201
876
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/component/SeaGlassBorder.java
SeaGlassBorder.getBorderInsets
public Insets getBorderInsets(Component c, Insets insets) { if (this.insets != null) { if (insets == null) { insets = new Insets(this.insets.top, this.insets.left, this.insets.bottom, this.insets.right); } else { insets.top = this.insets.top; insets.bottom = this.insets.bottom; insets.left = this.insets.left; insets.right = this.insets.right; } } else if (insets == null) { insets = new Insets(0, 0, 0, 0); } else { insets.top = insets.bottom = insets.left = insets.right = 0; } if (c instanceof JComponent) { Insets margin = null; Region region = SeaGlassLookAndFeel.getRegion((JComponent) c); if ((region == Region.ARROW_BUTTON || region == Region.BUTTON || region == Region.CHECK_BOX || region == Region.CHECK_BOX_MENU_ITEM || region == Region.MENU || region == Region.MENU_ITEM || region == Region.RADIO_BUTTON || region == Region.RADIO_BUTTON_MENU_ITEM || region == Region.TOGGLE_BUTTON) && (c instanceof AbstractButton)) { margin = ((AbstractButton) c).getMargin(); } else if ((region == Region.EDITOR_PANE || region == Region.FORMATTED_TEXT_FIELD || region == Region.PASSWORD_FIELD || region == Region.TEXT_AREA || region == Region.TEXT_FIELD || region == Region.TEXT_PANE) && (c instanceof JTextComponent)) { margin = ((JTextComponent) c).getMargin(); } else if (region == Region.TOOL_BAR && (c instanceof JToolBar)) { margin = ((JToolBar) c).getMargin(); } else if (region == Region.MENU_BAR && (c instanceof JMenuBar)) { margin = ((JMenuBar) c).getMargin(); } if (margin != null) { insets.top += margin.top; insets.bottom += margin.bottom; insets.left += margin.left; insets.right += margin.right; } } return insets; }
java
public Insets getBorderInsets(Component c, Insets insets) { if (this.insets != null) { if (insets == null) { insets = new Insets(this.insets.top, this.insets.left, this.insets.bottom, this.insets.right); } else { insets.top = this.insets.top; insets.bottom = this.insets.bottom; insets.left = this.insets.left; insets.right = this.insets.right; } } else if (insets == null) { insets = new Insets(0, 0, 0, 0); } else { insets.top = insets.bottom = insets.left = insets.right = 0; } if (c instanceof JComponent) { Insets margin = null; Region region = SeaGlassLookAndFeel.getRegion((JComponent) c); if ((region == Region.ARROW_BUTTON || region == Region.BUTTON || region == Region.CHECK_BOX || region == Region.CHECK_BOX_MENU_ITEM || region == Region.MENU || region == Region.MENU_ITEM || region == Region.RADIO_BUTTON || region == Region.RADIO_BUTTON_MENU_ITEM || region == Region.TOGGLE_BUTTON) && (c instanceof AbstractButton)) { margin = ((AbstractButton) c).getMargin(); } else if ((region == Region.EDITOR_PANE || region == Region.FORMATTED_TEXT_FIELD || region == Region.PASSWORD_FIELD || region == Region.TEXT_AREA || region == Region.TEXT_FIELD || region == Region.TEXT_PANE) && (c instanceof JTextComponent)) { margin = ((JTextComponent) c).getMargin(); } else if (region == Region.TOOL_BAR && (c instanceof JToolBar)) { margin = ((JToolBar) c).getMargin(); } else if (region == Region.MENU_BAR && (c instanceof JMenuBar)) { margin = ((JMenuBar) c).getMargin(); } if (margin != null) { insets.top += margin.top; insets.bottom += margin.bottom; insets.left += margin.left; insets.right += margin.right; } } return insets; }
[ "public", "Insets", "getBorderInsets", "(", "Component", "c", ",", "Insets", "insets", ")", "{", "if", "(", "this", ".", "insets", "!=", "null", ")", "{", "if", "(", "insets", "==", "null", ")", "{", "insets", "=", "new", "Insets", "(", "this", ".", "insets", ".", "top", ",", "this", ".", "insets", ".", "left", ",", "this", ".", "insets", ".", "bottom", ",", "this", ".", "insets", ".", "right", ")", ";", "}", "else", "{", "insets", ".", "top", "=", "this", ".", "insets", ".", "top", ";", "insets", ".", "bottom", "=", "this", ".", "insets", ".", "bottom", ";", "insets", ".", "left", "=", "this", ".", "insets", ".", "left", ";", "insets", ".", "right", "=", "this", ".", "insets", ".", "right", ";", "}", "}", "else", "if", "(", "insets", "==", "null", ")", "{", "insets", "=", "new", "Insets", "(", "0", ",", "0", ",", "0", ",", "0", ")", ";", "}", "else", "{", "insets", ".", "top", "=", "insets", ".", "bottom", "=", "insets", ".", "left", "=", "insets", ".", "right", "=", "0", ";", "}", "if", "(", "c", "instanceof", "JComponent", ")", "{", "Insets", "margin", "=", "null", ";", "Region", "region", "=", "SeaGlassLookAndFeel", ".", "getRegion", "(", "(", "JComponent", ")", "c", ")", ";", "if", "(", "(", "region", "==", "Region", ".", "ARROW_BUTTON", "||", "region", "==", "Region", ".", "BUTTON", "||", "region", "==", "Region", ".", "CHECK_BOX", "||", "region", "==", "Region", ".", "CHECK_BOX_MENU_ITEM", "||", "region", "==", "Region", ".", "MENU", "||", "region", "==", "Region", ".", "MENU_ITEM", "||", "region", "==", "Region", ".", "RADIO_BUTTON", "||", "region", "==", "Region", ".", "RADIO_BUTTON_MENU_ITEM", "||", "region", "==", "Region", ".", "TOGGLE_BUTTON", ")", "&&", "(", "c", "instanceof", "AbstractButton", ")", ")", "{", "margin", "=", "(", "(", "AbstractButton", ")", "c", ")", ".", "getMargin", "(", ")", ";", "}", "else", "if", "(", "(", "region", "==", "Region", ".", "EDITOR_PANE", "||", "region", "==", "Region", ".", "FORMATTED_TEXT_FIELD", "||", "region", "==", "Region", ".", "PASSWORD_FIELD", "||", "region", "==", "Region", ".", "TEXT_AREA", "||", "region", "==", "Region", ".", "TEXT_FIELD", "||", "region", "==", "Region", ".", "TEXT_PANE", ")", "&&", "(", "c", "instanceof", "JTextComponent", ")", ")", "{", "margin", "=", "(", "(", "JTextComponent", ")", "c", ")", ".", "getMargin", "(", ")", ";", "}", "else", "if", "(", "region", "==", "Region", ".", "TOOL_BAR", "&&", "(", "c", "instanceof", "JToolBar", ")", ")", "{", "margin", "=", "(", "(", "JToolBar", ")", "c", ")", ".", "getMargin", "(", ")", ";", "}", "else", "if", "(", "region", "==", "Region", ".", "MENU_BAR", "&&", "(", "c", "instanceof", "JMenuBar", ")", ")", "{", "margin", "=", "(", "(", "JMenuBar", ")", "c", ")", ".", "getMargin", "(", ")", ";", "}", "if", "(", "margin", "!=", "null", ")", "{", "insets", ".", "top", "+=", "margin", ".", "top", ";", "insets", ".", "bottom", "+=", "margin", ".", "bottom", ";", "insets", ".", "left", "+=", "margin", ".", "left", ";", "insets", ".", "right", "+=", "margin", ".", "right", ";", "}", "}", "return", "insets", ";", "}" ]
Reinitializes the insets parameter with this Border's current Insets. @param c the component for which this border insets value applies @param insets the object to be reinitialized @return the <code>insets</code> object
[ "Reinitializes", "the", "insets", "parameter", "with", "this", "Border", "s", "current", "Insets", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassBorder.java#L113-L158
877
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java
SeaGlassTableUI.installRendererIfPossible
private TableCellRenderer installRendererIfPossible(Class objectClass, TableCellRenderer renderer) { TableCellRenderer currentRenderer = table.getDefaultRenderer(objectClass); if (currentRenderer instanceof UIResource) { table.setDefaultRenderer(objectClass, renderer); } return currentRenderer; }
java
private TableCellRenderer installRendererIfPossible(Class objectClass, TableCellRenderer renderer) { TableCellRenderer currentRenderer = table.getDefaultRenderer(objectClass); if (currentRenderer instanceof UIResource) { table.setDefaultRenderer(objectClass, renderer); } return currentRenderer; }
[ "private", "TableCellRenderer", "installRendererIfPossible", "(", "Class", "objectClass", ",", "TableCellRenderer", "renderer", ")", "{", "TableCellRenderer", "currentRenderer", "=", "table", ".", "getDefaultRenderer", "(", "objectClass", ")", ";", "if", "(", "currentRenderer", "instanceof", "UIResource", ")", "{", "table", ".", "setDefaultRenderer", "(", "objectClass", ",", "renderer", ")", ";", "}", "return", "currentRenderer", ";", "}" ]
Installs a renderer if the existing renderer is an instance of UIResource. @param objectClass the class for which to install the renderer. @param renderer the renderer instance. @return the previous renderer.
[ "Installs", "a", "renderer", "if", "the", "existing", "renderer", "is", "an", "instance", "of", "UIResource", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L153-L161
878
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java
SeaGlassTableUI.updateStyle
private void updateStyle(JTable c) { SeaGlassContext context = getContext(c, ENABLED); SynthStyle oldStyle = style; SynthStyle s = SeaGlassLookAndFeel.updateStyle(context, this); if (s instanceof SeaGlassStyle) { style = (SeaGlassStyle) s; selectionActiveBottomBorderColor = UIManager.getColor("seaGlassTableSelectionActiveBottom"); selectionInactiveBottomBorderColor = UIManager.getColor("seaGlassTableSelectionInactiveBottom"); transparentColor = UIManager.getColor("seaGlassTransparent"); if (style != oldStyle) { table.remove(rendererPane); rendererPane = createCustomCellRendererPane(); table.add(rendererPane); context.setComponentState(ENABLED | SELECTED); Color sbg = table.getSelectionBackground(); if (sbg == null || sbg instanceof UIResource) { table.setSelectionBackground(style.getColor(context, ColorType.TEXT_BACKGROUND)); } Color sfg = table.getSelectionForeground(); if (sfg == null || sfg instanceof UIResource) { table.setSelectionForeground(style.getColor(context, ColorType.TEXT_FOREGROUND)); } context.setComponentState(ENABLED); Color gridColor = table.getGridColor(); if (gridColor == null || gridColor instanceof UIResource) { gridColor = (Color) style.get(context, "Table.gridColor"); if (gridColor == null) { gridColor = style.getColor(context, ColorType.FOREGROUND); } table.setGridColor(gridColor); } useTableColors = style.getBoolean(context, "Table.rendererUseTableColors", true); useUIBorder = style.getBoolean(context, "Table.rendererUseUIBorder", true); Object rowHeight = style.get(context, "Table.rowHeight"); if (rowHeight != null) { LookAndFeel.installProperty(table, "rowHeight", rowHeight); } boolean showGrid = style.getBoolean(context, "Table.showGrid", true); if (!showGrid) { table.setShowGrid(false); } Dimension d = table.getIntercellSpacing(); // if (d == null || d instanceof UIResource) { if (d != null) { d = (Dimension) style.get(context, "Table.intercellSpacing"); } alternateColor = (Color) style.get(context, "Table.alternateRowColor"); if (d != null) { table.setIntercellSpacing(d); } table.setOpaque(false); if (alternateColor != null) { table.setShowHorizontalLines(false); } // Make header column extend the width of the viewport (if there is // a viewport). table.getTableHeader().setBorder(createTableHeaderEmptyColumnPainter(table)); setViewPortListeners(table); if (oldStyle != null) { uninstallKeyboardActions(); installKeyboardActions(); } } } context.dispose(); }
java
private void updateStyle(JTable c) { SeaGlassContext context = getContext(c, ENABLED); SynthStyle oldStyle = style; SynthStyle s = SeaGlassLookAndFeel.updateStyle(context, this); if (s instanceof SeaGlassStyle) { style = (SeaGlassStyle) s; selectionActiveBottomBorderColor = UIManager.getColor("seaGlassTableSelectionActiveBottom"); selectionInactiveBottomBorderColor = UIManager.getColor("seaGlassTableSelectionInactiveBottom"); transparentColor = UIManager.getColor("seaGlassTransparent"); if (style != oldStyle) { table.remove(rendererPane); rendererPane = createCustomCellRendererPane(); table.add(rendererPane); context.setComponentState(ENABLED | SELECTED); Color sbg = table.getSelectionBackground(); if (sbg == null || sbg instanceof UIResource) { table.setSelectionBackground(style.getColor(context, ColorType.TEXT_BACKGROUND)); } Color sfg = table.getSelectionForeground(); if (sfg == null || sfg instanceof UIResource) { table.setSelectionForeground(style.getColor(context, ColorType.TEXT_FOREGROUND)); } context.setComponentState(ENABLED); Color gridColor = table.getGridColor(); if (gridColor == null || gridColor instanceof UIResource) { gridColor = (Color) style.get(context, "Table.gridColor"); if (gridColor == null) { gridColor = style.getColor(context, ColorType.FOREGROUND); } table.setGridColor(gridColor); } useTableColors = style.getBoolean(context, "Table.rendererUseTableColors", true); useUIBorder = style.getBoolean(context, "Table.rendererUseUIBorder", true); Object rowHeight = style.get(context, "Table.rowHeight"); if (rowHeight != null) { LookAndFeel.installProperty(table, "rowHeight", rowHeight); } boolean showGrid = style.getBoolean(context, "Table.showGrid", true); if (!showGrid) { table.setShowGrid(false); } Dimension d = table.getIntercellSpacing(); // if (d == null || d instanceof UIResource) { if (d != null) { d = (Dimension) style.get(context, "Table.intercellSpacing"); } alternateColor = (Color) style.get(context, "Table.alternateRowColor"); if (d != null) { table.setIntercellSpacing(d); } table.setOpaque(false); if (alternateColor != null) { table.setShowHorizontalLines(false); } // Make header column extend the width of the viewport (if there is // a viewport). table.getTableHeader().setBorder(createTableHeaderEmptyColumnPainter(table)); setViewPortListeners(table); if (oldStyle != null) { uninstallKeyboardActions(); installKeyboardActions(); } } } context.dispose(); }
[ "private", "void", "updateStyle", "(", "JTable", "c", ")", "{", "SeaGlassContext", "context", "=", "getContext", "(", "c", ",", "ENABLED", ")", ";", "SynthStyle", "oldStyle", "=", "style", ";", "SynthStyle", "s", "=", "SeaGlassLookAndFeel", ".", "updateStyle", "(", "context", ",", "this", ")", ";", "if", "(", "s", "instanceof", "SeaGlassStyle", ")", "{", "style", "=", "(", "SeaGlassStyle", ")", "s", ";", "selectionActiveBottomBorderColor", "=", "UIManager", ".", "getColor", "(", "\"seaGlassTableSelectionActiveBottom\"", ")", ";", "selectionInactiveBottomBorderColor", "=", "UIManager", ".", "getColor", "(", "\"seaGlassTableSelectionInactiveBottom\"", ")", ";", "transparentColor", "=", "UIManager", ".", "getColor", "(", "\"seaGlassTransparent\"", ")", ";", "if", "(", "style", "!=", "oldStyle", ")", "{", "table", ".", "remove", "(", "rendererPane", ")", ";", "rendererPane", "=", "createCustomCellRendererPane", "(", ")", ";", "table", ".", "add", "(", "rendererPane", ")", ";", "context", ".", "setComponentState", "(", "ENABLED", "|", "SELECTED", ")", ";", "Color", "sbg", "=", "table", ".", "getSelectionBackground", "(", ")", ";", "if", "(", "sbg", "==", "null", "||", "sbg", "instanceof", "UIResource", ")", "{", "table", ".", "setSelectionBackground", "(", "style", ".", "getColor", "(", "context", ",", "ColorType", ".", "TEXT_BACKGROUND", ")", ")", ";", "}", "Color", "sfg", "=", "table", ".", "getSelectionForeground", "(", ")", ";", "if", "(", "sfg", "==", "null", "||", "sfg", "instanceof", "UIResource", ")", "{", "table", ".", "setSelectionForeground", "(", "style", ".", "getColor", "(", "context", ",", "ColorType", ".", "TEXT_FOREGROUND", ")", ")", ";", "}", "context", ".", "setComponentState", "(", "ENABLED", ")", ";", "Color", "gridColor", "=", "table", ".", "getGridColor", "(", ")", ";", "if", "(", "gridColor", "==", "null", "||", "gridColor", "instanceof", "UIResource", ")", "{", "gridColor", "=", "(", "Color", ")", "style", ".", "get", "(", "context", ",", "\"Table.gridColor\"", ")", ";", "if", "(", "gridColor", "==", "null", ")", "{", "gridColor", "=", "style", ".", "getColor", "(", "context", ",", "ColorType", ".", "FOREGROUND", ")", ";", "}", "table", ".", "setGridColor", "(", "gridColor", ")", ";", "}", "useTableColors", "=", "style", ".", "getBoolean", "(", "context", ",", "\"Table.rendererUseTableColors\"", ",", "true", ")", ";", "useUIBorder", "=", "style", ".", "getBoolean", "(", "context", ",", "\"Table.rendererUseUIBorder\"", ",", "true", ")", ";", "Object", "rowHeight", "=", "style", ".", "get", "(", "context", ",", "\"Table.rowHeight\"", ")", ";", "if", "(", "rowHeight", "!=", "null", ")", "{", "LookAndFeel", ".", "installProperty", "(", "table", ",", "\"rowHeight\"", ",", "rowHeight", ")", ";", "}", "boolean", "showGrid", "=", "style", ".", "getBoolean", "(", "context", ",", "\"Table.showGrid\"", ",", "true", ")", ";", "if", "(", "!", "showGrid", ")", "{", "table", ".", "setShowGrid", "(", "false", ")", ";", "}", "Dimension", "d", "=", "table", ".", "getIntercellSpacing", "(", ")", ";", "// if (d == null || d instanceof UIResource) {", "if", "(", "d", "!=", "null", ")", "{", "d", "=", "(", "Dimension", ")", "style", ".", "get", "(", "context", ",", "\"Table.intercellSpacing\"", ")", ";", "}", "alternateColor", "=", "(", "Color", ")", "style", ".", "get", "(", "context", ",", "\"Table.alternateRowColor\"", ")", ";", "if", "(", "d", "!=", "null", ")", "{", "table", ".", "setIntercellSpacing", "(", "d", ")", ";", "}", "table", ".", "setOpaque", "(", "false", ")", ";", "if", "(", "alternateColor", "!=", "null", ")", "{", "table", ".", "setShowHorizontalLines", "(", "false", ")", ";", "}", "// Make header column extend the width of the viewport (if there is", "// a viewport).", "table", ".", "getTableHeader", "(", ")", ".", "setBorder", "(", "createTableHeaderEmptyColumnPainter", "(", "table", ")", ")", ";", "setViewPortListeners", "(", "table", ")", ";", "if", "(", "oldStyle", "!=", "null", ")", "{", "uninstallKeyboardActions", "(", ")", ";", "installKeyboardActions", "(", ")", ";", "}", "}", "}", "context", ".", "dispose", "(", ")", ";", "}" ]
Update the style. @param c the component.
[ "Update", "the", "style", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L205-L294
879
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java
SeaGlassTableUI.paint
protected void paint(SeaGlassContext context, Graphics g) { Rectangle clip = g.getClipBounds(); Rectangle bounds = table.getBounds(); // Account for the fact that the graphics has already been translated // into the table's bounds. bounds.x = bounds.y = 0; // This check prevents us from painting the entire table when the clip // doesn't intersect our bounds at all. if (table.getRowCount() <= 0 || table.getColumnCount() <= 0 || !bounds.intersects(clip)) { paintDropLines(context, g); return; } boolean ltr = table.getComponentOrientation().isLeftToRight(); Point upperLeft = clip.getLocation(); if (!ltr) { upperLeft.x++; } Point lowerRight = new Point(clip.x + clip.width - (ltr ? 1 : 0), clip.y + clip.height); int rMin = table.rowAtPoint(upperLeft); int rMax = table.rowAtPoint(lowerRight); // This should never happen (as long as our bounds intersect the clip, // which is why we bail above if that is the case). if (rMin == -1) { rMin = 0; } // If the table does not have enough rows to fill the view we'll get -1. // (We could also get -1 if our bounds don't intersect the clip, // which is why we bail above if that is the case). // Replace this with the index of the last row. if (rMax == -1) { rMax = table.getRowCount() - 1; } int cMin = table.columnAtPoint(ltr ? upperLeft : lowerRight); int cMax = table.columnAtPoint(ltr ? lowerRight : upperLeft); // This should never happen. if (cMin == -1) { cMin = 0; } // If the table does not have enough columns to fill the view we'll get // -1. // Replace this with the index of the last column. if (cMax == -1) { cMax = table.getColumnCount() - 1; } // Paint the grid. if (!(table.getParent() instanceof JViewport) || (table.getParent() != null && !(table.getParent().getParent() instanceof JScrollPane))) { // FIXME We need to not repaint the entire table any time something // changes. // paintGrid(context, g, rMin, rMax, cMin, cMax); paintStripesAndGrid(context, g, table, table.getWidth(), table.getHeight(), 0); } // Paint the cells. paintCells(context, g, rMin, rMax, cMin, cMax); paintDropLines(context, g); }
java
protected void paint(SeaGlassContext context, Graphics g) { Rectangle clip = g.getClipBounds(); Rectangle bounds = table.getBounds(); // Account for the fact that the graphics has already been translated // into the table's bounds. bounds.x = bounds.y = 0; // This check prevents us from painting the entire table when the clip // doesn't intersect our bounds at all. if (table.getRowCount() <= 0 || table.getColumnCount() <= 0 || !bounds.intersects(clip)) { paintDropLines(context, g); return; } boolean ltr = table.getComponentOrientation().isLeftToRight(); Point upperLeft = clip.getLocation(); if (!ltr) { upperLeft.x++; } Point lowerRight = new Point(clip.x + clip.width - (ltr ? 1 : 0), clip.y + clip.height); int rMin = table.rowAtPoint(upperLeft); int rMax = table.rowAtPoint(lowerRight); // This should never happen (as long as our bounds intersect the clip, // which is why we bail above if that is the case). if (rMin == -1) { rMin = 0; } // If the table does not have enough rows to fill the view we'll get -1. // (We could also get -1 if our bounds don't intersect the clip, // which is why we bail above if that is the case). // Replace this with the index of the last row. if (rMax == -1) { rMax = table.getRowCount() - 1; } int cMin = table.columnAtPoint(ltr ? upperLeft : lowerRight); int cMax = table.columnAtPoint(ltr ? lowerRight : upperLeft); // This should never happen. if (cMin == -1) { cMin = 0; } // If the table does not have enough columns to fill the view we'll get // -1. // Replace this with the index of the last column. if (cMax == -1) { cMax = table.getColumnCount() - 1; } // Paint the grid. if (!(table.getParent() instanceof JViewport) || (table.getParent() != null && !(table.getParent().getParent() instanceof JScrollPane))) { // FIXME We need to not repaint the entire table any time something // changes. // paintGrid(context, g, rMin, rMax, cMin, cMax); paintStripesAndGrid(context, g, table, table.getWidth(), table.getHeight(), 0); } // Paint the cells. paintCells(context, g, rMin, rMax, cMin, cMax); paintDropLines(context, g); }
[ "protected", "void", "paint", "(", "SeaGlassContext", "context", ",", "Graphics", "g", ")", "{", "Rectangle", "clip", "=", "g", ".", "getClipBounds", "(", ")", ";", "Rectangle", "bounds", "=", "table", ".", "getBounds", "(", ")", ";", "// Account for the fact that the graphics has already been translated", "// into the table's bounds.", "bounds", ".", "x", "=", "bounds", ".", "y", "=", "0", ";", "// This check prevents us from painting the entire table when the clip", "// doesn't intersect our bounds at all.", "if", "(", "table", ".", "getRowCount", "(", ")", "<=", "0", "||", "table", ".", "getColumnCount", "(", ")", "<=", "0", "||", "!", "bounds", ".", "intersects", "(", "clip", ")", ")", "{", "paintDropLines", "(", "context", ",", "g", ")", ";", "return", ";", "}", "boolean", "ltr", "=", "table", ".", "getComponentOrientation", "(", ")", ".", "isLeftToRight", "(", ")", ";", "Point", "upperLeft", "=", "clip", ".", "getLocation", "(", ")", ";", "if", "(", "!", "ltr", ")", "{", "upperLeft", ".", "x", "++", ";", "}", "Point", "lowerRight", "=", "new", "Point", "(", "clip", ".", "x", "+", "clip", ".", "width", "-", "(", "ltr", "?", "1", ":", "0", ")", ",", "clip", ".", "y", "+", "clip", ".", "height", ")", ";", "int", "rMin", "=", "table", ".", "rowAtPoint", "(", "upperLeft", ")", ";", "int", "rMax", "=", "table", ".", "rowAtPoint", "(", "lowerRight", ")", ";", "// This should never happen (as long as our bounds intersect the clip,", "// which is why we bail above if that is the case).", "if", "(", "rMin", "==", "-", "1", ")", "{", "rMin", "=", "0", ";", "}", "// If the table does not have enough rows to fill the view we'll get -1.", "// (We could also get -1 if our bounds don't intersect the clip,", "// which is why we bail above if that is the case).", "// Replace this with the index of the last row.", "if", "(", "rMax", "==", "-", "1", ")", "{", "rMax", "=", "table", ".", "getRowCount", "(", ")", "-", "1", ";", "}", "int", "cMin", "=", "table", ".", "columnAtPoint", "(", "ltr", "?", "upperLeft", ":", "lowerRight", ")", ";", "int", "cMax", "=", "table", ".", "columnAtPoint", "(", "ltr", "?", "lowerRight", ":", "upperLeft", ")", ";", "// This should never happen.", "if", "(", "cMin", "==", "-", "1", ")", "{", "cMin", "=", "0", ";", "}", "// If the table does not have enough columns to fill the view we'll get", "// -1.", "// Replace this with the index of the last column.", "if", "(", "cMax", "==", "-", "1", ")", "{", "cMax", "=", "table", ".", "getColumnCount", "(", ")", "-", "1", ";", "}", "// Paint the grid.", "if", "(", "!", "(", "table", ".", "getParent", "(", ")", "instanceof", "JViewport", ")", "||", "(", "table", ".", "getParent", "(", ")", "!=", "null", "&&", "!", "(", "table", ".", "getParent", "(", ")", ".", "getParent", "(", ")", "instanceof", "JScrollPane", ")", ")", ")", "{", "// FIXME We need to not repaint the entire table any time something", "// changes.", "// paintGrid(context, g, rMin, rMax, cMin, cMax);", "paintStripesAndGrid", "(", "context", ",", "g", ",", "table", ",", "table", ".", "getWidth", "(", ")", ",", "table", ".", "getHeight", "(", ")", ",", "0", ")", ";", "}", "// Paint the cells.", "paintCells", "(", "context", ",", "g", ",", "rMin", ",", "rMax", ",", "cMin", ",", "cMax", ")", ";", "paintDropLines", "(", "context", ",", "g", ")", ";", "}" ]
Paint the component. @param context the Synth context. @param g the Graphics context.
[ "Paint", "the", "component", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L411-L477
880
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java
SeaGlassTableUI.paintStripesAndGrid
public void paintStripesAndGrid(SeaGlassContext context, Graphics g, JComponent c, int width, int height, int top) { int rh = table.getRowHeight(); int n = table.getRowCount(); int row = Math.abs(top / rh); // if (true) return; // TableCellRenderer renderer = // table.getDefaultRenderer(java.lang.Object.class); // Paint the background, including stripes if requested. if (alternateColor != null) { // Fill the viewport with background color. // Rossi: Ugly broken hack to make the first column white instead of blue. // To see how the new blue table headers look like. // This is should be done by modifying the "for loop" instead. g.setColor(alternateColor); g.fillRect(0, 0, width, height); // Now check if we need to paint some stripes g.setColor(table.getBackground()); // Paint table rows to fill the viewport. for (int y = top + row * rh, ymax = height; y < ymax; y += rh) { if (row % 2 == 0) { g.fillRect(0, y, width, rh); } row++; } } else { // Fill the viewport with the background color of the table g.setColor(table.getBackground()); g.fillRect(0, 0, c.getWidth(), c.getHeight()); } SynthGraphicsUtils synthG = context.getStyle().getGraphicsUtils(context); // Paint the horizontal grid lines if (table.getShowHorizontalLines()) { g.setColor(table.getGridColor()); row = Math.abs(top / rh); int y = top + row * rh + rh - 1; while (y < height) { synthG.drawLine(context, "Table.grid", g, 0, y, width, y); y += rh; } } // Paint the vertical grid lines if (table.getShowVerticalLines()) { g.setColor(table.getGridColor()); TableColumnModel cm = table.getColumnModel(); n = cm.getColumnCount(); int y = top + row * rh; ; int x = -1; for (int i = 0; i < n; i++) { TableColumn col = cm.getColumn(i); x += col.getWidth(); synthG.drawLine(context, "Table.grid", g, x, y, x, height); } } }
java
public void paintStripesAndGrid(SeaGlassContext context, Graphics g, JComponent c, int width, int height, int top) { int rh = table.getRowHeight(); int n = table.getRowCount(); int row = Math.abs(top / rh); // if (true) return; // TableCellRenderer renderer = // table.getDefaultRenderer(java.lang.Object.class); // Paint the background, including stripes if requested. if (alternateColor != null) { // Fill the viewport with background color. // Rossi: Ugly broken hack to make the first column white instead of blue. // To see how the new blue table headers look like. // This is should be done by modifying the "for loop" instead. g.setColor(alternateColor); g.fillRect(0, 0, width, height); // Now check if we need to paint some stripes g.setColor(table.getBackground()); // Paint table rows to fill the viewport. for (int y = top + row * rh, ymax = height; y < ymax; y += rh) { if (row % 2 == 0) { g.fillRect(0, y, width, rh); } row++; } } else { // Fill the viewport with the background color of the table g.setColor(table.getBackground()); g.fillRect(0, 0, c.getWidth(), c.getHeight()); } SynthGraphicsUtils synthG = context.getStyle().getGraphicsUtils(context); // Paint the horizontal grid lines if (table.getShowHorizontalLines()) { g.setColor(table.getGridColor()); row = Math.abs(top / rh); int y = top + row * rh + rh - 1; while (y < height) { synthG.drawLine(context, "Table.grid", g, 0, y, width, y); y += rh; } } // Paint the vertical grid lines if (table.getShowVerticalLines()) { g.setColor(table.getGridColor()); TableColumnModel cm = table.getColumnModel(); n = cm.getColumnCount(); int y = top + row * rh; ; int x = -1; for (int i = 0; i < n; i++) { TableColumn col = cm.getColumn(i); x += col.getWidth(); synthG.drawLine(context, "Table.grid", g, x, y, x, height); } } }
[ "public", "void", "paintStripesAndGrid", "(", "SeaGlassContext", "context", ",", "Graphics", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ",", "int", "top", ")", "{", "int", "rh", "=", "table", ".", "getRowHeight", "(", ")", ";", "int", "n", "=", "table", ".", "getRowCount", "(", ")", ";", "int", "row", "=", "Math", ".", "abs", "(", "top", "/", "rh", ")", ";", "// if (true) return;", "// TableCellRenderer renderer =", "// table.getDefaultRenderer(java.lang.Object.class);", "// Paint the background, including stripes if requested.", "if", "(", "alternateColor", "!=", "null", ")", "{", "// Fill the viewport with background color.", "// Rossi: Ugly broken hack to make the first column white instead of blue.", "// To see how the new blue table headers look like.", "// This is should be done by modifying the \"for loop\" instead.", "g", ".", "setColor", "(", "alternateColor", ")", ";", "g", ".", "fillRect", "(", "0", ",", "0", ",", "width", ",", "height", ")", ";", "// Now check if we need to paint some stripes", "g", ".", "setColor", "(", "table", ".", "getBackground", "(", ")", ")", ";", "// Paint table rows to fill the viewport.", "for", "(", "int", "y", "=", "top", "+", "row", "*", "rh", ",", "ymax", "=", "height", ";", "y", "<", "ymax", ";", "y", "+=", "rh", ")", "{", "if", "(", "row", "%", "2", "==", "0", ")", "{", "g", ".", "fillRect", "(", "0", ",", "y", ",", "width", ",", "rh", ")", ";", "}", "row", "++", ";", "}", "}", "else", "{", "// Fill the viewport with the background color of the table", "g", ".", "setColor", "(", "table", ".", "getBackground", "(", ")", ")", ";", "g", ".", "fillRect", "(", "0", ",", "0", ",", "c", ".", "getWidth", "(", ")", ",", "c", ".", "getHeight", "(", ")", ")", ";", "}", "SynthGraphicsUtils", "synthG", "=", "context", ".", "getStyle", "(", ")", ".", "getGraphicsUtils", "(", "context", ")", ";", "// Paint the horizontal grid lines", "if", "(", "table", ".", "getShowHorizontalLines", "(", ")", ")", "{", "g", ".", "setColor", "(", "table", ".", "getGridColor", "(", ")", ")", ";", "row", "=", "Math", ".", "abs", "(", "top", "/", "rh", ")", ";", "int", "y", "=", "top", "+", "row", "*", "rh", "+", "rh", "-", "1", ";", "while", "(", "y", "<", "height", ")", "{", "synthG", ".", "drawLine", "(", "context", ",", "\"Table.grid\"", ",", "g", ",", "0", ",", "y", ",", "width", ",", "y", ")", ";", "y", "+=", "rh", ";", "}", "}", "// Paint the vertical grid lines", "if", "(", "table", ".", "getShowVerticalLines", "(", ")", ")", "{", "g", ".", "setColor", "(", "table", ".", "getGridColor", "(", ")", ")", ";", "TableColumnModel", "cm", "=", "table", ".", "getColumnModel", "(", ")", ";", "n", "=", "cm", ".", "getColumnCount", "(", ")", ";", "int", "y", "=", "top", "+", "row", "*", "rh", ";", ";", "int", "x", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "TableColumn", "col", "=", "cm", ".", "getColumn", "(", "i", ")", ";", "x", "+=", "col", ".", "getWidth", "(", ")", ";", "synthG", ".", "drawLine", "(", "context", ",", "\"Table.grid\"", ",", "g", ",", "x", ",", "y", ",", "x", ",", "height", ")", ";", "}", "}", "}" ]
Paint the stripes and grid. @param context the Synth context. @param g the Graphics context. @param c the component. @param width the width of the table. @param height the height of the table. @param top the top row to paint (for viewports).
[ "Paint", "the", "stripes", "and", "grid", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L497-L564
881
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java
SeaGlassTableUI.paintDropLines
private void paintDropLines(SeaGlassContext context, Graphics g) { JTable.DropLocation loc = table.getDropLocation(); if (loc == null) { return; } Color color = (Color) style.get(context, "Table.dropLineColor"); Color shortColor = (Color) style.get(context, "Table.dropLineShortColor"); if (color == null && shortColor == null) { return; } Rectangle rect; rect = getHDropLineRect(loc); if (rect != null) { int x = rect.x; int w = rect.width; if (color != null) { extendRect(rect, true); g.setColor(color); g.fillRect(rect.x, rect.y, rect.width, rect.height); } if (!loc.isInsertColumn() && shortColor != null) { g.setColor(shortColor); g.fillRect(x, rect.y, w, rect.height); } } rect = getVDropLineRect(loc); if (rect != null) { int y = rect.y; int h = rect.height; if (color != null) { extendRect(rect, false); g.setColor(color); g.fillRect(rect.x, rect.y, rect.width, rect.height); } if (!loc.isInsertRow() && shortColor != null) { g.setColor(shortColor); g.fillRect(rect.x, y, rect.width, h); } } }
java
private void paintDropLines(SeaGlassContext context, Graphics g) { JTable.DropLocation loc = table.getDropLocation(); if (loc == null) { return; } Color color = (Color) style.get(context, "Table.dropLineColor"); Color shortColor = (Color) style.get(context, "Table.dropLineShortColor"); if (color == null && shortColor == null) { return; } Rectangle rect; rect = getHDropLineRect(loc); if (rect != null) { int x = rect.x; int w = rect.width; if (color != null) { extendRect(rect, true); g.setColor(color); g.fillRect(rect.x, rect.y, rect.width, rect.height); } if (!loc.isInsertColumn() && shortColor != null) { g.setColor(shortColor); g.fillRect(x, rect.y, w, rect.height); } } rect = getVDropLineRect(loc); if (rect != null) { int y = rect.y; int h = rect.height; if (color != null) { extendRect(rect, false); g.setColor(color); g.fillRect(rect.x, rect.y, rect.width, rect.height); } if (!loc.isInsertRow() && shortColor != null) { g.setColor(shortColor); g.fillRect(rect.x, y, rect.width, h); } } }
[ "private", "void", "paintDropLines", "(", "SeaGlassContext", "context", ",", "Graphics", "g", ")", "{", "JTable", ".", "DropLocation", "loc", "=", "table", ".", "getDropLocation", "(", ")", ";", "if", "(", "loc", "==", "null", ")", "{", "return", ";", "}", "Color", "color", "=", "(", "Color", ")", "style", ".", "get", "(", "context", ",", "\"Table.dropLineColor\"", ")", ";", "Color", "shortColor", "=", "(", "Color", ")", "style", ".", "get", "(", "context", ",", "\"Table.dropLineShortColor\"", ")", ";", "if", "(", "color", "==", "null", "&&", "shortColor", "==", "null", ")", "{", "return", ";", "}", "Rectangle", "rect", ";", "rect", "=", "getHDropLineRect", "(", "loc", ")", ";", "if", "(", "rect", "!=", "null", ")", "{", "int", "x", "=", "rect", ".", "x", ";", "int", "w", "=", "rect", ".", "width", ";", "if", "(", "color", "!=", "null", ")", "{", "extendRect", "(", "rect", ",", "true", ")", ";", "g", ".", "setColor", "(", "color", ")", ";", "g", ".", "fillRect", "(", "rect", ".", "x", ",", "rect", ".", "y", ",", "rect", ".", "width", ",", "rect", ".", "height", ")", ";", "}", "if", "(", "!", "loc", ".", "isInsertColumn", "(", ")", "&&", "shortColor", "!=", "null", ")", "{", "g", ".", "setColor", "(", "shortColor", ")", ";", "g", ".", "fillRect", "(", "x", ",", "rect", ".", "y", ",", "w", ",", "rect", ".", "height", ")", ";", "}", "}", "rect", "=", "getVDropLineRect", "(", "loc", ")", ";", "if", "(", "rect", "!=", "null", ")", "{", "int", "y", "=", "rect", ".", "y", ";", "int", "h", "=", "rect", ".", "height", ";", "if", "(", "color", "!=", "null", ")", "{", "extendRect", "(", "rect", ",", "false", ")", ";", "g", ".", "setColor", "(", "color", ")", ";", "g", ".", "fillRect", "(", "rect", ".", "x", ",", "rect", ".", "y", ",", "rect", ".", "width", ",", "rect", ".", "height", ")", ";", "}", "if", "(", "!", "loc", ".", "isInsertRow", "(", ")", "&&", "shortColor", "!=", "null", ")", "{", "g", ".", "setColor", "(", "shortColor", ")", ";", "g", ".", "fillRect", "(", "rect", ".", "x", ",", "y", ",", "rect", ".", "width", ",", "h", ")", ";", "}", "}", "}" ]
Paint the drop lines, if any. @param context the Synth context. @param g the Graphics context.
[ "Paint", "the", "drop", "lines", "if", "any", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L572-L621
882
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java
SeaGlassTableUI.getHDropLineRect
private Rectangle getHDropLineRect(JTable.DropLocation loc) { if (!loc.isInsertRow()) { return null; } int row = loc.getRow(); int col = loc.getColumn(); if (col >= table.getColumnCount()) { col--; } Rectangle rect = table.getCellRect(row, col, true); if (row >= table.getRowCount()) { row--; Rectangle prevRect = table.getCellRect(row, col, true); rect.y = prevRect.y + prevRect.height; } if (rect.y == 0) { rect.y = -1; } else { rect.y -= 2; } rect.height = 3; return rect; }
java
private Rectangle getHDropLineRect(JTable.DropLocation loc) { if (!loc.isInsertRow()) { return null; } int row = loc.getRow(); int col = loc.getColumn(); if (col >= table.getColumnCount()) { col--; } Rectangle rect = table.getCellRect(row, col, true); if (row >= table.getRowCount()) { row--; Rectangle prevRect = table.getCellRect(row, col, true); rect.y = prevRect.y + prevRect.height; } if (rect.y == 0) { rect.y = -1; } else { rect.y -= 2; } rect.height = 3; return rect; }
[ "private", "Rectangle", "getHDropLineRect", "(", "JTable", ".", "DropLocation", "loc", ")", "{", "if", "(", "!", "loc", ".", "isInsertRow", "(", ")", ")", "{", "return", "null", ";", "}", "int", "row", "=", "loc", ".", "getRow", "(", ")", ";", "int", "col", "=", "loc", ".", "getColumn", "(", ")", ";", "if", "(", "col", ">=", "table", ".", "getColumnCount", "(", ")", ")", "{", "col", "--", ";", "}", "Rectangle", "rect", "=", "table", ".", "getCellRect", "(", "row", ",", "col", ",", "true", ")", ";", "if", "(", "row", ">=", "table", ".", "getRowCount", "(", ")", ")", "{", "row", "--", ";", "Rectangle", "prevRect", "=", "table", ".", "getCellRect", "(", "row", ",", "col", ",", "true", ")", ";", "rect", ".", "y", "=", "prevRect", ".", "y", "+", "prevRect", ".", "height", ";", "}", "if", "(", "rect", ".", "y", "==", "0", ")", "{", "rect", ".", "y", "=", "-", "1", ";", "}", "else", "{", "rect", ".", "y", "-=", "2", ";", "}", "rect", ".", "height", "=", "3", ";", "return", "rect", ";", "}" ]
Get the horizontal drop line rectangle. @param loc the drop location. @return the rectangle.
[ "Get", "the", "horizontal", "drop", "line", "rectangle", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L630-L660
883
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java
SeaGlassTableUI.getVDropLineRect
private Rectangle getVDropLineRect(JTable.DropLocation loc) { if (!loc.isInsertColumn()) { return null; } boolean ltr = table.getComponentOrientation().isLeftToRight(); int col = loc.getColumn(); Rectangle rect = table.getCellRect(loc.getRow(), col, true); if (col >= table.getColumnCount()) { col--; rect = table.getCellRect(loc.getRow(), col, true); if (ltr) { rect.x = rect.x + rect.width; } } else if (!ltr) { rect.x = rect.x + rect.width; } if (rect.x == 0) { rect.x = -1; } else { rect.x -= 2; } rect.width = 3; return rect; }
java
private Rectangle getVDropLineRect(JTable.DropLocation loc) { if (!loc.isInsertColumn()) { return null; } boolean ltr = table.getComponentOrientation().isLeftToRight(); int col = loc.getColumn(); Rectangle rect = table.getCellRect(loc.getRow(), col, true); if (col >= table.getColumnCount()) { col--; rect = table.getCellRect(loc.getRow(), col, true); if (ltr) { rect.x = rect.x + rect.width; } } else if (!ltr) { rect.x = rect.x + rect.width; } if (rect.x == 0) { rect.x = -1; } else { rect.x -= 2; } rect.width = 3; return rect; }
[ "private", "Rectangle", "getVDropLineRect", "(", "JTable", ".", "DropLocation", "loc", ")", "{", "if", "(", "!", "loc", ".", "isInsertColumn", "(", ")", ")", "{", "return", "null", ";", "}", "boolean", "ltr", "=", "table", ".", "getComponentOrientation", "(", ")", ".", "isLeftToRight", "(", ")", ";", "int", "col", "=", "loc", ".", "getColumn", "(", ")", ";", "Rectangle", "rect", "=", "table", ".", "getCellRect", "(", "loc", ".", "getRow", "(", ")", ",", "col", ",", "true", ")", ";", "if", "(", "col", ">=", "table", ".", "getColumnCount", "(", ")", ")", "{", "col", "--", ";", "rect", "=", "table", ".", "getCellRect", "(", "loc", ".", "getRow", "(", ")", ",", "col", ",", "true", ")", ";", "if", "(", "ltr", ")", "{", "rect", ".", "x", "=", "rect", ".", "x", "+", "rect", ".", "width", ";", "}", "}", "else", "if", "(", "!", "ltr", ")", "{", "rect", ".", "x", "=", "rect", ".", "x", "+", "rect", ".", "width", ";", "}", "if", "(", "rect", ".", "x", "==", "0", ")", "{", "rect", ".", "x", "=", "-", "1", ";", "}", "else", "{", "rect", ".", "x", "-=", "2", ";", "}", "rect", ".", "width", "=", "3", ";", "return", "rect", ";", "}" ]
Get the vertical drop line rectangle. @param loc the drop location. @return the rectangle.
[ "Get", "the", "vertical", "drop", "line", "rectangle", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L669-L697
884
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java
SeaGlassTableUI.paintCells
private void paintCells(SeaGlassContext context, Graphics g, int rMin, int rMax, int cMin, int cMax) { JTableHeader header = table.getTableHeader(); TableColumn draggedColumn = (header == null) ? null : header.getDraggedColumn(); TableColumnModel cm = table.getColumnModel(); int columnMargin = cm.getColumnMargin(); Rectangle cellRect; TableColumn aColumn; int columnWidth; if (table.getComponentOrientation().isLeftToRight()) { for (int row = rMin; row <= rMax; row++) { cellRect = table.getCellRect(row, cMin, false); for (int column = cMin; column <= cMax; column++) { aColumn = cm.getColumn(column); columnWidth = aColumn.getWidth(); cellRect.width = columnWidth - columnMargin; if (aColumn != draggedColumn) { paintCell(context, g, cellRect, row, column); } cellRect.x += columnWidth; } } } else { for (int row = rMin; row <= rMax; row++) { cellRect = table.getCellRect(row, cMin, false); aColumn = cm.getColumn(cMin); if (aColumn != draggedColumn) { columnWidth = aColumn.getWidth(); cellRect.width = columnWidth - columnMargin; paintCell(context, g, cellRect, row, cMin); } for (int column = cMin + 1; column <= cMax; column++) { aColumn = cm.getColumn(column); columnWidth = aColumn.getWidth(); cellRect.width = columnWidth - columnMargin; cellRect.x -= columnWidth; if (aColumn != draggedColumn) { paintCell(context, g, cellRect, row, column); } } } } // Paint the dragged column if we are dragging. if (draggedColumn != null) { paintDraggedArea(context, g, rMin, rMax, draggedColumn, header.getDraggedDistance()); } // Remove any renderers that may be left in the rendererPane. rendererPane.removeAll(); }
java
private void paintCells(SeaGlassContext context, Graphics g, int rMin, int rMax, int cMin, int cMax) { JTableHeader header = table.getTableHeader(); TableColumn draggedColumn = (header == null) ? null : header.getDraggedColumn(); TableColumnModel cm = table.getColumnModel(); int columnMargin = cm.getColumnMargin(); Rectangle cellRect; TableColumn aColumn; int columnWidth; if (table.getComponentOrientation().isLeftToRight()) { for (int row = rMin; row <= rMax; row++) { cellRect = table.getCellRect(row, cMin, false); for (int column = cMin; column <= cMax; column++) { aColumn = cm.getColumn(column); columnWidth = aColumn.getWidth(); cellRect.width = columnWidth - columnMargin; if (aColumn != draggedColumn) { paintCell(context, g, cellRect, row, column); } cellRect.x += columnWidth; } } } else { for (int row = rMin; row <= rMax; row++) { cellRect = table.getCellRect(row, cMin, false); aColumn = cm.getColumn(cMin); if (aColumn != draggedColumn) { columnWidth = aColumn.getWidth(); cellRect.width = columnWidth - columnMargin; paintCell(context, g, cellRect, row, cMin); } for (int column = cMin + 1; column <= cMax; column++) { aColumn = cm.getColumn(column); columnWidth = aColumn.getWidth(); cellRect.width = columnWidth - columnMargin; cellRect.x -= columnWidth; if (aColumn != draggedColumn) { paintCell(context, g, cellRect, row, column); } } } } // Paint the dragged column if we are dragging. if (draggedColumn != null) { paintDraggedArea(context, g, rMin, rMax, draggedColumn, header.getDraggedDistance()); } // Remove any renderers that may be left in the rendererPane. rendererPane.removeAll(); }
[ "private", "void", "paintCells", "(", "SeaGlassContext", "context", ",", "Graphics", "g", ",", "int", "rMin", ",", "int", "rMax", ",", "int", "cMin", ",", "int", "cMax", ")", "{", "JTableHeader", "header", "=", "table", ".", "getTableHeader", "(", ")", ";", "TableColumn", "draggedColumn", "=", "(", "header", "==", "null", ")", "?", "null", ":", "header", ".", "getDraggedColumn", "(", ")", ";", "TableColumnModel", "cm", "=", "table", ".", "getColumnModel", "(", ")", ";", "int", "columnMargin", "=", "cm", ".", "getColumnMargin", "(", ")", ";", "Rectangle", "cellRect", ";", "TableColumn", "aColumn", ";", "int", "columnWidth", ";", "if", "(", "table", ".", "getComponentOrientation", "(", ")", ".", "isLeftToRight", "(", ")", ")", "{", "for", "(", "int", "row", "=", "rMin", ";", "row", "<=", "rMax", ";", "row", "++", ")", "{", "cellRect", "=", "table", ".", "getCellRect", "(", "row", ",", "cMin", ",", "false", ")", ";", "for", "(", "int", "column", "=", "cMin", ";", "column", "<=", "cMax", ";", "column", "++", ")", "{", "aColumn", "=", "cm", ".", "getColumn", "(", "column", ")", ";", "columnWidth", "=", "aColumn", ".", "getWidth", "(", ")", ";", "cellRect", ".", "width", "=", "columnWidth", "-", "columnMargin", ";", "if", "(", "aColumn", "!=", "draggedColumn", ")", "{", "paintCell", "(", "context", ",", "g", ",", "cellRect", ",", "row", ",", "column", ")", ";", "}", "cellRect", ".", "x", "+=", "columnWidth", ";", "}", "}", "}", "else", "{", "for", "(", "int", "row", "=", "rMin", ";", "row", "<=", "rMax", ";", "row", "++", ")", "{", "cellRect", "=", "table", ".", "getCellRect", "(", "row", ",", "cMin", ",", "false", ")", ";", "aColumn", "=", "cm", ".", "getColumn", "(", "cMin", ")", ";", "if", "(", "aColumn", "!=", "draggedColumn", ")", "{", "columnWidth", "=", "aColumn", ".", "getWidth", "(", ")", ";", "cellRect", ".", "width", "=", "columnWidth", "-", "columnMargin", ";", "paintCell", "(", "context", ",", "g", ",", "cellRect", ",", "row", ",", "cMin", ")", ";", "}", "for", "(", "int", "column", "=", "cMin", "+", "1", ";", "column", "<=", "cMax", ";", "column", "++", ")", "{", "aColumn", "=", "cm", ".", "getColumn", "(", "column", ")", ";", "columnWidth", "=", "aColumn", ".", "getWidth", "(", ")", ";", "cellRect", ".", "width", "=", "columnWidth", "-", "columnMargin", ";", "cellRect", ".", "x", "-=", "columnWidth", ";", "if", "(", "aColumn", "!=", "draggedColumn", ")", "{", "paintCell", "(", "context", ",", "g", ",", "cellRect", ",", "row", ",", "column", ")", ";", "}", "}", "}", "}", "// Paint the dragged column if we are dragging.", "if", "(", "draggedColumn", "!=", "null", ")", "{", "paintDraggedArea", "(", "context", ",", "g", ",", "rMin", ",", "rMax", ",", "draggedColumn", ",", "header", ".", "getDraggedDistance", "(", ")", ")", ";", "}", "// Remove any renderers that may be left in the rendererPane.", "rendererPane", ".", "removeAll", "(", ")", ";", "}" ]
Paint cells. @param context DOCUMENT ME! @param g DOCUMENT ME! @param rMin DOCUMENT ME! @param rMax DOCUMENT ME! @param cMin DOCUMENT ME! @param cMax DOCUMENT ME!
[ "Paint", "cells", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L817-L871
885
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/WindowUtils.java
WindowUtils.setWindowShape
public static void setWindowShape(Window window, Shape s) { if (PlatformUtils.isJava6()) { setWindowShapeJava6(window, s); } else { setWindowShapeJava7(window, s); } }
java
public static void setWindowShape(Window window, Shape s) { if (PlatformUtils.isJava6()) { setWindowShapeJava6(window, s); } else { setWindowShapeJava7(window, s); } }
[ "public", "static", "void", "setWindowShape", "(", "Window", "window", ",", "Shape", "s", ")", "{", "if", "(", "PlatformUtils", ".", "isJava6", "(", ")", ")", "{", "setWindowShapeJava6", "(", "window", ",", "s", ")", ";", "}", "else", "{", "setWindowShapeJava7", "(", "window", ",", "s", ")", ";", "}", "}" ]
Sets the shape of a window. This will be done via a com.sun API and may be not available on all platforms. @param window to change the shape for @param s the new shape for the window.
[ "Sets", "the", "shape", "of", "a", "window", ".", "This", "will", "be", "done", "via", "a", "com", ".", "sun", "API", "and", "may", "be", "not", "available", "on", "all", "platforms", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/WindowUtils.java#L75-L81
886
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/WindowUtils.java
WindowUtils.createWeakWindowFocusListener
private static WindowListener createWeakWindowFocusListener(WindowFocusListener windowFocusListener) { final WeakReference<WindowFocusListener> weakReference = new WeakReference<WindowFocusListener>(windowFocusListener); return new WindowAdapter() { public void windowActivated(WindowEvent e) { // TODO if the WeakReference's object is null, remove the // WeakReference as a FocusListener. if (weakReference.get() != null) { weakReference.get().windowGainedFocus(e); } } public void windowDeactivated(WindowEvent e) { if (weakReference.get() != null) { weakReference.get().windowLostFocus(e); } } }; }
java
private static WindowListener createWeakWindowFocusListener(WindowFocusListener windowFocusListener) { final WeakReference<WindowFocusListener> weakReference = new WeakReference<WindowFocusListener>(windowFocusListener); return new WindowAdapter() { public void windowActivated(WindowEvent e) { // TODO if the WeakReference's object is null, remove the // WeakReference as a FocusListener. if (weakReference.get() != null) { weakReference.get().windowGainedFocus(e); } } public void windowDeactivated(WindowEvent e) { if (weakReference.get() != null) { weakReference.get().windowLostFocus(e); } } }; }
[ "private", "static", "WindowListener", "createWeakWindowFocusListener", "(", "WindowFocusListener", "windowFocusListener", ")", "{", "final", "WeakReference", "<", "WindowFocusListener", ">", "weakReference", "=", "new", "WeakReference", "<", "WindowFocusListener", ">", "(", "windowFocusListener", ")", ";", "return", "new", "WindowAdapter", "(", ")", "{", "public", "void", "windowActivated", "(", "WindowEvent", "e", ")", "{", "// TODO if the WeakReference's object is null, remove the", "// WeakReference as a FocusListener.", "if", "(", "weakReference", ".", "get", "(", ")", "!=", "null", ")", "{", "weakReference", ".", "get", "(", ")", ".", "windowGainedFocus", "(", "e", ")", ";", "}", "}", "public", "void", "windowDeactivated", "(", "WindowEvent", "e", ")", "{", "if", "(", "weakReference", ".", "get", "(", ")", "!=", "null", ")", "{", "weakReference", ".", "get", "(", ")", ".", "windowLostFocus", "(", "e", ")", ";", "}", "}", "}", ";", "}" ]
Create the weak window focus listener. @param windowFocusListener the focus listener @return the weak referenced listener.
[ "Create", "the", "weak", "window", "focus", "listener", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/WindowUtils.java#L199-L217
887
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/WindowUtils.java
WindowUtils.createAncestorListener
private static AncestorListener createAncestorListener(JComponent component, final WindowListener windowListener) { final WeakReference<JComponent> weakReference = new WeakReference<JComponent>(component); return new AncestorListener() { public void ancestorAdded(AncestorEvent event) { // TODO if the WeakReference's object is null, remove the // WeakReference as an AncestorListener. Window window = weakReference.get() == null ? null : SwingUtilities.getWindowAncestor(weakReference.get()); if (window != null) { window.removeWindowListener(windowListener); window.addWindowListener(windowListener); } } public void ancestorRemoved(AncestorEvent event) { Window window = weakReference.get() == null ? null : SwingUtilities.getWindowAncestor(weakReference.get()); if (window != null) { window.removeWindowListener(windowListener); } } public void ancestorMoved(AncestorEvent event) { // no implementation. } }; }
java
private static AncestorListener createAncestorListener(JComponent component, final WindowListener windowListener) { final WeakReference<JComponent> weakReference = new WeakReference<JComponent>(component); return new AncestorListener() { public void ancestorAdded(AncestorEvent event) { // TODO if the WeakReference's object is null, remove the // WeakReference as an AncestorListener. Window window = weakReference.get() == null ? null : SwingUtilities.getWindowAncestor(weakReference.get()); if (window != null) { window.removeWindowListener(windowListener); window.addWindowListener(windowListener); } } public void ancestorRemoved(AncestorEvent event) { Window window = weakReference.get() == null ? null : SwingUtilities.getWindowAncestor(weakReference.get()); if (window != null) { window.removeWindowListener(windowListener); } } public void ancestorMoved(AncestorEvent event) { // no implementation. } }; }
[ "private", "static", "AncestorListener", "createAncestorListener", "(", "JComponent", "component", ",", "final", "WindowListener", "windowListener", ")", "{", "final", "WeakReference", "<", "JComponent", ">", "weakReference", "=", "new", "WeakReference", "<", "JComponent", ">", "(", "component", ")", ";", "return", "new", "AncestorListener", "(", ")", "{", "public", "void", "ancestorAdded", "(", "AncestorEvent", "event", ")", "{", "// TODO if the WeakReference's object is null, remove the", "// WeakReference as an AncestorListener.", "Window", "window", "=", "weakReference", ".", "get", "(", ")", "==", "null", "?", "null", ":", "SwingUtilities", ".", "getWindowAncestor", "(", "weakReference", ".", "get", "(", ")", ")", ";", "if", "(", "window", "!=", "null", ")", "{", "window", ".", "removeWindowListener", "(", "windowListener", ")", ";", "window", ".", "addWindowListener", "(", "windowListener", ")", ";", "}", "}", "public", "void", "ancestorRemoved", "(", "AncestorEvent", "event", ")", "{", "Window", "window", "=", "weakReference", ".", "get", "(", ")", "==", "null", "?", "null", ":", "SwingUtilities", ".", "getWindowAncestor", "(", "weakReference", ".", "get", "(", ")", ")", ";", "if", "(", "window", "!=", "null", ")", "{", "window", ".", "removeWindowListener", "(", "windowListener", ")", ";", "}", "}", "public", "void", "ancestorMoved", "(", "AncestorEvent", "event", ")", "{", "// no implementation.", "}", "}", ";", "}" ]
Create the ancestor listener. @param component the component. @param windowListener the listener. @return the weak referenced listener.
[ "Create", "the", "ancestor", "listener", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/WindowUtils.java#L246-L273
888
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/WindowUtils.java
WindowUtils.createRepaintWindowListener
private static WindowFocusListener createRepaintWindowListener(final JComponent component) { return new WindowAdapter() { public void windowActivated(WindowEvent e) { component.repaint(); } public void windowDeactivated(WindowEvent e) { component.repaint(); } }; }
java
private static WindowFocusListener createRepaintWindowListener(final JComponent component) { return new WindowAdapter() { public void windowActivated(WindowEvent e) { component.repaint(); } public void windowDeactivated(WindowEvent e) { component.repaint(); } }; }
[ "private", "static", "WindowFocusListener", "createRepaintWindowListener", "(", "final", "JComponent", "component", ")", "{", "return", "new", "WindowAdapter", "(", ")", "{", "public", "void", "windowActivated", "(", "WindowEvent", "e", ")", "{", "component", ".", "repaint", "(", ")", ";", "}", "public", "void", "windowDeactivated", "(", "WindowEvent", "e", ")", "{", "component", ".", "repaint", "(", ")", ";", "}", "}", ";", "}" ]
Create the repaint window listener. @param component the component. @return the listener.
[ "Create", "the", "repaint", "window", "listener", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/WindowUtils.java#L282-L292
889
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassRootPaneUI.java
SeaGlassRootPaneUI.updateTextured
private void updateTextured() { // Need the content pane to not be opaque. paintTextured = (root.getClientProperty(UNIFIED_TOOLBAR_LOOK) == Boolean.TRUE); if (paintTextured && PlatformUtils.isMac()) { if (root.isValid()) { throw new IllegalArgumentException("This method only works if the given JRootPane has not yet been realized."); } root.putClientProperty("apple.awt.brushMetalLook", Boolean.TRUE); // Need the content pane to not be opaque. LookAndFeel.installProperty((JComponent) root.getContentPane(), "opaque", Boolean.FALSE); } else { root.putClientProperty("apple.awt.brushMetalLook", null); // FIXME Restore original content pane opacity. } }
java
private void updateTextured() { // Need the content pane to not be opaque. paintTextured = (root.getClientProperty(UNIFIED_TOOLBAR_LOOK) == Boolean.TRUE); if (paintTextured && PlatformUtils.isMac()) { if (root.isValid()) { throw new IllegalArgumentException("This method only works if the given JRootPane has not yet been realized."); } root.putClientProperty("apple.awt.brushMetalLook", Boolean.TRUE); // Need the content pane to not be opaque. LookAndFeel.installProperty((JComponent) root.getContentPane(), "opaque", Boolean.FALSE); } else { root.putClientProperty("apple.awt.brushMetalLook", null); // FIXME Restore original content pane opacity. } }
[ "private", "void", "updateTextured", "(", ")", "{", "// Need the content pane to not be opaque.", "paintTextured", "=", "(", "root", ".", "getClientProperty", "(", "UNIFIED_TOOLBAR_LOOK", ")", "==", "Boolean", ".", "TRUE", ")", ";", "if", "(", "paintTextured", "&&", "PlatformUtils", ".", "isMac", "(", ")", ")", "{", "if", "(", "root", ".", "isValid", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"This method only works if the given JRootPane has not yet been realized.\"", ")", ";", "}", "root", ".", "putClientProperty", "(", "\"apple.awt.brushMetalLook\"", ",", "Boolean", ".", "TRUE", ")", ";", "// Need the content pane to not be opaque.", "LookAndFeel", ".", "installProperty", "(", "(", "JComponent", ")", "root", ".", "getContentPane", "(", ")", ",", "\"opaque\"", ",", "Boolean", ".", "FALSE", ")", ";", "}", "else", "{", "root", ".", "putClientProperty", "(", "\"apple.awt.brushMetalLook\"", ",", "null", ")", ";", "// FIXME Restore original content pane opacity.", "}", "}" ]
Set the textured properties.
[ "Set", "the", "textured", "properties", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassRootPaneUI.java#L246-L263
890
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassRootPaneUI.java
SeaGlassRootPaneUI.createFocusListener
private WindowListener createFocusListener() { return new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { if (root != null) { root.repaint(); } } @Override public void windowDeactivated(WindowEvent e) { if (root != null) { root.repaint(); } } }; }
java
private WindowListener createFocusListener() { return new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { if (root != null) { root.repaint(); } } @Override public void windowDeactivated(WindowEvent e) { if (root != null) { root.repaint(); } } }; }
[ "private", "WindowListener", "createFocusListener", "(", ")", "{", "return", "new", "WindowAdapter", "(", ")", "{", "@", "Override", "public", "void", "windowActivated", "(", "WindowEvent", "e", ")", "{", "if", "(", "root", "!=", "null", ")", "{", "root", ".", "repaint", "(", ")", ";", "}", "}", "@", "Override", "public", "void", "windowDeactivated", "(", "WindowEvent", "e", ")", "{", "if", "(", "root", "!=", "null", ")", "{", "root", ".", "repaint", "(", ")", ";", "}", "}", "}", ";", "}" ]
Creates the focus listener. @return the focus listener.
[ "Creates", "the", "focus", "listener", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassRootPaneUI.java#L373-L389
891
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/WindowDragger.java
WindowDragger.createMouseListener
private MouseListener createMouseListener() { return new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { Point clickPoint = new Point(e.getPoint()); SwingUtilities.convertPointToScreen(clickPoint, fComponent); dX = clickPoint.x - fWindow.getX(); dY = clickPoint.y - fWindow.getY(); } }; }
java
private MouseListener createMouseListener() { return new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { Point clickPoint = new Point(e.getPoint()); SwingUtilities.convertPointToScreen(clickPoint, fComponent); dX = clickPoint.x - fWindow.getX(); dY = clickPoint.y - fWindow.getY(); } }; }
[ "private", "MouseListener", "createMouseListener", "(", ")", "{", "return", "new", "MouseAdapter", "(", ")", "{", "@", "Override", "public", "void", "mousePressed", "(", "MouseEvent", "e", ")", "{", "Point", "clickPoint", "=", "new", "Point", "(", "e", ".", "getPoint", "(", ")", ")", ";", "SwingUtilities", ".", "convertPointToScreen", "(", "clickPoint", ",", "fComponent", ")", ";", "dX", "=", "clickPoint", ".", "x", "-", "fWindow", ".", "getX", "(", ")", ";", "dY", "=", "clickPoint", ".", "y", "-", "fWindow", ".", "getY", "(", ")", ";", "}", "}", ";", "}" ]
Create the mouse listener. @return the mouse listener.
[ "Create", "the", "mouse", "listener", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/WindowDragger.java#L80-L92
892
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/WindowDragger.java
WindowDragger.createMouseMotionListener
private MouseMotionAdapter createMouseMotionListener() { return new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent e) { Point dragPoint = new Point(e.getPoint()); SwingUtilities.convertPointToScreen(dragPoint, fComponent); fWindow.setLocation(dragPoint.x - dX, dragPoint.y - dY); } }; }
java
private MouseMotionAdapter createMouseMotionListener() { return new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent e) { Point dragPoint = new Point(e.getPoint()); SwingUtilities.convertPointToScreen(dragPoint, fComponent); fWindow.setLocation(dragPoint.x - dX, dragPoint.y - dY); } }; }
[ "private", "MouseMotionAdapter", "createMouseMotionListener", "(", ")", "{", "return", "new", "MouseMotionAdapter", "(", ")", "{", "@", "Override", "public", "void", "mouseDragged", "(", "MouseEvent", "e", ")", "{", "Point", "dragPoint", "=", "new", "Point", "(", "e", ".", "getPoint", "(", ")", ")", ";", "SwingUtilities", ".", "convertPointToScreen", "(", "dragPoint", ",", "fComponent", ")", ";", "fWindow", ".", "setLocation", "(", "dragPoint", ".", "x", "-", "dX", ",", "dragPoint", ".", "y", "-", "dY", ")", ";", "}", "}", ";", "}" ]
Create the mouse motion listener. @return the mouse motion listener.
[ "Create", "the", "mouse", "motion", "listener", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/WindowDragger.java#L99-L110
893
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java
TitlePaneMenuButtonPainter.paintMenu
private void paintMenu(Graphics2D g, JComponent c, int width, int height, ButtonColors colors) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setColor(colors.top); g.drawLine(0, 0, width - 2, 0); g.setColor(colors.leftOuter); g.drawLine(0, 0, 0, height - 4); g.setColor(colors.leftInner); g.drawLine(1, 1, 1, height - 4); g.drawLine(2, height - 3, 2, height - 3); Shape s = decodeInterior(width, height); g.setColor(colors.interior); g.fill(s); s = decodeEdge(width, height); g.setColor(colors.edge); g.draw(s); g.setColor(colors.edgeShade); g.drawLine(2, height - 2, 2, height - 2); g.drawLine(1, height - 3, 1, height - 3); g.drawLine(0, height - 4, 0, height - 4); s = decodeShadow(width, height); g.setColor(colors.shadow); g.draw(s); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); s = decodeMarkInterior(width, height); g.setColor(colors.markInterior); g.fill(s); s = decodeMarkBorder(width, height); g.setColor(colors.markBorder); g.draw(s); }
java
private void paintMenu(Graphics2D g, JComponent c, int width, int height, ButtonColors colors) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g.setColor(colors.top); g.drawLine(0, 0, width - 2, 0); g.setColor(colors.leftOuter); g.drawLine(0, 0, 0, height - 4); g.setColor(colors.leftInner); g.drawLine(1, 1, 1, height - 4); g.drawLine(2, height - 3, 2, height - 3); Shape s = decodeInterior(width, height); g.setColor(colors.interior); g.fill(s); s = decodeEdge(width, height); g.setColor(colors.edge); g.draw(s); g.setColor(colors.edgeShade); g.drawLine(2, height - 2, 2, height - 2); g.drawLine(1, height - 3, 1, height - 3); g.drawLine(0, height - 4, 0, height - 4); s = decodeShadow(width, height); g.setColor(colors.shadow); g.draw(s); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); s = decodeMarkInterior(width, height); g.setColor(colors.markInterior); g.fill(s); s = decodeMarkBorder(width, height); g.setColor(colors.markBorder); g.draw(s); }
[ "private", "void", "paintMenu", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ",", "ButtonColors", "colors", ")", "{", "g", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_ANTIALIASING", ",", "RenderingHints", ".", "VALUE_ANTIALIAS_OFF", ")", ";", "g", ".", "setColor", "(", "colors", ".", "top", ")", ";", "g", ".", "drawLine", "(", "0", ",", "0", ",", "width", "-", "2", ",", "0", ")", ";", "g", ".", "setColor", "(", "colors", ".", "leftOuter", ")", ";", "g", ".", "drawLine", "(", "0", ",", "0", ",", "0", ",", "height", "-", "4", ")", ";", "g", ".", "setColor", "(", "colors", ".", "leftInner", ")", ";", "g", ".", "drawLine", "(", "1", ",", "1", ",", "1", ",", "height", "-", "4", ")", ";", "g", ".", "drawLine", "(", "2", ",", "height", "-", "3", ",", "2", ",", "height", "-", "3", ")", ";", "Shape", "s", "=", "decodeInterior", "(", "width", ",", "height", ")", ";", "g", ".", "setColor", "(", "colors", ".", "interior", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "s", "=", "decodeEdge", "(", "width", ",", "height", ")", ";", "g", ".", "setColor", "(", "colors", ".", "edge", ")", ";", "g", ".", "draw", "(", "s", ")", ";", "g", ".", "setColor", "(", "colors", ".", "edgeShade", ")", ";", "g", ".", "drawLine", "(", "2", ",", "height", "-", "2", ",", "2", ",", "height", "-", "2", ")", ";", "g", ".", "drawLine", "(", "1", ",", "height", "-", "3", ",", "1", ",", "height", "-", "3", ")", ";", "g", ".", "drawLine", "(", "0", ",", "height", "-", "4", ",", "0", ",", "height", "-", "4", ")", ";", "s", "=", "decodeShadow", "(", "width", ",", "height", ")", ";", "g", ".", "setColor", "(", "colors", ".", "shadow", ")", ";", "g", ".", "draw", "(", "s", ")", ";", "g", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_ANTIALIASING", ",", "RenderingHints", ".", "VALUE_ANTIALIAS_ON", ")", ";", "s", "=", "decodeMarkInterior", "(", "width", ",", "height", ")", ";", "g", ".", "setColor", "(", "colors", ".", "markInterior", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "s", "=", "decodeMarkBorder", "(", "width", ",", "height", ")", ";", "g", ".", "setColor", "(", "colors", ".", "markBorder", ")", ";", "g", ".", "draw", "(", "s", ")", ";", "}" ]
Paint the button using the specified colors. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component. @param colors the color set to use to paint the button.
[ "Paint", "the", "button", "using", "the", "specified", "colors", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java#L147-L187
894
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java
TitlePaneMenuButtonPainter.decodeInterior
private Shape decodeInterior(int width, int height) { path.reset(); path.moveTo(1, 1); path.lineTo(width - 2, 1); path.lineTo(width - 2, height - 3); path.lineTo(width - 3, height - 2); path.lineTo(3, height - 2); path.lineTo(2, height - 3); path.closePath(); return path; }
java
private Shape decodeInterior(int width, int height) { path.reset(); path.moveTo(1, 1); path.lineTo(width - 2, 1); path.lineTo(width - 2, height - 3); path.lineTo(width - 3, height - 2); path.lineTo(3, height - 2); path.lineTo(2, height - 3); path.closePath(); return path; }
[ "private", "Shape", "decodeInterior", "(", "int", "width", ",", "int", "height", ")", "{", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "1", ",", "1", ")", ";", "path", ".", "lineTo", "(", "width", "-", "2", ",", "1", ")", ";", "path", ".", "lineTo", "(", "width", "-", "2", ",", "height", "-", "3", ")", ";", "path", ".", "lineTo", "(", "width", "-", "3", ",", "height", "-", "2", ")", ";", "path", ".", "lineTo", "(", "3", ",", "height", "-", "2", ")", ";", "path", ".", "lineTo", "(", "2", ",", "height", "-", "3", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Create the button interior shape @param width the width. @param height the height. @return the shape of the button interior.
[ "Create", "the", "button", "interior", "shape" ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java#L197-L208
895
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java
TitlePaneMenuButtonPainter.decodeMarkBorder
private Shape decodeMarkBorder(int width, int height) { double left = width / 2.0 - 4; double top = height / 2.0 - 4; path.reset(); path.moveTo(left + 0, top + 0); path.lineTo(left + 8, top); path.lineTo(left + 4, top + 6); path.closePath(); return path; }
java
private Shape decodeMarkBorder(int width, int height) { double left = width / 2.0 - 4; double top = height / 2.0 - 4; path.reset(); path.moveTo(left + 0, top + 0); path.lineTo(left + 8, top); path.lineTo(left + 4, top + 6); path.closePath(); return path; }
[ "private", "Shape", "decodeMarkBorder", "(", "int", "width", ",", "int", "height", ")", "{", "double", "left", "=", "width", "/", "2.0", "-", "4", ";", "double", "top", "=", "height", "/", "2.0", "-", "4", ";", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "left", "+", "0", ",", "top", "+", "0", ")", ";", "path", ".", "lineTo", "(", "left", "+", "8", ",", "top", ")", ";", "path", ".", "lineTo", "(", "left", "+", "4", ",", "top", "+", "6", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Create the mark border shape. @param width the width. @param height the height. @return the shape of the mark border.
[ "Create", "the", "mark", "border", "shape", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java#L255-L266
896
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/SeaGlassGraphicsUtils.java
SeaGlassGraphicsUtils.paintText
public void paintText(SynthContext ss, Graphics g, String text, int x, int y, int mnemonicIndex) { if (text != null) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); JComponent c = ss.getComponent(); // SynthStyle style = ss.getStyle(); FontMetrics fm = SwingUtilities2.getFontMetrics(c, g2d); y += fm.getAscent(); SwingUtilities2.drawString(c, g2d, text, x, y); if (mnemonicIndex >= 0 && mnemonicIndex < text.length()) { int underlineX = x + SwingUtilities2.stringWidth(c, fm, text.substring(0, mnemonicIndex)); int underlineY = y; int underlineWidth = fm.charWidth(text.charAt(mnemonicIndex)); int underlineHeight = 1; g2d.fillRect(underlineX, underlineY + fm.getDescent() - 1, underlineWidth, underlineHeight); } } }
java
public void paintText(SynthContext ss, Graphics g, String text, int x, int y, int mnemonicIndex) { if (text != null) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); JComponent c = ss.getComponent(); // SynthStyle style = ss.getStyle(); FontMetrics fm = SwingUtilities2.getFontMetrics(c, g2d); y += fm.getAscent(); SwingUtilities2.drawString(c, g2d, text, x, y); if (mnemonicIndex >= 0 && mnemonicIndex < text.length()) { int underlineX = x + SwingUtilities2.stringWidth(c, fm, text.substring(0, mnemonicIndex)); int underlineY = y; int underlineWidth = fm.charWidth(text.charAt(mnemonicIndex)); int underlineHeight = 1; g2d.fillRect(underlineX, underlineY + fm.getDescent() - 1, underlineWidth, underlineHeight); } } }
[ "public", "void", "paintText", "(", "SynthContext", "ss", ",", "Graphics", "g", ",", "String", "text", ",", "int", "x", ",", "int", "y", ",", "int", "mnemonicIndex", ")", "{", "if", "(", "text", "!=", "null", ")", "{", "Graphics2D", "g2d", "=", "(", "Graphics2D", ")", "g", ".", "create", "(", ")", ";", "g2d", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_TEXT_ANTIALIASING", ",", "RenderingHints", ".", "VALUE_TEXT_ANTIALIAS_ON", ")", ";", "JComponent", "c", "=", "ss", ".", "getComponent", "(", ")", ";", "// SynthStyle style = ss.getStyle();", "FontMetrics", "fm", "=", "SwingUtilities2", ".", "getFontMetrics", "(", "c", ",", "g2d", ")", ";", "y", "+=", "fm", ".", "getAscent", "(", ")", ";", "SwingUtilities2", ".", "drawString", "(", "c", ",", "g2d", ",", "text", ",", "x", ",", "y", ")", ";", "if", "(", "mnemonicIndex", ">=", "0", "&&", "mnemonicIndex", "<", "text", ".", "length", "(", ")", ")", "{", "int", "underlineX", "=", "x", "+", "SwingUtilities2", ".", "stringWidth", "(", "c", ",", "fm", ",", "text", ".", "substring", "(", "0", ",", "mnemonicIndex", ")", ")", ";", "int", "underlineY", "=", "y", ";", "int", "underlineWidth", "=", "fm", ".", "charWidth", "(", "text", ".", "charAt", "(", "mnemonicIndex", ")", ")", ";", "int", "underlineHeight", "=", "1", ";", "g2d", ".", "fillRect", "(", "underlineX", ",", "underlineY", "+", "fm", ".", "getDescent", "(", ")", "-", "1", ",", "underlineWidth", ",", "underlineHeight", ")", ";", "}", "}", "}" ]
Paints text at the specified location. This will not attempt to render the text as html nor will it offset by the insets of the component. @param ss SynthContext @param g Graphics used to render string in. @param text Text to render @param x X location to draw text at. @param y Upper left corner to draw text at. @param mnemonicIndex Index to draw string at.
[ "Paints", "text", "at", "the", "specified", "location", ".", "This", "will", "not", "attempt", "to", "render", "the", "text", "as", "html", "nor", "will", "it", "offset", "by", "the", "insets", "of", "the", "component", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/SeaGlassGraphicsUtils.java#L211-L233
897
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/SeaGlassGraphicsUtils.java
SeaGlassGraphicsUtils.paintText
public void paintText(SynthContext ss, Graphics g, String text, Icon icon, int hAlign, int vAlign, int hTextPosition, int vTextPosition, int iconTextGap, int mnemonicIndex, int textOffset) { if ((icon == null) && (text == null)) { return; } Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); JComponent c = ss.getComponent(); FontMetrics fm = SwingUtilities2.getFontMetrics(c, g2d); Insets insets = SeaGlassLookAndFeel.getPaintingInsets(ss, paintInsets); paintViewR.x = insets.left; paintViewR.y = insets.top; paintViewR.width = c.getWidth() - (insets.left + insets.right); paintViewR.height = c.getHeight() - (insets.top + insets.bottom); paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0; paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0; String clippedText = layoutText(ss, fm, text, icon, hAlign, vAlign, hTextPosition, vTextPosition, paintViewR, paintIconR, paintTextR, iconTextGap); if (icon != null) { Color color = g2d.getColor(); paintIconR.x += textOffset; paintIconR.y += textOffset; SeaGlassIcon.paintIcon(icon, ss, g2d, paintIconR.x, paintIconR.y, paintIconR.width, paintIconR.height); g2d.setColor(color); } if (text != null) { View v = (View) c.getClientProperty(BasicHTML.propertyKey); if (v != null) { v.paint(g2d, paintTextR); } else { paintTextR.x += textOffset; paintTextR.y += textOffset; paintText(ss, g2d, clippedText, paintTextR, mnemonicIndex); } } }
java
public void paintText(SynthContext ss, Graphics g, String text, Icon icon, int hAlign, int vAlign, int hTextPosition, int vTextPosition, int iconTextGap, int mnemonicIndex, int textOffset) { if ((icon == null) && (text == null)) { return; } Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); JComponent c = ss.getComponent(); FontMetrics fm = SwingUtilities2.getFontMetrics(c, g2d); Insets insets = SeaGlassLookAndFeel.getPaintingInsets(ss, paintInsets); paintViewR.x = insets.left; paintViewR.y = insets.top; paintViewR.width = c.getWidth() - (insets.left + insets.right); paintViewR.height = c.getHeight() - (insets.top + insets.bottom); paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0; paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0; String clippedText = layoutText(ss, fm, text, icon, hAlign, vAlign, hTextPosition, vTextPosition, paintViewR, paintIconR, paintTextR, iconTextGap); if (icon != null) { Color color = g2d.getColor(); paintIconR.x += textOffset; paintIconR.y += textOffset; SeaGlassIcon.paintIcon(icon, ss, g2d, paintIconR.x, paintIconR.y, paintIconR.width, paintIconR.height); g2d.setColor(color); } if (text != null) { View v = (View) c.getClientProperty(BasicHTML.propertyKey); if (v != null) { v.paint(g2d, paintTextR); } else { paintTextR.x += textOffset; paintTextR.y += textOffset; paintText(ss, g2d, clippedText, paintTextR, mnemonicIndex); } } }
[ "public", "void", "paintText", "(", "SynthContext", "ss", ",", "Graphics", "g", ",", "String", "text", ",", "Icon", "icon", ",", "int", "hAlign", ",", "int", "vAlign", ",", "int", "hTextPosition", ",", "int", "vTextPosition", ",", "int", "iconTextGap", ",", "int", "mnemonicIndex", ",", "int", "textOffset", ")", "{", "if", "(", "(", "icon", "==", "null", ")", "&&", "(", "text", "==", "null", ")", ")", "{", "return", ";", "}", "Graphics2D", "g2d", "=", "(", "Graphics2D", ")", "g", ".", "create", "(", ")", ";", "g2d", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_TEXT_ANTIALIASING", ",", "RenderingHints", ".", "VALUE_TEXT_ANTIALIAS_ON", ")", ";", "JComponent", "c", "=", "ss", ".", "getComponent", "(", ")", ";", "FontMetrics", "fm", "=", "SwingUtilities2", ".", "getFontMetrics", "(", "c", ",", "g2d", ")", ";", "Insets", "insets", "=", "SeaGlassLookAndFeel", ".", "getPaintingInsets", "(", "ss", ",", "paintInsets", ")", ";", "paintViewR", ".", "x", "=", "insets", ".", "left", ";", "paintViewR", ".", "y", "=", "insets", ".", "top", ";", "paintViewR", ".", "width", "=", "c", ".", "getWidth", "(", ")", "-", "(", "insets", ".", "left", "+", "insets", ".", "right", ")", ";", "paintViewR", ".", "height", "=", "c", ".", "getHeight", "(", ")", "-", "(", "insets", ".", "top", "+", "insets", ".", "bottom", ")", ";", "paintIconR", ".", "x", "=", "paintIconR", ".", "y", "=", "paintIconR", ".", "width", "=", "paintIconR", ".", "height", "=", "0", ";", "paintTextR", ".", "x", "=", "paintTextR", ".", "y", "=", "paintTextR", ".", "width", "=", "paintTextR", ".", "height", "=", "0", ";", "String", "clippedText", "=", "layoutText", "(", "ss", ",", "fm", ",", "text", ",", "icon", ",", "hAlign", ",", "vAlign", ",", "hTextPosition", ",", "vTextPosition", ",", "paintViewR", ",", "paintIconR", ",", "paintTextR", ",", "iconTextGap", ")", ";", "if", "(", "icon", "!=", "null", ")", "{", "Color", "color", "=", "g2d", ".", "getColor", "(", ")", ";", "paintIconR", ".", "x", "+=", "textOffset", ";", "paintIconR", ".", "y", "+=", "textOffset", ";", "SeaGlassIcon", ".", "paintIcon", "(", "icon", ",", "ss", ",", "g2d", ",", "paintIconR", ".", "x", ",", "paintIconR", ".", "y", ",", "paintIconR", ".", "width", ",", "paintIconR", ".", "height", ")", ";", "g2d", ".", "setColor", "(", "color", ")", ";", "}", "if", "(", "text", "!=", "null", ")", "{", "View", "v", "=", "(", "View", ")", "c", ".", "getClientProperty", "(", "BasicHTML", ".", "propertyKey", ")", ";", "if", "(", "v", "!=", "null", ")", "{", "v", ".", "paint", "(", "g2d", ",", "paintTextR", ")", ";", "}", "else", "{", "paintTextR", ".", "x", "+=", "textOffset", ";", "paintTextR", ".", "y", "+=", "textOffset", ";", "paintText", "(", "ss", ",", "g2d", ",", "clippedText", ",", "paintTextR", ",", "mnemonicIndex", ")", ";", "}", "}", "}" ]
Paints an icon and text. This will render the text as html, if necessary, and offset the location by the insets of the component. @param ss SynthContext @param g Graphics to render string and icon into @param text Text to layout @param icon Icon to layout @param hAlign horizontal alignment @param vAlign vertical alignment @param hTextPosition horizontal text position @param vTextPosition vertical text position @param iconTextGap gap between icon and text @param mnemonicIndex Index into text to render the mnemonic at, -1 indicates no mnemonic. @param textOffset Amount to offset the text when painting
[ "Paints", "an", "icon", "and", "text", ".", "This", "will", "render", "the", "text", "as", "html", "if", "necessary", "and", "offset", "the", "location", "by", "the", "insets", "of", "the", "component", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/SeaGlassGraphicsUtils.java#L280-L325
898
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneMaximizeButtonPainter.java
TitlePaneMaximizeButtonPainter.paintMaximizeEnabled
private void paintMaximizeEnabled(Graphics2D g, JComponent c, int width, int height) { maximizePainter.paintEnabled(g, c, width, height); }
java
private void paintMaximizeEnabled(Graphics2D g, JComponent c, int width, int height) { maximizePainter.paintEnabled(g, c, width, height); }
[ "private", "void", "paintMaximizeEnabled", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "maximizePainter", ".", "paintEnabled", "(", "g", ",", "c", ",", "width", ",", "height", ")", ";", "}" ]
Paint the foreground maximized button enabled state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "foreground", "maximized", "button", "enabled", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMaximizeButtonPainter.java#L173-L175
899
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneMaximizeButtonPainter.java
TitlePaneMaximizeButtonPainter.paintMaximizeHover
private void paintMaximizeHover(Graphics2D g, JComponent c, int width, int height) { maximizePainter.paintHover(g, c, width, height); }
java
private void paintMaximizeHover(Graphics2D g, JComponent c, int width, int height) { maximizePainter.paintHover(g, c, width, height); }
[ "private", "void", "paintMaximizeHover", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "maximizePainter", ".", "paintHover", "(", "g", ",", "c", ",", "width", ",", "height", ")", ";", "}" ]
Paint the foreground maximized button mouse-over state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "foreground", "maximized", "button", "mouse", "-", "over", "state", "." ]
f25ecba622923d7b29b64cb7d6068dd8005989b3
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMaximizeButtonPainter.java#L185-L187