// Fig. 10.5: MyLabel.java
// Demonstrating the Label class.
import java.awt.*;

public class MyLabel extends Frame {
   private Label label1, label2; 
   
   MyLabel( String name)
   {
      super(name);
   }

   public void init()
   {
      setSize(300, 80);
      // call label constructor with no text
      label1 = new Label();

      // set the label's text
      label1.setText( "Started with no text" );

      // call label constructor with a string argument
      label2 = new Label( "This is read-only text" );

      // add label components to applet container
      add( label1 );
      add( label2 );
      setLayout( new FlowLayout( FlowLayout.CENTER ) );
   }

   public void paint( Graphics g )
   {     
      g.drawString( "label1's text is: " + label1.getText(),
         25, 40 );
      g.drawString( "label2's text is: " + label2.getText(),
         25, 55 );
   }

  public static void main(String argv[]){
    System.out.println( "wejście do main..." );
    MyLabel f = new MyLabel( "Etykieta" );
    f.init();
    f.show();
    System.out.println( "wyjście z main..." );
  }

}
