Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

61 views
Skip to first unread message

tobleron

unread,
Sep 25, 2008, 9:27:59 AM9/25/08
to
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

}

GArlington

unread,
Sep 25, 2008, 10:12:36 AM9/25/08
to
On Sep 25, 2:27 pm, tobleron <bud...@yahoo.com> wrote:
> 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...

tobleron

unread,
Sep 25, 2008, 11:23:21 AM9/25/08
to
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 ?

Lew

unread,
Sep 25, 2008, 7:59:10 PM9/25/08
to

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

tobleron

unread,
Sep 26, 2008, 1:59:11 AM9/26/08
to

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

tobleron

unread,
Sep 26, 2008, 3:03:25 AM9/26/08
to

"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 ?

Sabine Dinis Blochberger

unread,
Sep 26, 2008, 5:12:24 AM9/26/08
to
tobleron wrote:

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.

tobleron

unread,
Sep 27, 2008, 8:53:33 AM9/27/08
to
On Sep 26, 5:12 pm, Sabine Dinis Blochberger <no.s...@here.invalid>
wrote:

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.

tobleron

unread,
Sep 28, 2008, 10:49:08 AM9/28/08
to

Help please...

John B. Matthews

unread,
Sep 28, 2008, 3:14:36 PM9/28/08
to
In article
<35851572-f8ed-4413...@25g2000prz.googlegroups.com>,
tobleron <bud...@yahoo.com> wrote:

> > 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.

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>

--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews

tobleron

unread,
Sep 29, 2008, 1:20:37 PM9/29/08
to
On Sep 29, 3:14 am, "John B. Matthews" <nos...@nospam.invalid> wrote:
> In article
> <35851572-f8ed-4413-8573-0a784f200...@25g2000prz.googlegroups.com>,

Hmm... it was helpful. But the warning still appears. I don't have any
idea about this. But, thanks anyway.

0 new messages