Java Code Examples for java.awt.SystemColor

The following examples show how to use java.awt.SystemColor. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans   Source File: BrowserConsoleLogger.java    License: Apache License 2.0 6 votes vote down vote up
private void setIOColors() {
    if (IOColors.isSupported(io) && IOColorPrint.isSupported(io)) {
        Color colorStd = IOColors.getColor(io, IOColors.OutputType.OUTPUT);
        //Color colorErr = IOColors.getColor(io, IOColors.OutputType.ERROR);
        Color background = UIManager.getDefaults().getColor("nb.output.background");    // NOI18N
        if (background == null) {
            background = SystemColor.window;
        }
        colorStdBrighter = shiftTowards(colorStd, background);
        //colorErrBrighter = shiftTowards(colorErr, background);
        Color foreground = UIManager.getDefaults().getColor("nb.output.foreground");    // NOI18N
        if (foreground == null) {
            foreground = SystemColor.textText;
        }
        IOColors.setColor(io, IOColors.OutputType.INPUT, shiftTowards(foreground, Color.GREEN));
    }
}
 
Example 2
Source Project: netbeans   Source File: ColorComboBoxRenderer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Component getListCellRendererComponent (
    JList<? extends ColorValue>
                list,
    ColorValue  value,
    int         index,
    boolean     isSelected,
    boolean     cellHasFocus
) {
    this.value = value;
    setEnabled (list.isEnabled ());
    setBackground (isSelected ? 
        SystemColor.textHighlight : SystemColor.text
        //Color.RED
    );
    setForeground (isSelected ? 
        SystemColor.textHighlightText : SystemColor.textText
    );
    return this;
}
 
Example 3
Source Project: pumpernickel   Source File: AquaAudioListUI.java    License: MIT License 6 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList list,
		Object soundObject, int row, boolean isSelected,
		boolean hasFocus) {
	label.setText(getSoundName(soundObject));

	if (isSelected) {
		label.setOpaque(true);
		label.setBackground(SystemColor.textHighlight);
		label.setForeground(SystemColor.textHighlightText);
	} else {
		label.setOpaque(list.isOpaque());
		label.setBackground(SystemColor.text);
		label.setForeground(SystemColor.textText);
	}
	return label;
}
 
Example 4
Source Project: dsworkbench   Source File: ColoredProgressBar.java    License: Apache License 2.0 6 votes vote down vote up
public ColoredProgressBar(int start, int end) {
    setMinimum(start);
    setMaximum(end);
    setForeground(SystemColor.window);
    setBackground(SystemColor.window);
    setBorder(new EmptyBorder(3, 5, 3, 5));
    Dimension size = new Dimension(300, 20);
    setPreferredSize(size);
    setMaximumSize(size);
    setMinimumSize(size);
    BasicProgressBarUI ui = new BasicProgressBarUI() {

        @Override
        protected Color getSelectionForeground() {
            return Color.BLACK;
        }

        @Override
        protected Color getSelectionBackground() {
            return Color.BLACK;
        }
    };
    setUI(ui);
}
 
Example 5
Source Project: jclic   Source File: Editor.java    License: GNU General Public License v2.0 6 votes vote down vote up
public JTree createJTree() {
  setCurrentTree(new JTree(getTreeModel()));
  currentTree.setCellRenderer(new DefaultTreeCellRenderer() {
    @Override
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
      super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
      if (value instanceof Editor) {
        Icon icon = ((Editor) value).getIcon(leaf, expanded);
        if (icon != null)
          setIcon(icon);
        if (clip == value && clipCutted) {
          setForeground(SystemColor.textInactiveText);
        }
      }
      return this;
    }
  });
  return currentTree;
}
 
Example 6
LWTextComponentPeer(final T target,
                    final PlatformComponent platformComponent) {
    super(target, platformComponent);
    if (!getTarget().isBackgroundSet()) {
        getTarget().setBackground(SystemColor.text);
    }
}
 
Example 7
/**
 * Returns an array of Colors similar to getGUIcolors(), but using the
 * System colors.  This is useful if pieces of a Component (such as
 * the integrated scrollbars of a List) should retain the System color
 * instead of the background color set by Component.setBackground().
 */
static Color[] getSystemColors() {
    if (systemColors == null) {
        systemColors = new Color[4];
        systemColors[BACKGROUND_COLOR] = SystemColor.window;
        systemColors[HIGHLIGHT_COLOR] = SystemColor.controlLtHighlight;
        systemColors[SHADOW_COLOR] = SystemColor.controlShadow;
        systemColors[FOREGROUND_COLOR] = SystemColor.windowText;
    }
    return systemColors;
}
 
Example 8
LWTextComponentPeer(final T target,
                    final PlatformComponent platformComponent) {
    super(target, platformComponent);
    if (!getTarget().isBackgroundSet()) {
        getTarget().setBackground(SystemColor.text);
    }
}
 
Example 9
Source Project: TencentKona-8   Source File: XComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an array of Colors similar to getGUIcolors(), but using the
 * System colors.  This is useful if pieces of a Component (such as
 * the integrated scrollbars of a List) should retain the System color
 * instead of the background color set by Component.setBackground().
 */
static Color[] getSystemColors() {
    if (systemColors == null) {
        systemColors = new Color[4];
        systemColors[BACKGROUND_COLOR] = SystemColor.window;
        systemColors[HIGHLIGHT_COLOR] = SystemColor.controlLtHighlight;
        systemColors[SHADOW_COLOR] = SystemColor.controlShadow;
        systemColors[FOREGROUND_COLOR] = SystemColor.windowText;
    }
    return systemColors;
}
 
Example 10
Source Project: jdk8u60   Source File: LWTextComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
LWTextComponentPeer(final T target,
                    final PlatformComponent platformComponent) {
    super(target, platformComponent);
    if (!getTarget().isBackgroundSet()) {
        getTarget().setBackground(SystemColor.text);
    }
}
 
Example 11
Source Project: jdk8u60   Source File: XComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an array of Colors similar to getGUIcolors(), but using the
 * System colors.  This is useful if pieces of a Component (such as
 * the integrated scrollbars of a List) should retain the System color
 * instead of the background color set by Component.setBackground().
 */
static Color[] getSystemColors() {
    if (systemColors == null) {
        systemColors = new Color[4];
        systemColors[BACKGROUND_COLOR] = SystemColor.window;
        systemColors[HIGHLIGHT_COLOR] = SystemColor.controlLtHighlight;
        systemColors[SHADOW_COLOR] = SystemColor.controlShadow;
        systemColors[FOREGROUND_COLOR] = SystemColor.windowText;
    }
    return systemColors;
}
 
Example 12
LWTextComponentPeer(final T target,
                    final PlatformComponent platformComponent) {
    super(target, platformComponent);
    if (!getTarget().isBackgroundSet()) {
        getTarget().setBackground(SystemColor.text);
    }
}
 
Example 13
Source Project: openjdk-jdk8u   Source File: XComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an array of Colors similar to getGUIcolors(), but using the
 * System colors.  This is useful if pieces of a Component (such as
 * the integrated scrollbars of a List) should retain the System color
 * instead of the background color set by Component.setBackground().
 */
static Color[] getSystemColors() {
    if (systemColors == null) {
        systemColors = new Color[4];
        systemColors[BACKGROUND_COLOR] = SystemColor.window;
        systemColors[HIGHLIGHT_COLOR] = SystemColor.controlLtHighlight;
        systemColors[SHADOW_COLOR] = SystemColor.controlShadow;
        systemColors[FOREGROUND_COLOR] = SystemColor.windowText;
    }
    return systemColors;
}
 
Example 14
Source Project: netbeans   Source File: SplashUISupport.java    License: Apache License 2.0 5 votes vote down vote up
public void setItem(Object anObject) {
    value = anObject;
    if (value instanceof String) {
        setText(NbBundle.getMessage(SplashUISupport.class, "SplashUISupport_color_default"));
        super.setForeground(SystemColor.textText);
        super.setBackground(SystemColor.text);
    } else {
        setText("");
        super.setBackground((Color) value);
    }
}
 
Example 15
Source Project: netbeans   Source File: ToggleProfilingPointAction.java    License: Apache License 2.0 5 votes vote down vote up
public void setProfilingPointFactory(ProfilingPointFactory ppFactory, int index) {
    this.ppFactory = ppFactory;

    if (ppFactory != null) {
        label.setText(ppFactory.getType());
        label.setIcon(ppFactory.getIcon());
    } else {
        label.setText(NO_ACTION_NAME);
        label.setIcon(NO_ACTION_ICON);
    }

    Component selected = null;

    if ((index >= 0) && (index < previewPanel.getComponentCount())) {
        selected = previewPanel.getComponent(index);
    }

    for (Component c : previewPanel.getComponents()) {
        if (c == selected) {
            Border empt1 = BorderFactory.createEmptyBorder(2, 2, 2, 2);
            Border sel = BorderFactory.createMatteBorder(1, 1, 1, 1, SystemColor.textHighlight);
            Border empt2 = BorderFactory.createEmptyBorder(0, 2, 0, 2);
            Border comp1 = BorderFactory.createCompoundBorder(empt2, sel);
            Border comp2 = BorderFactory.createCompoundBorder(comp1, empt1);
            ((JComponent) c).setBorder(comp2);
        } else {
            ((JComponent) c).setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
        }
    }
}
 
Example 16
Source Project: netbeans   Source File: TooltipLabel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public JToolTip createToolTip() {
    JToolTip tooltp = new JToolTip();
    tooltp.setBackground(SystemColor.control);
    tooltp.setFont(getFont());
    tooltp.setOpaque(true);
    tooltp.setComponent(this);
    tooltp.setBorder(null);
    return tooltp;
}
 
Example 17
Source Project: netbeans   Source File: ColorComboBoxRenderer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Component getEditorComponent () {
    setEnabled (comboBox.isEnabled ());
    setBackground (comboBox.isFocusOwner () ? 
        SystemColor.textHighlight : SystemColor.text
    );
    setForeground (comboBox.isFocusOwner () ? 
        SystemColor.textHighlightText : SystemColor.textText
    );
    return this;
}
 
Example 18
LWTextComponentPeer(final T target,
                    final PlatformComponent platformComponent) {
    super(target, platformComponent);
    if (!getTarget().isBackgroundSet()) {
        getTarget().setBackground(SystemColor.text);
    }
}
 
Example 19
/**
 * Returns an array of Colors similar to getGUIcolors(), but using the
 * System colors.  This is useful if pieces of a Component (such as
 * the integrated scrollbars of a List) should retain the System color
 * instead of the background color set by Component.setBackground().
 */
static Color[] getSystemColors() {
    if (systemColors == null) {
        systemColors = new Color[4];
        systemColors[BACKGROUND_COLOR] = SystemColor.window;
        systemColors[HIGHLIGHT_COLOR] = SystemColor.controlLtHighlight;
        systemColors[SHADOW_COLOR] = SystemColor.controlShadow;
        systemColors[FOREGROUND_COLOR] = SystemColor.windowText;
    }
    return systemColors;
}
 
Example 20
Source Project: openjdk-jdk9   Source File: XComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an array of Colors similar to getGUIcolors(), but using the
 * System colors.  This is useful if pieces of a Component (such as
 * the integrated scrollbars of a List) should retain the System color
 * instead of the background color set by Component.setBackground().
 */
static Color[] getSystemColors() {
    if (systemColors == null) {
        systemColors = new Color[4];
        systemColors[BACKGROUND_COLOR] = SystemColor.window;
        systemColors[HIGHLIGHT_COLOR] = SystemColor.controlLtHighlight;
        systemColors[SHADOW_COLOR] = SystemColor.controlShadow;
        systemColors[FOREGROUND_COLOR] = SystemColor.windowText;
    }
    return systemColors;
}
 
Example 21
LWTextComponentPeer(final T target,
                    final PlatformComponent platformComponent) {
    super(target, platformComponent);
    if (!getTarget().isBackgroundSet()) {
        getTarget().setBackground(SystemColor.text);
    }
}
 
Example 22
Source Project: evosql   Source File: ConnectionDialog.java    License: Apache License 2.0 5 votes vote down vote up
protected static Panel createBorderPanel(Component center) {

        Panel p = new Panel();

        p.setBackground(SystemColor.control);
        p.setLayout(new BorderLayout());
        p.add("Center", center);
        p.add("North", createLabel(""));
        p.add("South", createLabel(""));
        p.add("East", createLabel(""));
        p.add("West", createLabel(""));
        p.setBackground(SystemColor.control);

        return p;
    }
 
