package caltool.view; import javax.swing.*; import java.awt.*; /**** * * BoxPanel is an implementation of JFC's Box as a JComponent, so alignment * operations can be performed on it. The only real work is in the * re-implementations of createHorizontalBox and createVerticalBox, which * return new instances of this JComponent-extending class instead of the * Component-extending Box. * * This BoxPanel class is obsoleted by the 1.4 upgrade of Box, so BoxPanel is * only needed in 1.3 code and earlier. * */ public class BoxPanel extends JPanel { public BoxPanel() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); } /** * See Box.createHorizontalBox. */ public static BoxPanel createHorizontalBox() { BoxPanel rtn = new BoxPanel(); rtn.setLayout(new BoxLayout(rtn, BoxLayout.X_AXIS)); return rtn; } /** * See Box.createVerticalBox. */ public static BoxPanel createVerticalBox() { BoxPanel rtn = new BoxPanel(); rtn.setLayout(new BoxLayout(rtn, BoxLayout.Y_AXIS)); return rtn; } /** * See Box.createHorizontalStrut. */ public static Component createHorizontalStrut(int size) { return Box.createHorizontalStrut(size); } /** * See Box.createVerticalStrut. */ public static Component createVerticalStrut(int size) { return Box.createVerticalStrut(size); } /** * See Box.createHorizontalGlue. */ public static Component createHorizontalGlue() { return Box.createHorizontalGlue(); } /** * See Box.createVerticalGlue. */ public static Component createVerticalGlue() { return Box.createVerticalGlue(); } }