|
Quick Lists
|
|
Bug ID:
|
4264764
|
|
Votes
|
0
|
|
Synopsis
|
JButton has wrong margin in a JToolBar with Windows LAF
|
|
Category
|
java:classes_swing
|
|
Reported Against
|
1.2.2
|
|
Release Fixed
|
1.4(merlin-beta)
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
4391320
,
4395089
|
|
Submit Date
|
23-AUG-1999
|
|
Description
|
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)
======================================================================
|
|
Work Around
|
N/A
|
|
Evaluation
|
According the the MS Windows User Experience (MS Press, 1999), Toolbar buttons should be 16x16. This should be the icon size that we work with for the LAF implementation.
We are going to do another revision of the Window LAF to bring it in line with the current implementation of the Windows UI. Our plan for ToolBars is to remove the border altogether and supprt mouse rollover borders. Also, if we have time, we will support two state buttons in the toolbar with the same LAF behavior as native Windows.
xxxxx@xxxxx 2000-04-27
This has been fixed for the next major release. However, you may have to use the rollover buttons client property on the toolbar ("JToolBar.isRollover") to see this. I'll continue to take a look at it make sure that the button borders are correct for non rollover buttons.
xxxxx@xxxxx 2000-06-01
This problem has been fixed and integrated.
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |