Java Code Examples for javax.swing.UIDefaults#getColor()

The following examples show how to use javax.swing.UIDefaults#getColor() . 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 File: XTextAreaPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 2
Source File: XTextAreaPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 3
Source File: XTextAreaPeer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 4
Source File: XTextAreaPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 5
Source File: XTextAreaPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 6
Source File: XTextAreaPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 7
Source File: XTextAreaPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 8
Source File: XTextAreaPeer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 9
Source File: XTextAreaPeer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 10
Source File: XTextAreaPeer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 11
Source File: XTextAreaPeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 12
Source File: XTextAreaPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 13
Source File: XTextAreaPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
Example 14
Source File: UIUtilities.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Set up the user interface.
 */
public static void setupUI() {
    try {
        final String classname = UIManager.getSystemLookAndFeelClassName();
        UIManager.setLookAndFeel(classname);
    }
    catch (Exception e) { 
        e.printStackTrace();
    }

    final UIDefaults defaults = UIManager.getDefaults();

    defaults.put(
        "PopupMenu.border", 
        new BorderUIResource.EtchedBorderUIResource(
            EtchedBorder.RAISED, defaults.getColor("controlShadow"), 
            defaults.getColor("controlLtHighlight")
        )
    );

    final MatteBorder matteborder = new MatteBorder(1, 1, 1, 1, Color.black);
    final EmptyBorder emptyborder = new MatteBorder(2, 2, 2, 2, defaults.getColor("control"));
    final BorderUIResource.CompoundBorderUIResource compBorder
        = new BorderUIResource.CompoundBorderUIResource(emptyborder, matteborder);
    final BorderUIResource.EmptyBorderUIResource emptyBorderUI
        = new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0);
    defaults.put("SplitPane.border", emptyBorderUI);
    defaults.put("Table.scrollPaneBorder", emptyBorderUI);
    defaults.put("ComboBox.border", compBorder);
    defaults.put("TextField.border", compBorder);
    defaults.put("TextArea.border", compBorder);
    defaults.put("CheckBox.border", compBorder);
    defaults.put("ScrollPane.border", emptyBorderUI);

}
 
Example 15
Source File: BEToolBarSeparatorUI.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
public void paint( Graphics g, JComponent c ) 
	{
		boolean vertical = ((JSeparator)c).getOrientation() == SwingConstants.VERTICAL;
		Dimension size = c.getSize();
		
		//虚线样式
		Stroke oldStroke = ((Graphics2D)g).getStroke();
		Stroke sroke = new BasicStroke(1, BasicStroke.CAP_BUTT,
				BasicStroke.JOIN_BEVEL, 0, new float[]{2, 2}, 0);//实线,空白
		((Graphics2D)g).setStroke(sroke);//

		Color temp = g.getColor();
		UIDefaults table = UIManager.getLookAndFeelDefaults();
		Color shadow = table.getColor("ToolBar.shadow");
		Color highlight = table.getColor("ToolBar.highlight");

		// TODO BUG_001:不知何故,垂直分隔条并不能像水平分隔条一样,拥有默认设置的new Dimension(6, 6)
		// 而只有new Dimension(1, ...),而当它floating时却能正常表现(只能绘出hilight而不能绘出shadow)
		//,有待深入研究,垂直的分隔条则不会有此种情况
		if (vertical) 
		{
			int x = (size.width / 2) - 1;
			
			//* 当BUG_001存在时,暂时使用以下代码解决:把本该显示hilight的
			//* 线条用shadow颜色绘制,最大可能保证ui的正常展现
//			g.setColor(shadow);
//			g.drawLine(x, 2, x, size.height - 2);
			g.setColor(shadow);//highlight);
			g.drawLine(x + 1, 2, x + 1, size.height - 2);
			
			//* 当BUG_001不存在时,应该使用以下代码
//			g.setColor(shadow);
//			g.drawLine(x, 2, x, size.height - 2);
//			g.setColor(highlight);
//			g.drawLine(x + 1, 2, x + 1, size.height - 2);
		} 
		else 
		{
			int y = (size.height / 2) - 1;
			g.setColor(shadow);
			g.drawLine(2, y, size.width - 2, y);

			g.setColor(highlight);
			g.drawLine(2, y + 1, size.width - 2, y + 1);
		}
		g.setColor(temp);

		//
		((Graphics2D)g).setStroke(oldStroke);
	}