LabelPanel - label2 = new JLabel"Devil Right" icon...

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

View Full Document Right Arrow Icon
//******************************************************************** // Author: Lewis/Loftus // // Solution to Programming Project 8.12 //******************************************************************** / import java.awt.*; import javax.swing.*; i public class LabelPanel extends JPanel { private ImageIcon icon; private JLabel label1, label2, label3, label4; //----------------------------------------------------------------- // Displays three labels with different text/icon orientations. //----------------------------------------------------------------- public LabelPanel () { icon = new ImageIcon ("devil.gif"); label1 = new JLabel ("Devil Left", icon, SwingConstants.LEFT);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: label2 = new JLabel ("Devil Right", icon, SwingConstants.LEFT); label2.setHorizontalTextPosition (SwingConstants.LEFT); label2.setVerticalTextPosition (SwingConstants.BOTTOM); label3 = new JLabel ("Devil Above", icon, SwingConstants.LEFT); label3.setHorizontalTextPosition (SwingConstants.CENTER); label3.setVerticalTextPosition (SwingConstants.BOTTOM); label4 = new JLabel ("Devil Below", icon, SwingConstants.LEFT); label4.setHorizontalTextPosition (SwingConstants.CENTER); label4.setVerticalTextPosition (SwingConstants.TOP); add (label1); add (label2); add (label3); add (label4); setBackground (Color.cyan); setPreferredSize (new Dimension (200, 250)); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online