import javax.swing.*;
import java.awt.*;
public class head {
private int width;
private int height;
private int x;
private int y;
private JFrame window;
private Color color;
public head(){
window = new JFrame ("zhang rihui");
window.setSize(200,200);
width = 40;
height = 20;
x = 80 ;
y = 90 ;
color = Color.BLUE ;
window.setVisible(true);
}
public void paint(){
Graphics g = window.getGraphics();
g.setColor(color);
g.fillRect(x,y,width,height);
window.setVisible(true);
}
public static void main(String[] args){
head r1 = new head();
head r2 = new head();
r1.paint();
r2.paint();
}
}
import java.awt.*;
public class head {
private int width;
private int height;
private int x;
private int y;
private JFrame window;
private Color color;
public head(){
window = new JFrame ("zhang rihui");
window.setSize(200,200);
width = 40;
height = 20;
x = 80 ;
y = 90 ;
color = Color.BLUE ;
window.setVisible(true);
}
public void paint(){
Graphics g = window.getGraphics();
g.setColor(color);
g.fillRect(x,y,width,height);
window.setVisible(true);
}
public static void main(String[] args){
head r1 = new head();
head r2 = new head();
r1.paint();
r2.paint();
}
}