-
Bug
-
Resolution: Fixed
-
P4
-
1.2.2
-
beta
-
x86
-
windows_nt
Name: et89391 Date: 08/23/99
JButtons in a JToolBar with Windows LAF get a margin of 14 pixels for left and right.
This is to much. With Metal LAF everything is fine.
MetalToolBarUI changes the margin of the JButtons in it to (0,0,0,0). See in the source
lines 231, 260 setBorder...(Component c){..}
The WindowsToolBarUI or its super class BasicToolBarUI does nothing like this.
I tested and reproduced this behaviour under NT and Win95 with
JDK1.2 and JDK1.2.2.
A similar bug was already reported with the id 4104225. It was
closed because sun couldn't reproduce the bug !!!!?????
Here is my testprogramm:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ToolBarTest extends JFrame implements ActionListener{
Container main;
JButton metal = new JButton("metal");
JButton win = new JButton("win");
public ToolBarTest(){
main = getContentPane();
JToolBar tb = new JToolBar();
tb.add(
new AbstractAction("", new ImageIcon("save.gif") ){
public void actionPerformed(ActionEvent e)
{
}
});
main.setLayout(new BorderLayout());
main.add(tb, BorderLayout.NORTH);
JPanel p = new JPanel(new FlowLayout() );
metal.addActionListener(this);
win.addActionListener(this);
p.add(metal);
p.add(win);
main.add(p, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
setSize(300, 200);
}
public void actionPerformed(ActionEvent e){
if( e.getSource() == metal ){
try{
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
SwingUtilities.updateComponentTreeUI(this);
}
catch(Exception e2){
System.err.println(e2);
}
}
else{
try{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
SwingUtilities.updateComponentTreeUI(this);
}
catch(Exception e1){
System.err.println(e1);
}
}
}
public static void main(String[] args) {
new ToolBarTest().show();
}
}
Java vesions:
java full version "JDK-1.2.2-W"
(Review ID: 93883)
======================================================================
- relates to
-
JDK-4395089 Merlin: Buttons added in JToolBar has default JButton margin, not (0,0,0,0)
-
- Resolved
-
-
JDK-4391320 Solaris Merlin: icons in JToolBars are clipped
-
- Closed
-