List of usage examples for java.awt RenderingHints put
public Object put(Object key, Object value)
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);/*from www .j av a 2 s . com*/ int x = 40, y = 40; g.setColor(Color.red); g.fillOval(x, y, 50, 50); Composite old = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_IN)); g.setColor(Color.green); g.fillOval(x + 30, y + 30, 30, 30); g2.setComposite(old); g.setColor(Color.black); g.drawString("AlphaComposite.SRC_IN", x, y + 80); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);/*w w w.j a v a 2 s .c om*/ int x = 40, y = 40; g.setColor(Color.red); g.fillOval(x, y, 50, 50); Composite old = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OUT)); g.setColor(Color.green); g.fillOval(x + 30, y + 30, 30, 30); g2.setComposite(old); g.setColor(Color.black); g.drawString("AlphaComposite.SRC_OUT", x, y + 80); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);//from w w w . j a va 2 s.co m int x = 40, y = 40; g.setColor(Color.red); g.fillOval(x, y, 50, 50); Composite old = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); g.setColor(Color.green); g.fillOval(x + 30, y + 30, 30, 30); g2.setComposite(old); g.setColor(Color.black); g.drawString("AlphaComposite.SRC_OVER", x, y + 80); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);//from w w w . j a v a 2 s . c o m int x = 40, y = 40; g.setColor(Color.red); g.fillOval(x, y, 50, 50); Composite old = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_OUT)); g.setColor(Color.green); g.fillOval(x + 30, y + 30, 30, 30); g2.setComposite(old); g.setColor(Color.black); g.drawString("AlphaComposite.DST_OUT", x, y + 80); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);//from w w w.j a v a 2 s . co m int x = 40, y = 40; g.setColor(Color.red); g.fillOval(x, y, 50, 50); Composite old = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC)); g.setColor(Color.green); g.fillOval(x + 30, y + 30, 30, 30); g2.setComposite(old); g.setColor(Color.black); g.drawString("AlphaComposite.SRC", x, y + 80); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);// www.ja v a 2 s. com int x = 40, y = 40; g.setColor(Color.red); g.fillOval(x, y, 50, 50); Composite old = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_IN)); g.setColor(Color.green); g.fillOval(x + 30, y + 30, 30, 30); g2.setComposite(old); g.setColor(Color.black); g.drawString("AlphaComposite.DST_IN", x, y + 80); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);//from w w w . j a va2 s .c o m int x = 40, y = 40; g.setColor(Color.red); g.fillOval(x, y, 50, 50); Composite old = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_OVER)); g.setColor(Color.green); g.fillOval(x + 30, y + 30, 30, 30); g2.setComposite(old); g.setColor(Color.black); g.drawString("AlphaComposite.DST_OVER", x, y + 80); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);/*from ww w.jav a 2 s .c o m*/ int x = 40, y = 40; g.setColor(Color.red); g.fillOval(x, y, 50, 50); Composite old = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR)); g.setColor(Color.green); g.fillOval(x + 30, y + 30, 30, 30); g2.setComposite(old); g.setColor(Color.black); g.drawString("AlphaComposite.CLEAR", x, y + 80); }
From source file:Text.java
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHints(rh);//from ww w . j a va 2 s . c o m Font font = new Font("New Roma", Font.BOLD, 40); g2d.setFont(font); g2d.drawString("text", 20, 30); }
From source file:PrintLineByLine.java
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHints(rh);/* w ww .jav a 2 s . c o m*/ g2d.setFont(new Font("Purisa", Font.PLAIN, 13)); g2d.drawString("Line 1", 20, 30); g2d.drawString("Line 2", 20, 60); g2d.drawString("Line 3", 20, 90); g2d.drawString("Line 4", 20, 120); g2d.drawString("Line 5", 20, 150); g2d.drawString("Line 6", 20, 180); }