Example usage for java.awt Graphics drawString

List of usage examples for java.awt Graphics drawString

Introduction

In this page you can find the example usage for java.awt Graphics drawString.

Prototype

public abstract void drawString(AttributedCharacterIterator iterator, int x, int y);

Source Link

Document

Renders the text of the specified iterator applying its attributes in accordance with the specification of the java.awt.font.TextAttribute TextAttribute class.

Usage

From source file:Main.java

public void paint(Graphics g) {
    g.drawString(g.getClipBounds().toString(), 10, 30);

    g.clipRect(10, 40, getSize().width - 20, getSize().height - 80);

    g.fillOval(0, 0, getSize().width, getSize().height);

    String newClip = g.getClipBounds().toString();

    g.setClip(0, 0, getSize().width, getSize().height);

    g.drawString(newClip, 10, getSize().height - 10);

}

From source file:MainClass.java

public void paintIcon(Component c, Graphics g, int x, int y) {
    g.drawString("java2s.com", 0, 20);
}

From source file:MyCanvas.java

public void paint(Graphics g) {
    g.setColor(Color.RED);
    g.drawString("text", 20, 30);
}

From source file:Main.java

private Image createImage() {
    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
    Graphics g = bufferedImage.getGraphics();
    g.drawString("www.java2s.com", 20, 20);

    return bufferedImage;
}

From source file:NotHelloWorldPanel.java

public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.drawString("Java Source and Support", 75, 100);
}

From source file:NotHelloWorld.java

public void paintComponent(Graphics g) {
    g.drawString("Not a Hello, World program", MESSAGE_X, MESSAGE_Y);
}

From source file:Main.java

public void paint(Graphics g) {
    g.drawString(s, x, y);
    g.drawLine(x, y + 2, x + getFontMetrics(getFont()).stringWidth(s), y + 2);
}

From source file:FirstApplet.java

public void paint(Graphics g) {
    g.drawString("Hello World", 25, 50);
}

From source file:MainClass.java

private BufferedImage createImage() {
    BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
    Graphics g = bufferedImage.getGraphics();
    g.drawString("www.java2s.com", 20, 20);

    return bufferedImage;
}

From source file:MainClass.java

public void paint(Graphics g) {
    g.drawString(str, 10, 25);
}