当前位置: 首页>>代码示例>>Java>>正文


Java Color.blue方法代码示例

本文整理汇总了Java中java.awt.Color.blue方法的典型用法代码示例。如果您正苦于以下问题:Java Color.blue方法的具体用法?Java Color.blue怎么用?Java Color.blue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Color的用法示例。


在下文中一共展示了Color.blue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTestImage

import java.awt.Color; //导入方法依赖的package包/类
private static BufferedImage createTestImage() {
    int w = 1024;
    int h = 768;

    BufferedImage img = new
        BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = img.createGraphics();
    Color[] colors = { Color.red, Color.green, Color.blue };
    float[] dist = {0.0f, 0.5f, 1.0f };
    Point2D center = new Point2D.Float(0.5f * w, 0.5f * h);

    RadialGradientPaint p =
        new RadialGradientPaint(center, 0.5f * w, dist, colors);
    g.setPaint(p);
    g.fillRect(0, 0, w, h);
    g.dispose();

    return img;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:WritingInterruptionTest.java

示例2: DialValueIndicator

import java.awt.Color; //导入方法依赖的package包/类
/** 
 * Creates a new instance of <code>DialValueIndicator</code>.
 * 
 * @param datasetIndex  the dataset index.
 * @param label  the label.
 */
public DialValueIndicator(int datasetIndex, String label) {
    this.datasetIndex = datasetIndex;
    this.angle = -90.0;
    this.radius = 0.3;
    this.frameAnchor = RectangleAnchor.CENTER;
    this.templateValue = new Double(100.0);
    this.formatter = new DecimalFormat("0.0");
    this.font = new Font("Dialog", Font.BOLD, 14);
    this.paint = Color.black;
    this.backgroundPaint = Color.white;
    this.outlineStroke = new BasicStroke(1.0f);
    this.outlinePaint = Color.blue;
    this.insets = new RectangleInsets(4, 4, 4, 4);
    this.valueAnchor = RectangleAnchor.RIGHT;
    this.textAnchor = TextAnchor.CENTER_RIGHT;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:DialValueIndicator.java

示例3: setFlat

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Set how to paint renderer.
 * @param f <code>true</code> means flat, <code>false</code> means with button border
 */
public void setFlat(boolean f) {
    Color controlDkShadow = Color.lightGray;

    if (UIManager.getColor("controlDkShadow") != null) {
        controlDkShadow = UIManager.getColor("controlDkShadow"); // NOI18N
    }

    Color controlLtHighlight = Color.black;

    if (UIManager.getColor("controlLtHighlight") != null) {
        controlLtHighlight = UIManager.getColor("controlLtHighlight"); // NOI18N
    }

    Color buttonFocusColor = Color.blue;

    if (UIManager.getColor("Button.focus") != null) {
        buttonFocusColor = UIManager.getColor("Button.focus"); // NOI18N
    }

    flat = f ? Boolean.TRUE : Boolean.FALSE;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:TableSheetCell.java

示例4: testEquals

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    
    LegendItemCollection c1 = new LegendItemCollection();
    LegendItemCollection c2 = new LegendItemCollection();
    assertTrue(c1.equals(c2));
    assertTrue(c2.equals(c1));

    LegendItem item1 = new LegendItem("Label", "Description", 
            "ToolTip", "URL", true,  
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), true, Color.red, 
            true, Color.blue, new BasicStroke(1.2f), true, 
            new Line2D.Double(1.0, 2.0, 3.0, 4.0), 
            new BasicStroke(2.1f), Color.green);
    LegendItem item2 = new LegendItem("Label", "Description", 
            "ToolTip", "URL", true, 
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), 
            true, Color.red, true, Color.blue, new BasicStroke(1.2f), true, 
            new Line2D.Double(1.0, 2.0, 3.0, 4.0), new BasicStroke(2.1f), 
            Color.green);
    c1.add(item1);
    c2.add(item2);
    assertTrue(c1.equals(c2));
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:LegendItemCollectionTests.java

示例5: paintComponent

import java.awt.Color; //导入方法依赖的package包/类
@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    
    if (lstInfo != null && !lstInfo.isEmpty()) {
        int y,w = getWidth();
        double lineSize = (double)(getHeight()-48) / (double)totalNbLines;
        Color c;
        for (Entry<Integer, List<CompileInfo>> e : lstInfo.entrySet()) {
            int worst = e.getValue().get(0).kind; /*10;
            for (CompileInfo info : e.getValue()) {
                if (info.kind < worst) worst = info.kind;
            }*/
            c = (worst == 0) ? Color.red : (worst == 1) ? Color.orange : Color.blue; 
            g.setColor(c.brighter().brighter());
            y = 16+(int)(lineSize*e.getKey());
            g.fillRect(0,y-1,w,3);
            g.setColor(this.getBackground());
            g.drawRect(0,y-1,w,3);
        }
    }                
}
 
