List of usage examples for java.awt Color RED
Color RED
To view the source code for java.awt Color RED.
Click Source Link
From source file:Main.java
public void paint(Graphics g) { Image img = createImage(); g.drawImage(img, 20, 20, Color.RED, this); }
From source file:Main.java
public void paint(Graphics g) { Image img = createImage(); g.drawImage(img, 20, 20, 400, 400, Color.RED, this); }
From source file:StylesExample8.java
public static void createDocumentStyles(StyleContext sc) { Style defaultStyle = sc.getStyle(StyleContext.DEFAULT_STYLE); // Create and add the main document style Style mainStyle = sc.addStyle(mainStyleName, defaultStyle); StyleConstants.setLeftIndent(mainStyle, 16); StyleConstants.setRightIndent(mainStyle, 16); StyleConstants.setFirstLineIndent(mainStyle, 16); StyleConstants.setFontFamily(mainStyle, "serif"); StyleConstants.setFontSize(mainStyle, 12); // Create and add the constant width style Style cwStyle = sc.addStyle(charStyleName, null); StyleConstants.setFontFamily(cwStyle, "monospaced"); StyleConstants.setForeground(cwStyle, Color.green); // Create and add the heading style Style heading2Style = sc.addStyle(heading2StyleName, null); StyleConstants.setForeground(heading2Style, Color.red); StyleConstants.setFontSize(heading2Style, 16); StyleConstants.setFontFamily(heading2Style, "serif"); StyleConstants.setBold(heading2Style, true); StyleConstants.setLeftIndent(heading2Style, 8); StyleConstants.setFirstLineIndent(heading2Style, 0); // Create and add the Component style Class thisClass = StylesExample8.class; URL url = thisClass.getResource("java2s.gif"); ImageIcon icon = new ImageIcon(url); JLabel comp = new JLabel("Displaying text with attributes", icon, JLabel.CENTER); comp.setVerticalTextPosition(JLabel.BOTTOM); comp.setHorizontalTextPosition(JLabel.CENTER); comp.setFont(new Font("serif", Font.BOLD | Font.ITALIC, 14)); Style componentStyle = sc.addStyle(componentStyleName, null); StyleConstants.setComponent(componentStyle, comp); // The paragraph style for the component Style compParagraphStyle = sc.addStyle(compParaName, null); StyleConstants.setSpaceAbove(compParagraphStyle, (float) 16.0); }
From source file:TextPaneElements.java
public static void createDocumentStyles(StyleContext sc) { Style defaultStyle = sc.getStyle(StyleContext.DEFAULT_STYLE); // Create and add the main document style Style mainStyle = sc.addStyle(mainStyleName, defaultStyle); StyleConstants.setLeftIndent(mainStyle, 16); StyleConstants.setRightIndent(mainStyle, 16); StyleConstants.setFirstLineIndent(mainStyle, 16); StyleConstants.setFontFamily(mainStyle, "serif"); StyleConstants.setFontSize(mainStyle, 12); // Create and add the constant width style Style cwStyle = sc.addStyle(charStyleName, null); StyleConstants.setFontFamily(cwStyle, "monospaced"); StyleConstants.setForeground(cwStyle, Color.green); // Create and add the heading style Style heading2Style = sc.addStyle(heading2StyleName, null); StyleConstants.setForeground(heading2Style, Color.red); StyleConstants.setFontSize(heading2Style, 16); StyleConstants.setFontFamily(heading2Style, "serif"); StyleConstants.setBold(heading2Style, true); StyleConstants.setLeftIndent(heading2Style, 8); StyleConstants.setFirstLineIndent(heading2Style, 0); // Create and add the Component style Class thisClass = TextPaneElements.class; URL url = thisClass.getResource("java2s.gif"); ImageIcon icon = new ImageIcon(url); JLabel comp = new JLabel("Displaying text with attributes", icon, JLabel.CENTER); comp.setVerticalTextPosition(JLabel.BOTTOM); comp.setHorizontalTextPosition(JLabel.CENTER); comp.setFont(new Font("serif", Font.BOLD | Font.ITALIC, 14)); Style componentStyle = sc.addStyle(componentStyleName, null); StyleConstants.setComponent(componentStyle, comp); // The paragraph style for the component Style compParagraphStyle = sc.addStyle(compParaName, null); StyleConstants.setSpaceAbove(compParagraphStyle, (float) 16.0); }
From source file:org.jfree.graphics2d.demo.ImageTest.java
private static void drawGradientPaintTest(Graphics2D g2) { g2.setPaint(new GradientPaint(10f, 10f, Color.RED, 10f, 60f, Color.YELLOW)); g2.fillRect(10, 10, 50, 50);// w w w. j a v a2 s .c om g2.setPaint(Color.BLUE); g2.fillRect(60, 10, 50, 50); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); g2d.setPaint(gp1);/*w ww . ja v a 2 s . co m*/ g2d.fillRect(20, 20, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow); g2d.setPaint(gp1);//from w ww . j a v a 2s . c om g2d.fillRect(20, 20, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); System.out.println(gp1.getColor2()); g2d.setPaint(gp1);/* www . j ava 2 s .c om*/ g2d.fillRect(20, 20, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); System.out.println(gp1.getTransparency()); g2d.setPaint(gp1);/*from w ww . j ava2 s . c o m*/ g2d.fillRect(20, 20, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); System.out.println(gp1.getColor1()); g2d.setPaint(gp1);// w w w . j a v a 2 s . co m g2d.fillRect(20, 20, 300, 40); }