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 paintIcon(Component c, Graphics g, int x, int y) {
    g.setColor(cl);//  www  . j a  va2s .  c  o m
    g.drawString("java2s.com", 0, 20);
}

From source file:Main.java

public void paint(Graphics g) {
    Font f = g.getFont();/*  w  w w  .j  a v a2  s.c o m*/

    System.out.println(f.getItalicAngle());

    g.drawString("java2s.com", 4, 16);
}

From source file:EventQueuePanel.java

public void displayPrompt(Graphics g, String s) {
    y += 20;
    g.drawString(s, 0, y);
}

From source file:Main.java

public void paint(Graphics g) {
    g.setColor(Color.BLUE);
    g.drawString(name, 0, 0);
}

From source file:BasicDraw.java

public void paint(Graphics g) {
    Font font = new Font("Serif", Font.PLAIN, 12);
    g.setFont(font);//  w w  w  .jav a2  s  .  c  o  m
    g.drawString("a String", 10, 10);

    FontMetrics fontMetrics = g.getFontMetrics();
    g.drawString("aString", 10, 10 + fontMetrics.getAscent());
}

From source file:MainClass.java

public void paint(Graphics g) {
    g.drawString(msg, 4, 20);
}

From source file:AppletAnimation.java

public void paint(Graphics g) {
    g.drawString("Frame " + frameNumber, 0, 30);
}

From source file:TextLayoutLeft.java

public void drawString(Graphics g, String line, int wc, int lineW, int y) {
    g.drawString(line, 0, y);
}

From source file:TextLayoutRight.java

public void drawString(Graphics g, String line, int wc, int lineW, int y) {
    g.drawString(line, d.width - lineW, y); //right
}

From source file:Main.java

public void paintIcon(Component c, Graphics g, int x, int y) {
    g.setColor(Color.red);//w w w .  j  a v  a 2  s. c  om
    g.fillRect(0, 0, 33, 33);
    g.drawString("java2s.com", 0, 20);
}