doanquyit Mod
Tổng số bài gửi : 30 Join date : 05/01/2011 Age : 32 Đến từ : đồng tháp
| Tiêu đề: sao code này không vẽ được hình chữ nhật? Sat Aug 27, 2011 3:30 pm | |
| - Code:
-
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ch5sample2; import javax.swing.*; import java.awt.*; /** * * @author DOAN VAN QUY */ public class Ch5Sample2 {
/** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here JFrame win; Container containerPane; Graphics g; win = new JFrame("colered Squares"); win.setSize(300, 200); win.setLocation(100, 100); win.setVisible(true); containerPane = win.getContentPane(); containerPane.setBackground(Color.WHITE); g = containerPane.getGraphics(); g.setColor(Color.BLUE); g.drawRect(50, 50, 100, 30); g.setColor(Color.red); g.fillRect(175, 50, 100, 30); } }
| |
|