[Help]How to start Java desktop application in NetBeans ?

T

tobleron

Hi, I'm trying to write a desktop application from the scratch by
using NetBeans IDE 6.1. I already created 2 files, which are main.java
and login.java. What I need is : when I run the application, the login
form which is called in login.java is directly launched. But I faced
errors in main.java. Please help me to fix it. Here are the codes :

---- main.java -----

package ecgterminal1;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

public class Main extends SingleFrameApplication {

@Override protected void startup() {
show(new login(this)); //ERROR : can't find symbol
}

@Override protected void configureWindow(java.awt.Window root) {
}

public static Main getApplication() {
return Application.getInstance(Main.class);
}

public static void main(String[] args) {
launch(login.class, args); //ERROR : application can't be
applied to ....
}

}


----- login.java -----

package ecgterminal1;

public class login extends javax.swing.JDialog {

public login(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}

---- code generated by netbeans here -----

public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
login dialog = new login(new javax.swing.JFrame(),
true);
dialog.addWindowListener(new
java.awt.event.WindowAdapter() {
public void
windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JButton cancel;
private javax.swing.JLabel label;
private javax.swing.JButton login;
private javax.swing.JLabel passwd;
private javax.swing.JTextField passwdTxt;
private javax.swing.JLabel userID;
private javax.swing.JTextField userIDTxt;
// End of variables declaration

}
 
G

GArlington

Hi, I'm trying to write a desktop application from the scratch by
using NetBeans IDE 6.1. I already created 2 files, which are main.java
and login.java. What I need is : when I run the application, the login
form which is called in login.java is directly launched. But I faced
errors in main.java. Please help me to fix it. Here are the codes :

---- main.java -----

package ecgterminal1;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

public class Main extends SingleFrameApplication {

  @Override protected void startup() {
        show(new login(this)); //ERROR : can't find symbol
Read the error message, what does it mean? what can it refer to?
compare what you have with what you are trying to use...
    }

    @Override protected void configureWindow(java.awt.Window root) {
    }

    public static Main getApplication() {
        return Application.getInstance(Main.class);
    }

    public static void main(String[] args) {
        launch(login.class, args); //ERROR : application can't be
applied to ....
    }

}

----- login.java -----

package ecgterminal1;

public class login extends javax.swing.JDialog {

    public login(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

---- code generated by netbeans here -----

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                login dialog = new login(new javax.swing.JFrame(),
true);
                dialog.addWindowListener(new
java.awt.event.WindowAdapter() {
                    public void
windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify
    private javax.swing.JButton cancel;
    private javax.swing.JLabel label;
    private javax.swing.JButton login;
    private javax.swing.JLabel passwd;
    private javax.swing.JTextField passwdTxt;
    private javax.swing.JLabel userID;
    private javax.swing.JTextField userIDTxt;
    // End of variables declaration

}
 
T

tobleron

The errors were :

@Override protected void startup() {
show(new login(this)); //ERROR : can't find symbol
}

public static void main(String[] args) {
launch(login.class, args); //ERROR : application can't be
applied to ....
}

The errors indicate that there is no class defined in the project. But
in fact, there is a class named "login" in login.java. Do I missed
something ?
 
T

tobleron

tobleron said:
The errors were :
@Override protected void startup() {
        show(new login(this)); //ERROR : can't find symbol
    }
public static void main(String[] args) {
        launch(login.class, args); //ERROR : application can't be
applied to ....
    }
The errors indicate that there is no class defined in the project. But
in fact, there is a class named "login" in login.java. Do I missed
something ?

Probably an import.  Is 'login' [sic] in package 'ecgterminal1'?

Class names should start with an upper-case letter.  Lower-case first letters
are for (non-constant) variables and methods.

Yes. "login" is in package "ecgterminal1".
I'll try to change the name with upper-case letter.
 
T

tobleron

tobleron said:
The errors were :
@Override protected void startup() {
        show(new login(this)); //ERROR : can't find symbol
    }
public static void main(String[] args) {
        launch(login.class, args); //ERROR : application can't be
applied to ....
    }
The errors indicate that there is no class defined in the project. But
in fact, there is a class named "login" in login.java. Do I missed
something ?
Probably an import.  Is 'login' [sic] in package 'ecgterminal1'?
Class names should start with an upper-case letter.  Lower-case first letters
are for (non-constant) variables and methods.

Yes. "login" is in package "ecgterminal1".
I'll try to change the name with upper-case letter.

"login" has been changed to "Login". But there's still error :

cannot find symbol
symbol : constructor Login(ecgterminal1.Main)
location : class ecgterminal1.Login

Any suggestion please ?
 
T

tobleron

tobleron said:
tobleron wrote:
The errors were :
@Override protected void startup() {
        show(new login(this)); //ERROR : can't find symbol
    }
public static void main(String[] args) {
        launch(login.class, args); //ERROR : application can't be
applied to ....
    }
The errors indicate that there is no class defined in the project.. But
in fact, there is a class named "login" in login.java. Do I missed
something ?
Probably an import.  Is 'login' [sic] in package 'ecgterminal1'?
Class names should start with an upper-case letter.  Lower-case first letters
are for (non-constant) variables and methods.
"login" has been changed to "Login". But there's still error :
cannot find symbol
symbol : constructor Login(ecgterminal1.Main)
location : class ecgterminal1.Login
Any suggestion please ?

Your class Login does not have a constructor like the one you're
calling. It has a constructor with two parameters.

Either write a constructor with the parameters you want, or give the
existing one all its parameters.

Hi, I've tried to fix the problem, but these new errors occurred :

Sep 27, 2008 8:45:38 PM org.jdesktop.application.LocalStorage getId
WARNING: unspecified resource Application.id using Main
Sep 27, 2008 8:45:38 PM org.jdesktop.application.LocalStorage getId
WARNING: unspecified resource Application.vendorId using
UnknownApplicationVendor

What should I do ? Please advise. Thanks in advance.
 
T

tobleron

tobleron said:
tobleron wrote:
The errors were :
@Override protected void startup() {
        show(new login(this)); //ERROR : can't find symbol
    }
public static void main(String[] args) {
        launch(login.class, args); //ERROR : application can't be
applied to ....
    }
The errors indicate that there is no class defined in the project. But
in fact, there is a class named "login" in login.java. Do I missed
something ?
Probably an import.  Is 'login' [sic] in package 'ecgterminal1'?
Class names should start with an upper-case letter.  Lower-case first letters
are for (non-constant) variables and methods.
--
Lew
Yes. "login" is in package "ecgterminal1".
I'll try to change the name with upper-case letter.
"login" has been changed to "Login". But there's still error :
cannot find symbol
symbol : constructor Login(ecgterminal1.Main)
location : class ecgterminal1.Login
Any suggestion please ?
Your class Login does not have a constructor like the one you're
calling. It has a constructor with two parameters.
Either write a constructor with the parameters you want, or give the
existing one all its parameters.

Hi, I've tried to fix the problem, but these new errors occurred :

Sep 27, 2008 8:45:38 PM org.jdesktop.application.LocalStorage getId
WARNING: unspecified resource Application.id using Main
Sep 27, 2008 8:45:38 PM org.jdesktop.application.LocalStorage getId
WARNING: unspecified resource Application.vendorId using
UnknownApplicationVendor

What should I do ? Please advise. Thanks in advance.

Help please...
 
T

tobleron

I'm unfamiliar with the Swing Application Framework, but it might help
to read/work through the tutorial with your recent changes in mind:

<http://www.netbeans.org/kb/60/java/gui-saf.html>

I imagine your code has evolved since your first post:

<http://groups.google.com/group/comp.lang.java.programmer/msg/5ace78ceb85
2c045?hl=en>

It might help to post a revised sscce:

<http://pscode.org/sscce.html>

Hmm... it was helpful. But the warning still appears. I don't have any
idea about this. But, thanks anyway.
 
Joined
May 23, 2009
Messages
1
Reaction score
0
try this, but i'm also new and not sure
java.awt.Frame parent= new java.awt.Frame();
parent=this.getMainFrame();
show(new Login(parent, true));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top