import javax.imageio.*;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;
public class prog6 {
public static void main(String[] args) {
myFrame okno = new myFrame();
}
}
class myFrame extends JFrame{
public myFrame(){
myPanel np = new myPanel();
Container cont = getContentPane();
cont.add(np);
setBounds(10,10,800,600);
setVisible(true);
}
}
class myPanel extends JPanel{
private Image img;
public myPanel(){
try {
img = ImageIO.read(new File("C:\\1\\1.jpg"));
}
catch (IOException ex){}
}
public void paintComponent (Graphics gr){
//gr.drawImage(img,10,10,null);
//gr.setColor(Color.GREEN);
for(int i = 0; i < 10; i++)
{
if (i % 2 == 0)
gr.setColor(Color.ORANGE);
else
gr.setColor(Color.GREEN);
gr.fillRect(10*(i+1), 10*(i+1), 50*(i+1), 50*(i+1));
}
}
}