-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.2.0
-
x86
-
windows_95
Name: rm29839 Date: 07/10/98
Use the supplied Swing 1.02 applet to create a JFrame with a
simple JPanel of buttons. The 'Load' button is resized correctly to
the width of the 'Preprocessing parameters' button.
Now drag/resize the JFrame and the 'Load' button reverts to
its minimum size despite the fact that the minimum size
has been reset to equal that of the 'Preprocessing parameters'!!
Applet generated and run under the Symantec 2.5 PDE devel
environment.
/*
A basic extension of the com.sun.java.swing.JApplet class
*/
import com.sun.java.swing.*;
import java.awt.*;
public class JApplet1 extends JApplet
{
private JFrame controlFrame = null;
private JButton loadButn = null;
private JButton preprocButn = null;
private JButton dataStoreButn = null;
private JButton runButn = null;
private JButton stopButn = null;
private JButton inFileOKButn = null;
public void init()
{
JPanel control_board = new JPanel();
controlFrame = new JFrame("WIB");
// set up a panel containing the main controls
composeControlBoard(control_board);
// This code is automatically generated by Visual Cafe when you add
// components to the visual environment. It instantiates and initializes
// the components. To modify the code, only use code syntax that matches
// what Visual Cafe can generate, or Visual Cafe may be unable to back
// parse your Java file into its visual environment.
//{{INIT_CONTROLS
getContentPane().setLayout(null);
setSize(426,266);
//}}
/* Tidy up.
*/
controlFrame.getContentPane().add("Center", control_board);
controlFrame.pack();
controlFrame.show();
// force buttons to correct appearance
loadButn.setPreferredSize(preprocButn.getSize() );
loadButn.setMinimumSize(preprocButn.getSize() );
loadButn.setSize(preprocButn.getSize() );
dataStoreButn.setSize(preprocButn.getSize() );
runButn.setSize(stopButn.getSize() );
repaint();
}
/* Lay out the control panel.
*/
private void composeControlBoard (JPanel control_board)
{
JPanel RS_panel = new JPanel();
/* Layout the panel.
*/
// set up the components
loadButn = new JButton("Load...");
loadButn.setBackground(Color.lightGray);
loadButn.setAlignmentX(Component.LEFT_ALIGNMENT);
preprocButn = new JButton("Pre-processing Parameters...");
preprocButn.setBackground(Color.lightGray);
preprocButn.setAlignmentX(Component.LEFT_ALIGNMENT);
dataStoreButn = new JButton("Oil Slick Datastore");
dataStoreButn.setBackground(Color.lightGray);
dataStoreButn.setAlignmentX(Component.LEFT_ALIGNMENT);
runButn = new JButton("Run");
runButn.setBackground(Color.lightGray);
runButn.setEnabled(false);
stopButn = new JButton("Stop");
stopButn.setBackground(Color.lightGray);
stopButn.setEnabled(false);
// nest the run and stop buttons in their own panel
RS_panel.setLayout(new BoxLayout(RS_panel, BoxLayout.X_AXIS) );
RS_panel.add(runButn);
RS_panel.add(Box.createGlue() );
RS_panel.add(stopButn);
RS_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
// lay out the control board components
control_board.setLayout(new BoxLayout(control_board,
BoxLayout.Y_AXIS) );
control_board.add(loadButn);
control_board.add(preprocButn);
control_board.add(dataStoreButn);
control_board.add(RS_panel);
control_board.add(Box.createGlue() );
/* Tidy up.
*/
control_board.setMaximumSize(control_board.getPreferredSize() );
}
}
(Review ID: 34880)
======================================================================
- relates to
-
JDK-4374833 BoxLayout behaves differently with JFrame, JPanel and JSplitPane
-
- Closed
-