Example 23
Source Project: evosql   Source File: Transfer.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Method declaration
 *
 *
 * @param center
 */
private Panel createBorderPanel(Component center) {

    Panel p = new Panel();

    p.setBackground(SystemColor.control);
    p.setLayout(new BorderLayout());
    p.add("Center", center);
    p.add("South", createLabel(""));
    p.add("East", createLabel(""));
    p.add("West", createLabel(""));
    p.setBackground(SystemColor.control);

    return p;
}
 
Example 24
LWTextComponentPeer(final T target,
                    final PlatformComponent platformComponent) {
    super(target, platformComponent);
    if (!getTarget().isBackgroundSet()) {
        getTarget().setBackground(SystemColor.text);
    }
}
 
Example 25
Source Project: jdk8u-jdk   Source File: XComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an array of Colors similar to getGUIcolors(), but using the
 * System colors.  This is useful if pieces of a Component (such as
 * the integrated scrollbars of a List) should retain the System color
 * instead of the background color set by Component.setBackground().
 */
static Color[] getSystemColors() {
    if (systemColors == null) {
        systemColors = new Color[4];
        systemColors[BACKGROUND_COLOR] = SystemColor.window;
        systemColors[HIGHLIGHT_COLOR] = SystemColor.controlLtHighlight;
        systemColors[SHADOW_COLOR] = SystemColor.controlShadow;
        systemColors[FOREGROUND_COLOR] = SystemColor.windowText;
    }
    return systemColors;
}
 
Example 26
Source Project: hottub   Source File: LWTextComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
LWTextComponentPeer(final T target,
                    final PlatformComponent platformComponent) {
    super(target, platformComponent);
    if (!getTarget().isBackgroundSet()) {
        getTarget().setBackground(SystemColor.text);
    }
}
 
Example 27
Source Project: hottub   Source File: XComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an array of Colors similar to getGUIcolors(), but using the
 * System colors.  This is useful if pieces of a Component (such as
 * the integrated scrollbars of a List) should retain the System color
 * instead of the background color set by Component.setBackground().
 */
static Color[] getSystemColors() {
    if (systemColors == null) {
        systemColors = new Color[4];
        systemColors[BACKGROUND_COLOR] = SystemColor.window;
        systemColors[HIGHLIGHT_COLOR] = SystemColor.controlLtHighlight;
        systemColors[SHADOW_COLOR] = SystemColor.controlShadow;
        systemColors[FOREGROUND_COLOR] = SystemColor.windowText;
    }
    return systemColors;
}
 
Example 28
LWTextComponentPeer(final T target,
                    final PlatformComponent platformComponent) {
    super(target, platformComponent);
    if (!getTarget().isBackgroundSet()) {
        getTarget().setBackground(SystemColor.text);
    }
}
 
Example 29
/**
 * Returns an array of Colors similar to getGUIcolors(), but using the
 * System colors.  This is useful if pieces of a Component (such as
 * the integrated scrollbars of a List) should retain the System color
 * instead of the background color set by Component.setBackground().
 */
static Color[] getSystemColors() {
    if (systemColors == null) {
        systemColors = new Color[4];
        systemColors[BACKGROUND_COLOR] = SystemColor.window;
        systemColors[HIGHLIGHT_COLOR] = SystemColor.controlLtHighlight;
        systemColors[SHADOW_COLOR] = SystemColor.controlShadow;
        systemColors[FOREGROUND_COLOR] = SystemColor.windowText;
    }
    return systemColors;
}
 
Example 30
Source Project: clipper-java   Source File: StatusBar.java    License: Boost Software License 1.0 5 votes vote down vote up
public StatusBar() {
    setLayout( new BorderLayout() );
    setPreferredSize( new Dimension( 10, 23 ) );

    final JPanel rightPanel = new JPanel( new BorderLayout() );
    rightPanel.add( new JLabel( new AngledLinesWindowsCornerIcon() ), BorderLayout.SOUTH );
    rightPanel.setOpaque( false );

    text = new JLabel();
    add( text, BorderLayout.WEST );
    add( rightPanel, BorderLayout.EAST );
    setBackground( SystemColor.control );
}