BASIC 2 HIFI PROGRAM ...
ALL HERE

Monday, 22 December 2014

making rectangle in java graphics

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

class rect extends JPanel {
public void paintComponent(Graphics g)
{
g.setColor(Color.orange);
for(int i=0;i<=500;i++)
{
g.fillRect(20,i,100,100);
}
}
}

public class rectangle_movement {
public static void main(String[] args)
{
JFrame frame=new JFrame();
frame.getContentPane().add(new rect());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(800,800);
frame.setVisible(true);
}
}

No comments:

Post a Comment