Student having troubles programming a swing application
Hello I've recently decided to build my first GUI application and I have run into a bit of a snag. You see I'm going through a learn as you go approach by reading the tutorial chapters and then applying them to my code. I write one program called "GUIcrap" to just fool around with various swing methods and another to which I apply these methods. I haven't gotten far so the two programs look exactly identical except for the following:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclass GUIcrapFrameimplements ActionListener{
private String labelPrefix ="Number rolled: ";
final String LOOKANDFEEL ="System";
final JLabel label =new JLabel(labelPrefix +"0");
privateint numClicks = 0;
public GUIcrapFrame(){
initLookAndFeel();
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame =new JFrame("DiceTool");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
SwingApplication app =new SwingApplication();
Component contents = app.createComponents();
frame.getContentPane().add(contents, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
and
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclass DicetoolGUIimplements ActionListener{
private String labelPrefix ="Number rolled: ";
final String LOOKANDFEEL ="System";
final JLabel label =new JLabel (labelPrefix +" 0 ");
privateint numClicks = 0;
public DicetoolGUI(){
initLookAndFeel();
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame =new JFrame("DiceTool");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
SwingApplication app =new SwingApplication();
Component contents = app.createComponents();
frame.getContentPane().add(contents, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
The odd thing about it is that I get a compile error for the Dicetool program but not the GUIcrap program due to the compilers inability to find SwingApplication. I would like to state again that with the exception of this code the rest is exactly like each other to the format of the whitespace.
Did I make some stupid error which I'm going to shoot myself for overlooking?

