アットウィキロゴ

ぱいんt

import javax.swing.*;
import java.awt.Graphics;
import java.awt.Color;

public class pro extends JPanel{

  public static void main(String[] args){
    JFrame frame = new JFrame();

    pro app = new pro();
    frame.getContentPane().add(app);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(0, 0, 500, 500);
    frame.setTitle("タイトル");
    frame.setVisible(true);
  }

  public void paintComponent(Graphics g){
    g.setColor(Color.red);
    g.fillRect(0, 0, 200, 220);

    g.setColor(Color.blue);
    g.drawString("Hello Java2D", 100, 50);
  }
}
最終更新:2011年08月18日 22:49