import java.applet.*; import java.awt.*; import java.awt.event.*; public class font_down extends Applet { Label label1, label2, label3; public void init() { setLayout(new GridBagLayout()); label1 = new Label("Label having value 1"); label1.setFont(new Font("SansSerif", Font.BOLD, 13)); constrain(this, label1, 0, 0, 1, 1, GridBagConstraints.WEST, 0, 0, 0, 0, GridBagConstraints.NONE, 0, 0); label2 = new Label("Label having value 2"); label2.setFont(new Font("SansSerif", Font.BOLD, 13)); constrain(this, label2, 0, 1, 1, 1, GridBagConstraints.WEST, 0, 0, 0, 0, GridBagConstraints.NONE, 0, 0); label3 = new Label("Label having value 3"); label3.setFont(new Font("SansSerif", Font.BOLD, 13)); constrain(this, label3, 0, 2, 1, 1, GridBagConstraints.WEST, 20, 0, 0, 0, GridBagConstraints.NONE, 0, 0); } static final void constrain(Container container, Component component, int grid_x, int grid_y, int grid_width, int grid_height, int anchor, int topPad, int leftPad, int bottomPad, int rightPad, int fill, double weightx, double weighty) { GridBagConstraints c = new GridBagConstraints(); c.gridx = grid_x; c.gridy = grid_y; c.gridwidth = grid_width; c.gridheight = grid_height; c.anchor = anchor; c.insets.top = topPad; c.insets.left = leftPad; c.insets.bottom= bottomPad; c.insets.right = rightPad; c.fill = fill; c.weightx = weightx; c.weighty = weighty; ((GridBagLayout)container.getLayout()).setConstraints(component, c); container.add(component); } } // END OF Class font_down