开发者ID:iapafoto,项目名称:DicomViewer,代码行数:23,代码来源:RightEditorPane.java

示例6: doPaint

import java.awt.Color; //导入方法依赖的package包/类
public void doPaint(Graphics2D g2d) {

        g2d.translate(DIM*0.2, DIM*0.2);
        Shape s = new Rectangle2D.Float(0, 0, DIM*2, DIM*2);

        // RadialGradientPaint
        Point2D centre = new Point2D.Float(DIM/2.0f, DIM/2.0f);
        float radius = DIM/2.0f;
        Point2D focus = new Point2D.Float(DIM/3.0f, DIM/3.0f);
        float stops[] = {0.0f, 1.0f};
        Color colors[] =  { Color.red, Color.white} ;

        RadialGradientPaint rgp =
           new RadialGradientPaint(centre, radius, focus, stops, colors,
              RadialGradientPaint.CycleMethod.NO_CYCLE);
        g2d.setPaint(rgp);
        g2d.fill(s);

        g2d.translate(DIM*2.2, 0);
        Color colors1[] =  { Color.red, Color.blue, Color.green} ;
        float stops1[] = {0.0f, 0.5f, 1.0f};
        RadialGradientPaint rgp1 =
           new RadialGradientPaint(centre, radius, focus, stops1, colors1,
              RadialGradientPaint.CycleMethod.REFLECT);
        g2d.setPaint(rgp1);
        g2d.fill(s);

        g2d.translate(-DIM*2.2, DIM*2.2);
        Color colors2[] =  { Color.red, Color.blue, Color.green, Color.white} ;
        float stops2[] = {0.0f, 0.3f, 0.6f, 1.0f};
        RadialGradientPaint rgp2 =
           new RadialGradientPaint(centre, radius, focus, stops2, colors2,
              RadialGradientPaint.CycleMethod.REPEAT);
        g2d.setPaint(rgp2);
        g2d.fill(s);

    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:38,代码来源:RadialGradientPrintingTest.java

示例7: setTextColor

import java.awt.Color; //导入方法依赖的package包/类
/**
    * Sets the text Color for the activator text.
    * The following is a list of supported Color names
    * <ul>
    * <li>black
    * <li>blue
    * <li>cyan
    * <li>darkGray
    * <li>gray
    * <li>green
    * <li>lightGray
    * <li>magenta
    * <li>orange
    * <li>pink
    * <li>red
    * <li>white
    * <li>yellow
    * </ul>
    */
   public void setTextColor(String name) {
Color color=null;
if ("black".equals(name)) {
    color = Color.black;
} else if ("blue".equals(name)) {
    color = Color.blue;
} else if ("cyan".equals(name)) {
    color = Color.cyan;
} else if ("darkGray".equals(name)) {
    color = Color.darkGray;
} else if ("gray".equals(name)) {
    color = Color.gray;
} else if ("green".equals(name)) {
    color = Color.green;
} else if ("lightGray".equals(name)) {
    color = Color.lightGray;
} else if ("magenta".equals(name)) {
    color = Color.magenta;
} else if ("orange".equals(name)) {
    color = Color.orange;
} else if ("pink".equals(name)) {
    color = Color.pink;
} else if ("red".equals(name)) {
    color = Color.red;
} else if ("white".equals(name)) {
    color = Color.white;
} else if ("yellow".equals(name)) {
    color = Color.yellow;
}

if (color == null) {
    return;
}
textAttribs.removeAttribute(StyleConstants.Foreground);
textAttribs.addAttribute(StyleConstants.Foreground, color);
setForeground(color);
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:57,代码来源:BrowserDisplayer.java

示例8: getCellRenderer

import java.awt.Color; //导入方法依赖的package包/类
/**
 * This method sets read write rows to be blue, and other rows to be their
 * default rendered colour.
 */
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
    DefaultTableCellRenderer tcr =
        (DefaultTableCellRenderer) super.getCellRenderer(row,column);
    tcr.setToolTipText(getToolTip(row,column));
    if (defaultColor == null) {
        defaultColor = tcr.getForeground();
        editableColor = Color.blue;
        errorColor = Color.red;
        // this sometimes happens for some reason
        if (defaultColor == null) {
            return tcr;
        }
    }
    if (column != VALUE_COLUMN) {
        tcr.setForeground(defaultColor);
        return tcr;
    }
    if (isCellError(row,column)) {
        tcr.setForeground(errorColor);
    } else if (isCellEditable(row, column)) {
        tcr.setForeground(editableColor);
    } else {
        tcr.setForeground(defaultColor);
    }
    return tcr;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:32,代码来源:XTable.java

示例9: createPaint

import java.awt.Color; //导入方法依赖的package包/类
private Paint createPaint(PaintType type, int startx, int starty,
                          int w, int h)
{
    // make sure that the blue color doesn't show up when filling a
    // w by h rect
    w++; h++;

    int endx = startx + w;
    int endy = starty + h;
    Rectangle2D.Float r = new Rectangle2D.Float(startx, starty, w, h);
    switch (type) {
        case COLOR: return Color.red;
        case GRADIENT: return
            new GradientPaint(startx, starty, Color.red,
                              endx, endy, Color.green);
        case LINEAR_GRADIENT: return
            new LinearGradientPaint(startx, starty, endx, endy,
                new float[] { 0.0f, 0.999f, 1.0f },
                new Color[] { Color.red, Color.green, Color.blue });
        case RADIAL_GRADIENT: return
            new RadialGradientPaint(startx, starty,
                (float)Math.sqrt(w * w + h * h),
                new float[] { 0.0f, 0.999f, 1.0f },
                new Color[] { Color.red, Color.green, Color.blue },
                CycleMethod.NO_CYCLE);
        case TEXTURE: {
            BufferedImage bi =
                new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
            Graphics2D g = (Graphics2D) bi.getGraphics();
            g.setPaint(createPaint(PaintType.LINEAR_GRADIENT, 0, 0, w, h));
            g.fillRect(0, 0, w, h);
            return new TexturePaint(bi, r);
        }
    }
    return Color.green;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:TransformedPaintTest.java

示例10: getHyperlinkForeground

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Returns the color to use for hyperlink-style components.  This method
 * will return <code>Color.blue</code> unless it appears that the current
 * LookAndFeel uses light text on a dark background, in which case a
 * brighter alternative is returned.
 *
 * @return The color to use for hyperlinks.
 */
static final Color getHyperlinkForeground() {

	// This property is defined by all standard LaFs, even Nimbus (!),
	// but you never know what crazy LaFs there are...
	Color fg = UIManager.getColor("Label.foreground");
	if (fg==null) {
		fg = new JLabel().getForeground();
	}

	return isLightForeground(fg) ? LIGHT_HYPERLINK_FG : Color.blue;

}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:21,代码来源:Util.java

示例11: HistGCanvas

import java.awt.Color; //导入方法依赖的package包/类
public HistGCanvas(Histogram histg) {
    this.histg = histg;

    barColors[0] = Color.blue;
    barColors[1] = Color.red;
    barColors[2] = Color.green;
    barColors[3] = Color.yellow;
    barColors[4] = Color.gray;
    barColors[5] = Color.cyan;
    barColors[6] = Color.orange;
    barColors[7] = Color.lightGray;
    barColors[8] = Color.pink;
    barColors[9] = Color.darkGray;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:15,代码来源:HistGCanvas.java

示例12: testHashcode

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    XYDifferenceRenderer r1 
        = new XYDifferenceRenderer(Color.red, Color.blue, false);
    XYDifferenceRenderer r2 
        = new XYDifferenceRenderer(Color.red, Color.blue, false);
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:XYDifferenceRendererTests.java

示例13: loadChildren

import java.awt.Color; //导入方法依赖的package包/类
/**
 * Messaged the first time getChildCount is messaged.  Creates
 * children with random names from names.
 */
protected void loadChildren() {
    DynamicTreeNode newNode;
    Font font;
    int randomIndex;
    SampleData data;

    for (int counter = 0; counter < DynamicTreeNode.DEFAULT_CHILDREN_COUNT;
            counter++) {
        randomIndex = (int) (nameGen.nextFloat() * nameCount);
        String displayString = NAMES[randomIndex];
        if (fonts == null || fonts[randomIndex].canDisplayUpTo(displayString)
                != -1) {
            font = null;
        } else {
            font = fonts[randomIndex];
        }

        if (counter % 2 == 0) {
            data = new SampleData(font, Color.red, displayString);
        } else {
            data = new SampleData(font, Color.blue, displayString);
        }
        newNode = new DynamicTreeNode(data);
        /* Don't use add() here, add calls insert(newNode, getChildCount())
        so if you want to use add, just be sure to set hasLoaded = true
        first. */
        insert(newNode, counter);
    }
    /* This node has now been loaded, mark it so. */
    hasLoaded = true;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:36,代码来源:DynamicTreeNode.java

示例14: randomColor

import java.awt.Color; //导入方法依赖的package包/类
private Color randomColor() {
	Color colors[] = {Color.black, Color.blue, Color.cyan,
		Color.gray, Color.darkGray, Color.green,
		Color.lightGray, Color.magenta, Color.orange,
		Color.pink,Color.red, Color.white, Color.yellow};
	return colors[(int)(Math.random() * colors.length)];
}
 
开发者ID:marvinmalkowskijr,项目名称:applecommander,代码行数:8,代码来源:DiskExplorer.java

示例15: getColor

import java.awt.Color; //导入方法依赖的package包/类
public Color getColor(String color) {
    Matcher match = Pattern.compile("(\\d+), (\\d+), (\\d+)").matcher(color);
    Matcher matchTwo = Pattern.compile("(\\d+)\\s(\\d+)\\s(\\d+)").matcher(color);

    try {
        if (match.find() == true) {
            return new Color(Integer.parseInt(match.group(1)), Integer.parseInt(match.group(2)), Integer.parseInt(match.group(3)));
        } else if (matchTwo.find() == true) {
            return new Color(Integer.parseInt(matchTwo.group(1)), Integer.parseInt(matchTwo.group(2)), Integer.parseInt(matchTwo.group(3)));
        } else {
            switch (color) {
                case "black": return Color.black;
                case "blue": return Color.blue;
                case "cyan": return Color.cyan;
                case "gray": return Color.gray;
                case "green": return Color.green;
                case "magenta": return Color.magenta;
                case "orange": return Color.orange;
                case "pink": return Color.pink;
                case "red": return Color.red;
                case "white": return Color.white;
                case "yellow": return Color.yellow;
                case "dark_green": return Color.green.darker().darker().darker();
                case "light_red": return Color.red.brighter();
                default: return Color.gray;
            }
        }
    } catch (Exception ex) {
        com.gmt2001.Console.err.println("Bad RegEx Sent for getColor: " + ex.getMessage());
        return Color.gray;
    }
}
 
开发者ID:GloriousEggroll,项目名称:quorrabot,代码行数:33,代码来源:DiscordAPI.java


注:本文中的java.awt.Color.blue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。