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

JToolBar.Separator is huge in Windows LAF

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.2
    • client-libs



      Name: rmT116609 Date: 05/23/2003


      FULL PRODUCT VERSION :
      java version "1.4.2-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
      Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)

      FULL OS VERSION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      JToolBar.Separator expands to fill all available horizontal space in Windows LAF. This behavior is new to 1.4.2.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a toolbar, add a button, a separator, and a button. Add the toolbar in the NORTH region of a container with BorderLayout LM.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The separator should be just wide enough to separate the buttons.
      ACTUAL -
      The separator fills all unused space on the toolbar.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.event.*;
      import java.awt.event.WindowAdapter;

      import javax.swing.*;

      public class ToolbarTest {

      public static void main(String[] args) throws Exception {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

      JFrame jf = new JFrame("ToolbarTest");

      jf.setSize(new Dimension(640, 480));
      jf.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent we) {
      System.exit(0);
      }
      });

      JPanel jp = new JPanel(new BorderLayout());

      JToolBar jtb = new JToolBar(JToolBar.HORIZONTAL);

      JButton jb1 = new JButton("B1");

      JButton jb2 = new JButton("B2");

      jtb.add(jb1);
      jtb.add(new JToolBar.Separator());
      jtb.add(jb2);

      jtb.add(new JLabel(System.getProperty("java.version")));

      jp.add(jtb, BorderLayout.NORTH);

      jf.getContentPane().add(jp);

      jf.setVisible(true);
      }

      }

      ---------- END SOURCE ----------
      (Review ID: 186408)
      ======================================================================

            leifs Leif Samuelsson (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: