Java Graphics.drawBytes(byte[] data, int offset, int length, int x, int y)
Syntax
Graphics.drawBytes(byte[] data, int offset, int length, int x, int y) has the following syntax.
public void drawBytes(byte[] data, int offset, int length, int x, int y)
Example
In the following code shows how to use Graphics.drawBytes(byte[] data, int offset, int length, int x, int y) method.
import java.awt.Color;
import java.awt.Graphics;
/* w ww. j ava 2s.c o m*/
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Main extends JPanel {
public void paint(Graphics g) {
byte [] barray = { 0x41, 0x42, 0x43 };
g.drawBytes (barray, 0, barray.length, 10, 30);
}
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.add(new Main());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(20,20, 500,500);
frame.setVisible(true);
}
}
Home »
Java Tutorial »
java.awt »
Java Tutorial »
java.awt »