-
Bug
-
Resolution: Fixed
-
P4
-
1.2.2, 1.4.2
-
b11
-
x86
-
windows_nt, windows_xp
Name: jk109818 Date: 06/19/2000
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
Adding buttons in a JToolBar after a JSeparator will push the button to the far
right (for a toolbar anchored at the top).
I have tried may different methods (including overriding the LayoutManager for
JToolBar, adding a Box.createGlue() after the separator), but nothing "logical"
keeps the buttons added after the separator next to the separator.
Here is a source file showing the behavior.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ToolBarTest
{
ToolBarTest()
{
JFrame frame = new JFrame("Troy's ToolBarTest");
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});
JToolBar toolBar = buildToolBar();
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(toolBar, BorderLayout.NORTH);
frame.getContentPane().add(new JPanel(), BorderLayout.CENTER);
frame.setSize(400,200);
frame.show();
}
JToolBar buildToolBar()
{
JToolBar toolBar = new JToolBar();
toolBar.add(new JButton("button 1"));
toolBar.add(new JButton("button 2"));
toolBar.add(new JSeparator(SwingConstants.VERTICAL));
toolBar.add(new JButton("button 3"));
return toolBar;
}
public static void main(String[] args)
{
ToolBarTest test = new ToolBarTest();
}
}
(Review ID: 105252)
======================================================================
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
Adding buttons in a JToolBar after a JSeparator will push the button to the far
right (for a toolbar anchored at the top).
I have tried may different methods (including overriding the LayoutManager for
JToolBar, adding a Box.createGlue() after the separator), but nothing "logical"
keeps the buttons added after the separator next to the separator.
Here is a source file showing the behavior.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ToolBarTest
{
ToolBarTest()
{
JFrame frame = new JFrame("Troy's ToolBarTest");
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});
JToolBar toolBar = buildToolBar();
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(toolBar, BorderLayout.NORTH);
frame.getContentPane().add(new JPanel(), BorderLayout.CENTER);
frame.setSize(400,200);
frame.show();
}
JToolBar buildToolBar()
{
JToolBar toolBar = new JToolBar();
toolBar.add(new JButton("button 1"));
toolBar.add(new JButton("button 2"));
toolBar.add(new JSeparator(SwingConstants.VERTICAL));
toolBar.add(new JButton("button 3"));
return toolBar;
}
public static void main(String[] args)
{
ToolBarTest test = new ToolBarTest();
}
}
(Review ID: 105252)
======================================================================
- duplicates
-
JDK-4869216 JToolBar.Separator is huge in Windows LAF
-
- Closed
-