printing just 1 label [ newbie ]
Hi all,
I'm a beginner at Java programming, and I'm trying to draw a panel with 2 labels beside each other, but for some reason just theLabelTwo is appreaing on the screen. This is the code I have written. Does anyone know what's wrong with it?
Thanks a lot,
Andre
import java.awt.*;
import javax.swing.*;
public class TfoMessageHeaderWindow
{
public TfoMessageHeaderWindow()
{
}
public TfoMessageHeaderWindow( String paramLabelOne, String paramLabelTwo )
{
theLabelOne = new JLabel( paramLabelOne );
theLabelTwo = new JLabel( paramLabelTwo );
thePanel = new JPanel( new GridLayout( 1, 2 ) );
thePanel.add( theLabelOne );
thePanel.add( theLabelTwo );
JFrame.setDefaultLookAndFeelDecorated( true );
theFrame = new JFrame( "Tfo Message Header" );
theFrame.getContentPane().add( thePanel );
}
public void drawWindow()
{
theFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
theFrame.getContentPane().add( theLabelOne );
theFrame.getContentPane().add( theLabelTwo );
theFrame.pack();
theFrame.setVisible(true);
}
private JFrame theFrame;
private JPanel thePanel;
private JLabel theLabelOne;
private JLabel theLabelTwo;
}

