// // $Id: Constrainer.java,v 1.1 1998/07/12 13:34:47 min Exp $ // // Small class to help me with the GridBagConstraints. The "Layout" // class is better, don't use this. It's still around because the // Bezier applet uses it. // package myutil; import java.awt.*; public class Constrainer { private GridBagConstraints gc = new GridBagConstraints(); public Constrainer() {} public void constrain(Container container, Component component, int grid_x, int grid_y, int grid_width, int grid_height, int fill, int anchor, double weight_x, double weight_y, int top, int left, int bottom, int right) { gc.gridx = grid_x; gc.gridy = grid_y; gc.gridwidth = grid_width; gc.gridheight = grid_height; gc.fill = fill; gc.anchor = anchor; gc.weightx = weight_x; gc.weighty = weight_y; if (top + bottom + left + right > 0) gc.insets = new Insets(top, left, bottom, right); ((GridBagLayout) container.getLayout()).setConstraints(component, gc); container.add(component); } // constrain public void constrain_button(Container container, Component component, int grid_x, int grid_y) { constrain(container, component, grid_x, grid_y, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, 0.3, 0.0, 2, 2, 2, 2); } // constrain_button } // Constrainer class