Java Code Examples for java.awt.Graphics.drawChars()

The following are Jave code examples for showing how to use drawChars() of the java.awt.Graphics class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: OpenJSharp   File: NervousText.java   View Source Code Vote up 6 votes
@Override
public void paint(Graphics g) {
    int length = bannerChars.length;
    for (int i = 0, x = 0; i < length; i++) {
        int wd, ht;
        if (attributes[i] == '^') {
            wd = SMALL_WD;
            ht = SMALL_HT;
            g.setFont(smallFont);
        } else {
            wd = REGULAR_WD;
            ht = REGULAR_HT;
            g.setFont(regularFont);
        }
        int px = (int) (10 * Math.random() + x);
        int py = (int) (10 * Math.random() + ht);
        g.drawChars(bannerChars, i, 1, px, py);
        x += wd;
    }
}
 
Example 2
Project: jdk8u-jdk   File: NervousText.java   View Source Code Vote up 6 votes
@Override
public void paint(Graphics g) {
    int length = bannerChars.length;
    for (int i = 0, x = 0; i < length; i++) {
        int wd, ht;
        if (attributes[i] == '^') {
            wd = SMALL_WD;
            ht = SMALL_HT;
            g.setFont(smallFont);
        } else {
            wd = REGULAR_WD;
            ht = REGULAR_HT;
            g.setFont(regularFont);
        }
        int px = (int) (10 * Math.random() + x);
        int py = (int) (10 * Math.random() + ht);
        g.drawChars(bannerChars, i, 1, px, py);
        x += wd;
    }
}
 
Example 3
Project: openjdk-jdk10   File: NervousText.java   View Source Code Vote up 6 votes
@Override
public void paint(Graphics g) {
    int length = bannerChars.length;
    for (int i = 0, x = 0; i < length; i++) {
        int wd, ht;
        if (attributes[i] == '^') {
            wd = SMALL_WD;
            ht = SMALL_HT;
            g.setFont(smallFont);
        } else {
            wd = REGULAR_WD;
            ht = REGULAR_HT;
            g.setFont(regularFont);
        }
        int px = (int) (10 * Math.random() + x);
        int py = (int) (10 * Math.random() + ht);
        g.drawChars(bannerChars, i, 1, px, py);
        x += wd;
    }
}
 
Example 4
Project: OpenJSharp   File: TextRenderTests.java   View Source Code Vote up 5 votes
public void runTest(Object ctx, int numReps) {
    TextContext tctx = (TextContext)ctx;
    Graphics g = tctx.graphics;
    char[] chars = tctx.chars;
    g.setFont(tctx.font);
    do {
        g.drawChars(chars, 0, chars.length, 40, 40);
    } while (--numReps >= 0);
}
 
Example 5
Project: jdk8u-jdk   File: TextRenderTests.java   View Source Code Vote up 5 votes
public void runTest(Object ctx, int numReps) {
    TextContext tctx = (TextContext)ctx;
    Graphics g = tctx.graphics;
    char[] chars = tctx.chars;
    g.setFont(tctx.font);
    do {
        g.drawChars(chars, 0, chars.length, 40, 40);
    } while (--numReps >= 0);
}
 
Example 6
Project: openjdk-jdk10   File: TextRenderTests.java   View Source Code Vote up 5 votes
public void runTest(Object ctx, int numReps) {
    TextContext tctx = (TextContext)ctx;
    Graphics g = tctx.graphics;
    char[] chars = tctx.chars;
    g.setFont(tctx.font);
    do {
        g.drawChars(chars, 0, chars.length, 40, 40);
    } while (--numReps >= 0);
}