BorderPanel -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // BorderPanel.java Authors: Lewis/Loftus // // Solution to Programming Project 9.1 // // Represents the panel in the LayoutDemo program that demonstrates // the border layout manager. //******************************************************************** / import java.awt.*; import javax.swing.*; i public class BorderPanel extends JPanel { //----------------------------------------------------------------- // Sets up this panel with a button in each area of a border // layout to show how it affects their position, shape, and size.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //-----------------------------------------------------------------public BorderPanel() { setLayout (new BorderLayout()); setBackground (Color.green); JButton b1 = new JButton ("BUTTON 1"); JButton b2 = new JButton ("BUTTON 2"); JButton b3 = new JButton ("BUTTON 3"); JButton b4 = new JButton ("BUTTON 4"); JButton b5 = new JButton ("BUTTON 5"); add (b1, BorderLayout.CENTER); add (b2, BorderLayout.NORTH); add (b3, BorderLayout.SOUTH); add (b4, BorderLayout.EAST); add (b5, BorderLayout.WEST); } }...
View Full Document

Ask a homework question - tutors are online