Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4032768

Resizing appletviewer window causes refreshing the previous relocation effect

XMLWordPrintable

    • generic
    • generic

       +-------------------------- + ---(1)
       | +-------------- + |
       | | | |
       | | TextArea | |
       | | | |
       | | | |
       | +-------------- + |
       +-------------------------- +
       | small | <== push
       +-------------------------- +

       +-------------------------- +---(2)
       | +------ + |
       | | Text | |
       | | Area | | : Text area becomes small.
       | +------ + |
       | |
       | |
       +-------------------------- +
       | small |
       +-------------------------- +


      (3) Resizing Appletviewer Window:
       +-------------------------- +
       | +-------------- + |
       | | | |
       | | TextArea | | : Size of TextArea becomes
       | | | | same as original.
       | | | |
       | +-------------- + |
       +-------------------------- +
       | small |
       +-------------------------- +


       sample program:

      import java.awt.*;
      import java.applet.*;

      public class area extends java.applet.Applet{
          TextArea tv;
          Panel cpal;
          Checkbox cm;

          public void init() {
              resize(900, 500);
              tv = new TextArea("123456", 10, 20);
              setLayout(new BorderLayout(0,0));
              Panel tpal = new Panel();
              tpal.add(tv);
              cpal = new Panel();
              cpal.setLayout(new GridLayout(1,1));
              cm = new Checkbox("Small",null,true);
              cpal.add(cm);
              add("South",cpal);
              add("Center",tpal);
          }
          public boolean action(Event e, Object obj) {
              if(e.target instanceof Checkbox){
                  Checkbox cb = (Checkbox)e.target;
                  if(cb.getLabel().equals("Small")){
                      tv.setBounds(20,20,100,100);
                      return false;
                  }
              }
              return false;
          }
      }

            jeff Jeff Dinkins
            sishidasunw Shoji Ishida (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: