Java Reference
In-Depth Information
1
// Fig. 13.19: LinesRectsOvals.java
2
// Testing LinesRectsOvalsJPanel.
3
import java.awt.Color;
4
import javax.swing.JFrame;
5
6
public class LinesRectsOvals
7
{
8
// execute application
9
public static void main(String[] args)
10
{
11
// create frame for LinesRectsOvalsJPanel
12
JFrame frame =
13
new JFrame( "Drawing lines, rectangles and ovals" );
14
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
15
16
LinesRectsOvalsJPanel linesRectsOvalsJPanel =
17
new LinesRectsOvalsJPanel();
18
linesRectsOvalsJPanel.setBackground( Color.WHITE );
19
frame.add(linesRectsOvalsJPanel);
20
frame.setSize( 400 , 210 );
21
frame.setVisible( true );
22
}
23
} // end class LinesRectsOvals
fillRoundRect
drawLine
drawRect
drawRoundRect
drawOval
fillRect
draw3DRect
fillOval
fill3DRect
Fig. 13.19 | Testing LinesRectsOvalsJPanel .
(x, y)
arc height
arc width
height
width
Fig. 13.20 | Arc width and arc height for rounded rectangles.
 
Search WWH ::




Custom Search