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

The following are Jave code examples for showing how to use drawBytes() 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: NotifyTools   File: FontEditor.java   View Source Code Vote up 5 votes
public void paintValue(Graphics gfx, Rectangle box) {
    Font font = (Font) getValue();
    if (font != null) {
        gfx.setFont(font);
        gfx.drawBytes("Hello".getBytes(), box.x, box.y, box.x + box.width, //$NON-NLS-1$
                box.y + box.height);
    }
}
 
Example 2
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;
    g.setFont(tctx.font);
    try {
        byte[] bytes = tctx.text.getBytes("ASCII"); // only good for english
        do {
            g.drawBytes(bytes, 0, bytes.length, 40, 40);
        } while (--numReps >= 0);
    }
    catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example 3
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;
    g.setFont(tctx.font);
    try {
        byte[] bytes = tctx.text.getBytes("ASCII"); // only good for english
        do {
            g.drawBytes(bytes, 0, bytes.length, 40, 40);
        } while (--numReps >= 0);
    }
    catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example 4
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;
    g.setFont(tctx.font);
    try {
        byte[] bytes = tctx.text.getBytes("ASCII"); // only good for english
        do {
            g.drawBytes(bytes, 0, bytes.length, 40, 40);
        } while (--numReps >= 0);
    }
    catch (Exception e) {
        throw new RuntimeException(e);
    }
}