The first two arguments represent the x- and y-coordinates of the upper-left corner of the rectangle. The last two arguments represent the width and height of the rectangle. For example, the following statement draws a short, wide rectangle that begins at position 20, 100, and is 200 pixels wide by 10 pixels tall: drawRect(20, 100, 200, 10);
An empty rectangle is single digit method with two truths that form a short single digit chain to eliminate a candidate that sees both ends. One end of the chain is a box set with more than 2 candidates.
The first four arguments match the four arguments required to draw a rectangle: the x- and y-coordinates of the upper-left corner, the width, and the height. The two additional arguments represent the arc width and height associated with the rounded corners (an arc is a portion of a circle).
When you use setLocation(), the upper-left corner of the component is placed at the specified x- and y-coordinates. In other words, if a window is 100 by 100 pixels, aButton.setLocation(100,100); places the JButton outside the window, where you cannot see the component.
If you call getGraphics() in a frame that is not visible, you receive a NullPointerException, and
The horizontal position number increases from left to right across the screen , and the vertical position number increases from top to bottom.
The repaint() method only requests that Java repaint the screen. If a second request to repaint() occurs before Java can carry out the first request, Java executes only the last repaint() method.
System-triggered painting: operations occur when the system asks a component to render its contents. This happens when the component is first made visible, if it is resized, or if it is damaged. For example, a component becomes damaged when another component that previously covered part of it has been moved, revealing a portion that was not visible.
Notice that when you create the draw object, you are not calling the Graphics constructor directly. (The name of the Graphics constructor is Graphics(), not getGraphics().)
This method instantiates a Graphics object named draw. (You can use any legal Java identifier.) The getGraphics() method provides the draw object with Graphics capabilities. Then the draw object can employ Graphics methods such as setFont(), setColor(), and drawString().