Java awt Package Border Layout Example 1


	import java.awt.*;
	public class BorderLayout1
	{
		public static void main(String args[])
		{
			Frame f = new Frame();
			Label labelTop = new Label("This is North");
			labelTop.setFont(new Font("Serif", Font.ITALIC, 36));
			labelTop.setForeground(Color.white);
			labelTop.setBackground(Color.black);
			f.add(labelTop, BorderLayout.NORTH);
			Label labelBottom = new Label("This is South");
			labelBottom.setFont(new Font("Monospaced", Font.BOLD, 18));
			labelBottom.setForeground(Color.white);
			labelBottom.setBackground(Color.black);
			f.add(labelBottom, BorderLayout.SOUTH);
			f.setSize(300,300);
			f.setVisible(true);
		}
	}

Comments