// Last edited on 2001-05-15 22:48:36 by mc726 // Layout para interface gráfica com usuário import java.applet.Applet; import java.io.*; import java.awt.*; import PlinPainelDeFerramentas; public class PlinLayout extends GridBagLayout { Applet raiz; int maxX, maxY; static int REST = GridBagConstraints.REMAINDER; public PlinLayout(Applet z, int nX, int nY) { raiz = z; maxX = nX; maxY = nY; raiz.setLayout(this); } // Adds a new component to the interface // public void acrescentaComponente( Component obj, double wx, double wy, int gx, int nx, int gy, int ny, int fill, int anchor ) { GridBagConstraints c = new GridBagConstraints(); c.gridx = gx; c.gridwidth = (gx + nx >= maxX ? REST : nx); c.gridy = gy; c.gridheight = (gy + ny >= maxY ? REST : ny); c.fill = fill; c.anchor = anchor; c.weightx = wx; c.weighty = wy; this.setConstraints(obj, c); raiz.add(obj); } }