// purpose: demonstrate rendering of a periwinkle box import javax.swing.*; import java.awt.*; import java.util.*; public class PeriwinkleBox { // method main(): program starting point public static void main( String[] args ) { // open up a window JFrame window = new JFrame( "Periwinkle" ); window.setSize( 150, 200 ); Container pane = window.getContentPane(); pane.setBackground( Color.BLACK ); window.setVisible( true ); // wait as user rearranges desktop Scanner stdin = new Scanner( System.in ); System.out.print( "Enter when ready. " ); String response = stdin.nextLine(); // get a renderer to manipulate window's display Graphics g = pane.getGraphics(); // set description of the box int x = 35; int y = 45; int w = 80; int h = 100; Color c = new Color( 100, 100, 212 ); // set the rendering color g.setColor( c ); // draw a filled in rectangle g.fillRect( x, y, w, h ); } }