hey all, the noob is back. and with more questions that you guys will probably make fun of me for but...whatever.
I am creating a GUI design where there are four labels (it doesn't need functionality) with an OK, HELP and CANCEL button on the right side. i haven't started on the buttons yet because I've got a error already.
the error is "invalid method declaration" on the line 18 LabelFrame() part. but it's weird because this is a part where i'm still copying everything from the book (because the buttons are the real exercise). any suggestions. or do i need to finish the test program to get it to work?
Okay...Go ahead
import java.awt.FlowLayout; // specifies how components will be arranged
import javax.swing.JFrame; // provides basic window features
import javax.swing.JLabel; // displays text, images
import javax.swing.SwingConstants;
public class GUIEx extends JFrame
{
private JLabel label1; // just text (snap to grid)
private JLabel label2; // just text (show grid)
private JLabel label3; // just text (X:)
private JLabel label4; // just text (Y:)
//Label frames
public LabelFrame()
{
super( "Align" );
setLayout( new FlowLayout() ); // set frame layout
// label1
label1 = new JLabel( "Snap to Grid");
label1.setToolTipText( "Snaps onto Grid Lines");
add(label1); // adds the label to the JFrame
label1.setVerticalTextPosition(SwingConstants.LEFT);
label1.setHorizontalTextPosition(SwingConstants.TOP);
// label2
label1 = new JLabel( "Show Grid");
label1.setToolTipText( "Shows the gridlines in your workspace");
add(label2); // adds the label to the JFrame
label1.setVerticalTextPosition(SwingConstants.LEFT);
label1.setHorizontalTextPosition(SwingConstants.BOTTOM);
// label3
label1 = new JLabel( "X: ");
label1.setToolTipText( "The X axis");
add(label3); // adds the label to the JFrame
label1.setVerticalTextPosition(SwingConstants.CENTER);
label1.setHorizontalTextPosition(SwingConstants.TOP);
// label4
label1 = new JLabel( "Y: ");
label1.setToolTipText( "The Y axis");
add(label4); // adds the label to the JFrame
label1.setVerticalTextPosition(SwingConstants.CENTER);
label1.setHorizontalTextPosition(SwingConstants.BOTTOM);
} // ends JLabel constructors
} // ends class