當前位置: 首頁>>代碼示例>>Java>>正文


Java ColorUIResource類代碼示例

本文整理匯總了Java中javax.swing.plaf.ColorUIResource的典型用法代碼示例。如果您正苦於以下問題:Java ColorUIResource類的具體用法?Java ColorUIResource怎麽用?Java ColorUIResource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ColorUIResource類屬於javax.swing.plaf包,在下文中一共展示了ColorUIResource類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: adjustColor

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
/**
 * Creates and returns a new color derived from the passed in color.
 * The transformation is done in the HLS color space using the specified
 * arguments to scale.
 *
 * @param color Color to alter
 * @param hFactory Amount to scale the hue
 * @param lFactor Amount to scale the lightness
 * @param sFactory Amount to sacle saturation
 * @return newly created color
 */
static Color adjustColor(Color color, float hFactor, float lFactor,
                         float sFactor) {
    float h;
    float l;
    float s;

    synchronized(HLS_COLOR_LOCK) {
        float[] hls = rgbToHLS(color.getRGB(), HLS_COLORS);
        h = hls[0];
        l = hls[1];
        s = hls[2];
    }
    h = Math.min(360, hFactor * h);
    l = Math.min(1, lFactor * l);
    s = Math.min(1, sFactor * s);
    return new ColorUIResource(hlsToRGB(h, l, s));
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:29,代碼來源:GTKColorType.java

示例2: adjustColor

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
/**
 * Creates and returns a new color derived from the passed in color.
 * The transformation is done in the HLS color space using the specified
 * arguments to scale.
 *
 * @param color Color to alter
 * @param hFactor Amount to scale the hue
 * @param lFactor Amount to scale the lightness
 * @param sFactor Amount to sacle saturation
 * @return newly created color
 */
static Color adjustColor(Color color, float hFactor, float lFactor,
                         float sFactor) {
    float h;
    float l;
    float s;

    synchronized(HLS_COLOR_LOCK) {
        float[] hls = rgbToHLS(color.getRGB(), HLS_COLORS);
        h = hls[0];
        l = hls[1];
        s = hls[2];
    }
    h = Math.min(360, hFactor * h);
    l = Math.min(1, lFactor * l);
    s = Math.min(1, sFactor * s);
    return new ColorUIResource(hlsToRGB(h, l, s));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:29,代碼來源:GTKColorType.java

示例3: testNames

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
void testNames() {
    Color defaultColor = label.getBackground();

    UIManager.put("\"BlueLabel\"[Enabled].background",
            new ColorUIResource(Color.BLUE));
    UIManager.put("\"RedLabel\"[Enabled].background",
            new ColorUIResource(Color.RED));
    nimbus.register(Region.LABEL, "\"BlueLabel\"");
    nimbus.register(Region.LABEL, "\"RedLabel\"");

    label.setName("BlueLabel");
    check(Color.BLUE);
    label.setName("RedLabel");
    check(Color.RED);

    // remove name, color goes back to default
    label.setName(null);
    check(defaultColor);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:20,代碼來源:ColorCustomizationTest.java

示例4: parseColor

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
/**
 * parse a comma delimited list of 3 strings into a Color
 */
private ColorUIResource parseColor(String s) {
    int red = 0;
    int green = 0;
    int blue = 0;
    try {
        StringTokenizer st = new StringTokenizer(s, ",");

        red = Integer.parseInt(st.nextToken());
        green = Integer.parseInt(st.nextToken());
        blue = Integer.parseInt(st.nextToken());

    } catch (Exception e) {
        System.out.println(e);
        System.out.println("Couldn't parse color :" + s);
    }

    return new ColorUIResource(red, green, blue);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:22,代碼來源:PropertiesMetalTheme.java

示例5: main

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
public static void main(final String[] args)
        throws InvocationTargetException, InterruptedException {
    SwingUtilities.invokeAndWait(() -> {
        UIDefaults ui = UIManager.getDefaults();
        ui.put("control", new ColorUIResource(54, 54, 54));
        final JDialog dialog = new JDialog();
        final JFrame frame = new JFrame();
        frame.pack();
        dialog.pack();
        final Color dialogBackground = dialog.getBackground();
        final Color frameBackground = frame.getBackground();
        frame.dispose();
        dialog.dispose();
        if (!dialogBackground.equals(frameBackground)) {
            System.err.println("Expected:" + frameBackground);
            System.err.println("Actual:" + dialogBackground);
            throw new RuntimeException("Wrong background color");
        }
    });
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:WrongBackgroundColor.java

示例6: convert

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
/**
 * Takes a UIManager color key and ensures that it is stored as a 
 * ColorUIResource, not a Color. 
 */
private static void convert (String key) {
    Color c = UIManager.getColor(key);
    if (c != null && !(c instanceof ColorUIResource)) {
        UIManager.put (key, new ColorUIResource(c));
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:VistaLFCustoms.java

示例7: updateVirtualItemForTheme

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
public static void updateVirtualItemForTheme(Colors currentTheme) {
	if (currentTheme == null) {
		selectedThumbBorder = BorderFactory.createLineBorder(new ColorUIResource(122, 170, 233), 2);
	} else {
		selectedThumbBorder = BorderFactory.createLineBorder(currentTheme.getFileChooserColors()[1], 2);
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:8,代碼來源:Item.java

示例8: paintBorder

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
	g.translate(x, y);
	g.setColor(new ColorUIResource(90, 90, 90));
	g.drawLine(0, 0, w - 1, 0);
	g.drawLine(0, 0, 0, h - 1);
	g.setColor(new ColorUIResource(255, 255, 255));
	g.drawLine(w - 1, 1, w - 1, h - 1);
	g.drawLine(1, h - 1, w - 1, h - 1);
	g.translate(-x, -y);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:12,代碼來源:SplitPaneBorder.java

示例9: paintBorder

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
	g.translate(x, y);
	g.setColor(new ColorUIResource(190, 190, 190));
	g.drawLine(0, 0, w - 1, 0);
	g.drawLine(0, 0, 0, h - 1);
	g.setColor(new ColorUIResource(220, 220, 220));
	g.drawLine(w - 1, 1, w - 1, h - 1);
	g.drawLine(1, h - 1, w - 1, h - 1);
	g.translate(-x, -y);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:12,代碼來源:ScrollPaneBorder.java

示例10: paintBorder

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
	g.translate(x, y);
	g.setColor(new ColorUIResource(220, 220, 220));
	g.drawLine(0, 0, w, 0);
	g.drawLine(0, h - 1, w, h - 1);
	g.setColor(new ColorUIResource(200, 200, 200));
	g.drawLine(0, 1, w, 1);
	g.drawLine(0, h - 2, w, h - 2);
	g.translate(-x, -y);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:12,代碼來源:MenuBarBorder.java

示例11: paintToImage

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
@Override
protected void paintToImage(Component c, Graphics g, int w, int h, Object[] args) {
	g.setColor(new ColorUIResource(252, 252, 252));
	g.fillRect(0, 0, w, 3);

	Graphics2D g2 = (Graphics2D) g;
	g2.setPaint(new GradientPaint(0, 3, new ColorUIResource(252, 252, 252), 0, h - 3, new ColorUIResource(232, 232, 232)));
	g2.fillRect(0, 3, w, h - 3);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:10,代碼來源:MenuBarBackgroundPainter.java

示例12: configureUI

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
private static void configureUI() {
    UIManager.put("ScrollBarUI", "com.transparentdiscord.UI.Custom.CustomScrollBarUI");

    System.setProperty("awt.useSystemAAFontSettings", "on");
    System.setProperty("swing.aatext", "true");

    UIManager.put("ScrollBar.width", 4);
    UIManager.put("ScrollBar.track", new ColorUIResource(new Color(0,0,0,0)));
    UIManager.put("ScrollBar.thumb", new ColorUIResource(Color.decode("#99AAB5")));
    UIManager.put("ScrollBar.thumbDarkShadow", new ColorUIResource(Color.decode("#99AAB5")));
    UIManager.put("ScrollBar.thumbShadow", new ColorUIResource(Color.decode("#99AAB5")));
    UIManager.put("ScrollBar.thumbHighlight", new ColorUIResource(Color.decode("#99AAB5")));
}
 
開發者ID:MCPlummet,項目名稱:TransparentDiscord,代碼行數:14,代碼來源:TransparentDiscord.java

示例13: addCustomEntriesToTable

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
public void addCustomEntriesToTable(UIDefaults table) {
	super.addCustomEntriesToTable(table);
	// table.put("Button.gradient", Arrays.asList(new Object[] {
	// new Float(.3f), new Float(0f), new ColorUIResource(light_gray),// new
	// // ColorUIResource(0xDDE8F3),
	// new ColorUIResource(new Color(245,245,245)), getSecondary2() }));

	// Color cccccc = new ColorUIResource(0xCCCCCC);
	Color dadada = new ColorUIResource(0xDADADA);
	// Color c8ddf2 = new ColorUIResource(0xC8DDF2);

	List<Object> buttonGradient = Arrays.asList(new Object[] {
			new Float(1f), new Float(0f), getWhite(), dadada,
			new ColorUIResource(dadada) });
	// Arrays.asList(new Object[] {
	// new Float(.3f),
	// new Float(0f),
	// new ColorUIResource(new Color(230, 230, 230)),// new
	// // ColorUIResource(0xDDE8F3),
	// new ColorUIResource(new Color(235, 235, 235)),
	// new ColorUIResource(new Color(180, 180, 180)) });
	table.put("Button.gradient", buttonGradient);

	table.put("ScrollBar.gradient", buttonGradient);

	table.put("RadioButton.gradient", buttonGradient);
	table.put("RadioButtonMenuItem.gradient", buttonGradient);
	// table.put("ScrollBar.gradient", buttonGradient);

	//		
	// table.put("Button.gradient", Arrays.asList(new Object[] {
	// new Float(.3f), new Float(0f), new ColorUIResource(Color.black),//
	// new
	// // ColorUIResource(0xDDE8F3),
	// getWhite(), getSecondary2() }));
	// // System.out.println(table.get("Button.gradient"));
}
 
開發者ID:kmarius,項目名稱:xdman,代碼行數:38,代碼來源:XDMTheme.java

示例14: testInheritance

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
void testInheritance() {
    Color defaultColor = label.getBackground();

    // more specific setting is in global defaults
    UIManager.put("Label[Enabled].background", new ColorUIResource(Color.RED));

    // less specific one is in overrides
    UIDefaults defs = new UIDefaults();
    defs.put("Label.background", new ColorUIResource(Color.GREEN));

    // global wins
    label.putClientProperty("Nimbus.Overrides", defs);
    check(Color.RED);

    // now override wins
    label.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
    check(Color.GREEN);

    // global is back
    label.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
    check(Color.RED);

    // back to default color
    UIManager.put("Label[Enabled].background", null);
    label.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
    label.putClientProperty("Nimbus.Overrides", null);
    check(defaultColor);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:29,代碼來源:ColorCustomizationTest.java

示例15: getPrimary3

import javax.swing.plaf.ColorUIResource; //導入依賴的package包/類
@Override
protected ColorUIResource getPrimary3() {
    return primary3;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:PropertiesMetalTheme.java


注:本文中的javax.swing.plaf.ColorUIResource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。