List of usage examples for java.awt Color blue
Color blue
To view the source code for java.awt Color blue.
Click Source Link
From source file:Main.java
public Main() { setSize(350, 400);//from w w w .ja v a 2 s.c om attribString.addAttribute(TextAttribute.FOREGROUND, Color.blue, 0, text.length()); attribString.addAttribute(TextAttribute.FONT, new Font("sanserif", Font.ITALIC, 20), 0, text.length()); }
From source file:XORModePaintWithMouse.java
public void paint(Graphics g) { g.drawLine(0, 0, 100, 100);//from w w w .j a v a2s. c o m g.drawLine(0, 100, 100, 0); g.setColor(Color.blue); g.drawLine(40, 25, 250, 180); g.drawLine(75, 90, 400, 400); g.setColor(Color.green); // xor cross hairs g.setXORMode(Color.black); g.drawLine(chsX - 10, chsY, chsX + 10, chsY); g.drawLine(chsX, chsY - 10, chsX, chsY + 10); g.setPaintMode(); }
From source file:ButtonwithImageIcon.java
public ButtonPanel() { JButton btn = new JButton("Push Me", new BoxIcon(Color.blue, 2)); btn.setRolloverIcon(new BoxIcon(Color.cyan, 3)); btn.setPressedIcon(new BoxIcon(Color.yellow, 4)); btn.setHorizontalTextPosition(JButton.LEFT); btn.setBorder(BorderFactory.createEtchedBorder()); btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Button was pressed."); }// ww w.ja va2 s. c om }); add(btn); }
From source file:common.utility.ChartHelper.java
public static JFreeChart createChart(CategoryDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createBarChart3D("Quantity Of Citizens Of Each Area", // chart title "(Include unactived people)", // domain axis label "Quantity", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? );//from w w w . j a v a 2 s. com // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.yellow); // Set the background colour of the chart chart.getTitle().setPaint(Color.blue); // Adjust the colour of the title CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph p.setBackgroundPaint(Color.black); // Modify the plot background p.setRangeGridlinePaint(Color.red); return chart; }
From source file:TransparentText.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; // the rendering quality. g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // a red rectangle. Rectangle2D r = new Rectangle2D.Double(50, 50, 550, 100); g2.setPaint(Color.red);/*from w w w . j a v a2s .c o m*/ g2.fill(r); // a composite with transparency. Composite c = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .4f); g2.setComposite(c); // Draw some blue text. g2.setPaint(Color.blue); g2.setFont(new Font("Times New Roman", Font.PLAIN, 72)); g2.drawString("Java Source and Support", 25, 130); }
From source file:RoundGradientPaintFill.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RoundRectangle2D r = new RoundRectangle2D.Float(5, 5, 150, 150, 25, 25); RoundGradientPaint rgp = new RoundGradientPaint(75, 75, Color.magenta, new Point2D.Double(0, 85), Color.blue); g2.setPaint(rgp);/*from w w w .ja v a2 s . c o m*/ g2.fill(r); }
From source file:MainClass.java
public void paint(Graphics g) { BufferedImage bim;/*from www .j a v a 2 s .c o m*/ TexturePaint tp; String mesg = "www.java2s.com"; Font myFont = new Font("Lucida Regular", Font.BOLD, 72); Color[] colors = { Color.red, Color.blue, Color.yellow, }; int width = 8, height = 8; bim = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bim.createGraphics(); for (int i = 0; i < width; i++) { g2.setPaint(colors[(i / 2) % colors.length]); g2.drawLine(0, i, i, 0); g2.drawLine(width - i, height, width, height - i); } Rectangle r = new Rectangle(0, 0, bim.getWidth(), bim.getHeight()); tp = new TexturePaint(bim, r); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(tp); g2d.setFont(myFont); g2d.drawString(mesg, 20, 100); }
From source file:ColorVariousObjects.java
public void paint(Graphics g) { Color c1 = new Color(255, 100, 100); Color c2 = new Color(100, 255, 100); Color c3 = new Color(100, 100, 255); g.setColor(c1);/* ww w . j a va 2 s . c o m*/ g.drawLine(0, 0, 100, 100); g.drawLine(0, 100, 100, 0); g.setColor(c2); g.drawLine(40, 25, 250, 180); g.drawLine(75, 90, 400, 400); g.setColor(c3); g.drawLine(20, 150, 400, 40); g.drawLine(5, 290, 80, 19); g.setColor(Color.red); g.drawOval(10, 10, 50, 50); g.fillOval(70, 90, 140, 100); g.setColor(Color.blue); g.drawOval(190, 10, 90, 30); g.drawRect(10, 10, 60, 50); g.setColor(Color.cyan); g.fillRect(100, 10, 60, 50); g.drawRoundRect(190, 10, 60, 50, 15, 15); }
From source file:CardLayoutBehaviour.java
public CardLayoutBehaviour() { JPanel tab;/* ww w . jav a 2 s . c o m*/ Container pane = getContentPane(); layout = new CardLayout(); pane.setLayout(layout); tab = new JPanel(); tab.setBackground(Color.red); pane.add(tab, "Red Tab"); tab = new JPanel(); tab.setBackground(Color.green); pane.add(tab, "Green Tab"); tab = new JPanel(); tab.setBackground(Color.blue); pane.add(tab, "Blue Tab"); }
From source file:Main.java
public void paint(Graphics g) { BufferedImage bim;//from w w w . j a v a2 s . c o m TexturePaint tp; String mesg = "www.java2s.com"; Font myFont = new Font("Lucida Regular", Font.BOLD, 72); Color[] colors = { Color.red, Color.blue, Color.yellow, }; int width = 8, height = 8; bim = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bim.createGraphics(); for (int i = 0; i < width; i++) { g2.setPaint(colors[(i / 2) % colors.length]); g2.drawLine(0, i, i, 0); g2.drawLine(width - i, height, width, height - i); } Rectangle r = new Rectangle(0, 0, bim.getWidth(), bim.getHeight()); tp = new TexturePaint(bim, r); System.out.println(tp.getAnchorRect()); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(tp); g2d.setFont(myFont); g2d.drawString(mesg, 20, 100); }