Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6739756
Votes 0
Synopsis JToolBar leaves space for non-visible items under Nimbus L&F
Category java:classes_swing
Reported Against
Release Fixed 6u14(b04)
State 11-Closed, Verified, bug
Priority: 3-Medium
Related Bugs
Submit Date 21-AUG-2008
Description
FULL PRODUCT VERSION :
java version "1.6.0_10-rc"
Java(TM) SE Runtime Environment (build 1.6.0_10-rc-b28)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
 customer  Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
Unlike other Look & Feels, Nimbus leaves space for non-visible items in a JToolBar.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expect the "Test" and "Test3" buttons to be adjacent.
ACTUAL -
"Test" and "Test3" buttons are separated by space allocated for non-visible "Test2" button.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;

public class NimbusToolBarBug extends JFrame {
	 
   public static void main(String[] args) {
      try {
         UIManager.setLookAndFeel(
                 "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
      }
      catch (Exception e) {
      }
     
      JDialog dg = new JDialog();
      JToolBar tb = new JToolBar();
      tb.add(new JButton("Test"));
      JButton b2 = new JButton("Test2");
      b2.setVisible(false);
      tb.add(b2);
      tb.add(new JButton("Test3"));
      dg.add(tb);
      dg.pack();
      dg.setVisible(true);
   }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
For all items added to the JToolBar which might ever be non-visible, use item subclasses for which the preferred size is (0,0) when the item is not visible.
Posted Date : 2008-08-21 10:12:38.0
Work Around
N/A
Evaluation
We should fix the default layout for SynthToolBarUI
Posted Date : 2009-03-04 19:03:19.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang