Mega Code Archive

 
Categories / Java Tutorial / 2D Graphics
 

Draw Bytes

import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class MainClass extends JPanel {   public static void main(String[] a) {     JFrame f = new JFrame();     f.setSize(400, 400);     f.add(new MainClass());     f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);     f.setVisible(true);   }   public void paint(Graphics g) {     byte[] b = { 0x65, (byte) 'B', 0x66 };     g.drawBytes(b, 0, b.length, 10, 30);   } }