¡@

Home 

java Programming Glossary: myrectangle

Drawing a rectangle that won't disappear in next paint

http://stackoverflow.com/questions/12683533/drawing-a-rectangle-that-wont-disappear-in-next-paint

down... public class MyPanel extends JPanel private List MyRectangle lstShapes private Timer populate public MyPanel lstShapes new.. Timer populate public MyPanel lstShapes new ArrayList MyRectangle 25 populate new Timer 40 new ActionListener @Override public.. Math.random 255 int Math.random 255 lstShapes.add new MyRectangle x y width height color repaint populate.setInitialDelay 0..

Strange JFrame Behavior

http://stackoverflow.com/questions/13822019/strange-jframe-behavior

false class DrawPanel extends JPanel private ArrayList MyRectangle rects new ArrayList private Random rand new Random @Override.. Graphics g super.paintComponent g addRect for MyRectangle r rects g.setColor r.getColor g.fillRect r.x r.y r.width r.height.. 256 int green int Math.random 256 rects.add new MyRectangle x y wd ht new Color red blue green close inner class class..

Java - MouseListener Action Event in paintComponent

http://stackoverflow.com/questions/14068472/java-mouselistener-action-event-in-paintcomponent

MyPanel extends JPanel int width 300 height 300 ArrayList MyRectangle entities new ArrayList MyBall ball new MyBall 10 10 25 25 Color.RED.. addEntity int x int y int w int h Color c entities.add new MyRectangle x y w h c void moveEntities ball.moveBALL @Override protected.. int ball.x int ball.y int ball.width int ball.height for MyRectangle entity entities g2d.setColor entity.getColor g2d.fillRect..