Hello there,
As the title state's, my IDE doesn't seem to recognize that my program is a Swing app.
I get the following error message when I run the app: "jtabledemo.JTableDemo class wasn't found in JTableDemo project."
It compiles successfully though.
Here is the code verbatim:
package jtableDemo;
// Demonstrate JTable.
import java.awt.*;
import javax.swing.*;
/*
<applet code="JTableDemo" width=400 height=200>
</applet>
*/
public class JTableDemo extends JApplet {
/**
*/
public void init() {
try {
SwingUtilities.invokeAndWait(
new Runnable() {
public void run() {
makeGUI();
} // run()
} // Runnable()
); // invokeAndWait()
// end of try block
} catch (Exception exc) {
System.out.println("Can't create because of " + exc);
}
} // end of init() method scope
private void makeGUI() {
// Initialize column headings.
String[] colHeads = {"Name", "Telephone", "ID#" };
// Initialize data
Object [][] data = {
{"Gail", "345-5678", "865"},
{"Ken", "654-7890", "555"},
{"Viviane", "7566", "587"},
{"Melanie", "7345" ,"922"},
{"Anne", "333-4567" ,"333"},
{"John", "222-5656" ,"314"},
{"Matt", "456-6655" ,"217"},
{"Claire", "6741" ,"444"},
{"Erwin", "444-9023" ,"519"},
{"Ellen", "667-1134" ,"532"},
{"Jennifer", "999-5689" ,"112"},
{"Ed", "345-5544" ,"133"},
{"Helena", "334-6790" ,"145"}
}; //end brace of array variable: data
//Create the table
JTable table = new JTable(data, colHeads); // pass the two arrays as arguments to constructor
// Add the table to a scroll pane...thus making the table scrollable...
JScrollPane jsp = new JScrollPane(table);
// Add the scroll pane to the content pane
add(jsp);
} // end of makeGUI() scope
} // class scope
Any help is greatly appreciated!
Thanks in advance.