All pastes #9959 Raw Edit

Something

public java v1 · immutable
#9959 ·published 2005-04-21 01:41 UTC
rendered paste body
/** MAKE A dir named "1jimages" on the root of your C drive, and through some gifs in it that are named like the code...I'm a newbie, this is from a book, so lmk if this is not efficent, i HAVE done it other ways, this is just a simple one had lying around....*/import java.awt.*;import java.awt.event.*;// Java extension packagesimport javax.swing.*;public class LabelTest extends JFrame {   private JLabel label1, label2, label3;   // set up GUI   public LabelTest()   {      super( "Testing JLabel" );      // get content pane and set its layout      Container container = getContentPane();      container.setLayout( new FlowLayout() );      // JLabel constructor with a string argument      label1 = new JLabel( "Label with text" );      label1.setToolTipText( "This is label1" );      container.add( label1 );      // JLabel constructor with string, Icon and      // alignment arguments      Icon bug = new ImageIcon( "C:/1jimages/bug1.gif" );      label2 = new JLabel( "Label with text and icon",         bug, SwingConstants.LEFT );      label2.setToolTipText( "This is label2" );      container.add( label2 );      // JLabel constructor no arguments      label3 = new JLabel();      label3.setText( "Label with icon and text at bottom" );      label3.setIcon( bug );      label3.setHorizontalTextPosition( SwingConstants.CENTER );      label3.setVerticalTextPosition( SwingConstants.BOTTOM );      label3.setToolTipText( "This is label3" );      container.add( label3 );      setSize( 275, 170 );      setVisible( true );   }   // execute application   public static void main( String args[] )   {       LabelTest application = new LabelTest();      application.setDefaultCloseOperation(         JFrame.EXIT_ON_CLOSE );   }}  // end class LabelTest