>}  
 {calculate (Double.parseDouble (display.getText ()));=command;=true;}}} void calculate (double x) 
  {(lastCommand.equals ( + )) result +=x; if (lastCommand.equals ( - )) result -=x; if (lastCommand.equals ( * )) result *=x; if (lastCommand.equals (/)) result /=x; if (lastCommand.equals (=)) result=x; .setText ( + result); 
 } JButton display; JPanel panel; double result; String lastCommand; boolean start;} 
      Додаток 6 
  javax.swing. *; java.awt. *; java.awt.event. *; 
  /***************************************** **************** 
  * Simple demonstration of a face with action (in a JFrame). 
  ****************************************** ***************/class SadMadeleine extends JFrame implements ActionListener 
  {static final int FRAME_WIDTH=400; static final int FRAME_HEIGHT=400; static final int FACE_DIAMETER=200; static final int EYE_WIDTH=20; static final int EYE_HEIGHT=10; static final int NOSE_DIAMETER=10 ; static final int MOUTH_WIDTH=100; static final int MOUTH_HEIGHT=50; static final int X_SAD_FACE=190; static final int Y_SAD_FACE=150; static final int X_HAPPY_FACE=100; static final int Y_HAPPY_FACE=50; static final int MOUTH_START_ANGLE=180; static final int MOUTH_ARC_SWEEP=180; 
  boolean smile=false; int xFace=X_SAD_FACE; int yFace=Y_SAD_FACE; int xNose=xFace + 95; int yNose=yFace + 95; int xLeftEye=xFace + 55; int yLeftEye=yFace + 45 ; int xRightEye=xFace + 130; int yRightEye=yFace + 45; int x1LeftBrow=xFace + 55; int y1LeftBrow=yFace + 38; int x2LeftBrow=x1LeftBrow + 20; int y2LeftBrow=y1LeftBrow + 2; int x1RightBrow=xFace + 130; int y1RightBrow=y2LeftBrow; int x2RightBrow=x1RightBrow + 20; int y2RightBrow=y1LeftBrow; int xMouth=xFace + 50; int yMouth=yFace + 125; 
  static void main (String [] args) 
  {picture=new SadMadeleine () ;. setVisible (true); 
 } 
  SadMadeleine () 
  {(FRAME_WIDTH, FRAME_HEIGHT); (new WindowDestroyer ()); ( Sad Madeleine ); contentPane=getContentPane () ;. setLayout (new BorderLayout ()) ;. setBackground (Color. white); smileButton=new JButton ( Click for a Smile. ) ;. addActionListener (this) ;. add (smileButton, BorderLayout.SOUTH); 
 } 
  void actionPerformed (ActionEvent e) 
  {(e.getActionCommand (). equals ( Click for a Smile. ))=true; .out.println ( Error in button interface. ); () ; 
 } 
  void paint (Graphics g) 
  {. paint (g); (smile) 
				
				
				
				
			  {= X_HAPPY_FACE;=Y_HAPPY_FACE; 
 } 
  {= X_SAD_FACE;=Y_SAD_FACE; 
 } 
 =xFace + 95;=yFace + 95;=xFace + 55;=yFace + 45;=xFace + 130;=yFace + 45; LeftBrow=xFace + 55; LeftBrow=yFace + 38; LeftBrow=x1LeftBrow + 20; LeftBrow=y1LeftBrow + 2; RightBrow=xFace + 130; RightBrow=y2LeftBrow; RightBrow=x1RightBrow + 20; RightBrow=y1LeftBrow;=xFace + 50;=yFace + 125; 
 . drawOval (xFace, yFace, FACE_DIAMETER, FACE_DIAMETER); 
 //Draw Nose: .fillOval (xNose, yNose, NOSE_DIAMETER, NOSE_DIAMETER); 
 //Draw Eyes: .fillOval (xLeftEye, yLeftEye, EYE_WIDTH, EYE_HEIGHT) ;. fillOval (xRightEye, yRightEye, EYE_WIDTH, EYE_HEIGHT); 
 //Draw eyebrows: .drawLine (x1LeftBrow, y1LeftBrow, LeftBrow, y2LeftBrow) ;. drawLine (x1RightBrow, y1RightBrow, RightBrow, y2RightBrow); 
 //Draw Mouth: (smile) .drawArc (xMouth, yMouth, MOUTH_WIDTH, MOUTH_HEIGHT, _START_ANGLE, MOUTH_ARC_SWEEP);//Note minus sign: .drawArc (xMouth, yMouth, MOUTH_WIDTH, MOUTH_HEIGHT, _START_ANGLE , -MOUTH_ARC_SWEEP); 
 } 
 } 
    Додаток 7 
  javax.swing. *; java.awt. *; java.awt.event. *; 
  class ColorChangeDemo extends JFrame implements ActionListener 
  {static final int WIDTH=400; static final int HEIGHT=200; 
  JPanel colorPanel; Color panelColor; int redValue=0; int greenValue=0; int blueValue=0; 
  static void main (String [] args) 
  {gui=new ColorChangeDemo () ;. setVisible (true); 
 } 
  ColorChangeDemo () 
  {contentPane=getContentPane () ;. setLayout (new BorderLayout ()); (Color Change Demo ); (WIDTH, HEIGHT); (new WindowDestroyer ());=new JPanel ();=new Color (0, 0, 0) ;. setBackground (panelColor) ;. add (colorPanel, Bor...