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

REG: JButton in JToolBar get's Border even if set to null ... (SDK 1.4.0 beta2)

XMLWordPrintable

    • rc1
    • x86
    • windows_nt
    • Verified



      Name: rmT116609 Date: 10/04/2001


      java version "1.4.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
      Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)

      The test case worked fine with SDK 1.3.1 but has broken in 1.4.0-beta2.

      Setting the border of a JButton to null (button.setBorder(null);)
      doesn't remove the border anymore in SDK 1.4.0 (beta2).

      -------------------------------test application-------------------------------------------------------
      import java.awt.*;
      import javax.swing.*;

      /**
       * Config: Windows NT 4.0, JDK 1.4.0 beta2
       */
      public class ToolbarButtonBug {
          
          /** */
          public static void main(String[] arguments) {
              JFrame frame = new JFrame();
              frame.setBounds(0, 0, 640, 400);
              frame.getContentPane().setLayout(new BorderLayout());
              JToolBar toolBar = new JToolBar("toolbar");
              JButton button = new JButton("button");
              button.setIcon(new ImageIcon("icon.gif"));
              button.setBorder(null);
      // button.setBorderPainted(false); //fix!!!
              toolBar.add(button);
              frame.getContentPane().add(toolBar, BorderLayout.NORTH);
              frame.setVisible(true);
          }//main()
          
      }//ToolbarButtonBug
      -----------------------------------------------------------

      to really remove the border the method setBorderPainted(false) has to be called.

      Regarding the gif file, you can take any gif you want. i checked it with 16x16 and
      32/24 pixel size gifs - it's not dependend on the gif file
      (Review ID: 130888)
      ======================================================================

            mdavidsosunw Mark Davidson (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: