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

Tool bar container listener does not set border back after button removing

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.6



      Name: nkR10003 Date: 07/22/2000


      Tool bar add/remove operation pair changes previously installed button border

      %java -fullversion
      java full version "1.4.0beta-b23"
      ------------------example--------------------
      //HandlerTests.java
      //

      import javax.swing.*;
      import javax.swing.border.*;

      public class HandlerTests {

          public static void main(String argv[]) {
              
              JToolBar toolBar = new JToolBar();
              JButton button = new JButton("Test");
              button.setBorder(new EmptyBorder(5,5,5,5));
              Border border = button.getBorder();
              
              toolBar.add(button);
              toolBar.remove(button);
              
              if (!button.getBorder().equals(border)) {
                  
                  System.out.println("border is: " + button.getBorder());
                  System.out.println("border was: " + border);
                  
                  System.out.println("Method componentRemoved does not set border back");
              } else {
                  System.out.println("Passed OKAY");
              }
              System.exit(0);
          }
      }
      ----------------output:----------------------
      border is: javax.swing.border.CompoundBorder@27391d
      border was: javax.swing.border.EmptyBorder@16ab4e
      Method componentRemoved does not set border back
      ---------------------------------------------
      ======================================================================

            leifs Leif Samuelsson (Inactive)
            knasunw Kna Kna (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: