Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Netbeans IDE 7.4 does not recognize Swing apps, it is looking for main method instead...

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Netbeans IDE 7.4 does not recognize Swing apps, it is looking for main method instead...

    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.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Netbeans IDE 7.4 does not recognize Swing apps, it is looking for main method instead...

    Welcome to the forum! Please read this topic to learn how to post your code correctly and other useful info for newcomers.

    Your error has nothing to do with Netbeans or recognizing your code as a Swing app. It's all about the capitalization of your package name.

  3. #3
    Junior Member
    Join Date
    Jan 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Netbeans IDE 7.4 does not recognize Swing apps, it is looking for main method instead...

    Quote Originally Posted by GregBrannon View Post
    Welcome to the forum! Please read this topic to learn how to post your code correctly and other useful info for newcomers.

    Your error has nothing to do with Netbeans or recognizing your code as a Swing app. It's all about the capitalization of your package name.

    Thanks for your reply GregBrannon. : )

Similar Threads

  1. NetBeans IDE GlassFish Environment Relative Paths. Or is it?
    By rjpool@btinternet.com in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 25th, 2013, 02:31 PM
  2. Why it run in Netbeans(7,3,1) IDE but not with jar (in side dist folder)
    By simonongsk in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 23rd, 2013, 04:05 AM
  3. Accesing Old Projects In NEtBeans IDE
    By Farmer in forum Java IDEs
    Replies: 0
    Last Post: May 22nd, 2012, 12:13 PM
  4. How to configure context.xml in netbeans IDE?
    By tangara in forum Java IDEs
    Replies: 1
    Last Post: January 5th, 2012, 11:18 PM
  5. Problem with java swing JButton in Netbeans IDE
    By vrp in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 12th, 2011, 11:38 PM