List of usage examples for java.awt Graphics2D setRenderingHint
public abstract void setRenderingHint(Key hintKey, Object hintValue);
From source file:TextAttributesColor.java
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); AttributedString as1 = new AttributedString("1234567890"); as1.addAttribute(TextAttribute.FOREGROUND, Color.red, 0, 2); g2d.drawString(as1.getIterator(), 15, 60); }
From source file:TextLayoutOne.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "Java Source and Support."; Font font = new Font("Serif", Font.PLAIN, 32); TextLayout textLayout = new TextLayout(s, font, g2.getFontRenderContext()); textLayout.draw(g2, 40, 80);//from w ww .j a v a 2s. c o m }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Font font = new Font("Serif", Font.PLAIN, 40); AttributedString as1 = new AttributedString("1234567890"); as1.addAttribute(TextAttribute.FONT, font); g2d.drawString(as1.getIterator(), 15, 60); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "www.java2s.com"; Font font = new Font("Serif", Font.PLAIN, 24); FontRenderContext frc = g2.getFontRenderContext(); GlyphVector gv = font.createGlyphVector(frc, s); g2.drawGlyphVector(gv, 40, 60);/*from w w w .ja v a 2 s . c o m*/ }
From source file:Main.java
@Override public void paintComponent(Graphics g) { if (g instanceof Graphics2D) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.drawString("This is gona be awesome", 70, 20); }/*from w ww. j a v a 2 s .co m*/ }
From source file:SimpleFont.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "Java Source and Support"; Font font = new Font("Serif", Font.PLAIN, 24); FontRenderContext frc = g2.getFontRenderContext(); GlyphVector gv = font.createGlyphVector(frc, s); g2.drawGlyphVector(gv, 40, 60);//from w w w. j ava 2 s. c o m }
From source file:EllipseRenderHints.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Shape s = new Ellipse2D.Float(20, 50, 250, 150); g2.setPaint(Color.BLACK);/* ww w .j a v a2s. c o m*/ g2.draw(s); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "www.java2s.com"; Font font = new Font("Serif", Font.PLAIN, 32); TextLayout textLayout = new TextLayout(s, font, g2.getFontRenderContext()); textLayout.draw(g2, 40, 80);//from ww w . j a v a 2 s .c o m }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); String s = "www.java2s.com"; Font font = new Font("Serif", Font.PLAIN, 24); FontRenderContext frc = g2.getFontRenderContext(); GlyphVector gv = font.createGlyphVector(frc, s); g2.drawGlyphVector(gv, 40, 60);//from w w w . j a v a 2s . c o m }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setPaint(Color.black);/*from w w w. j a va 2s. c om*/ g2.draw(new Rectangle2D.Float(10, 20, 30, 40)); AffineTransform at = AffineTransform.getTranslateInstance(75, 75); g2.transform(at); g2.setPaint(Color.red); g2.draw(new Rectangle2D.Float(10, 20, 30, 40)); }