aspose file tools*
The moose likes Beginning Java and the fly likes Application Trouble Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Application Trouble" Watch "Application Trouble" New topic
Author

Application Trouble

Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
I'm trying to write a database querying application. I've never written an application before, and i can't get my application to appear.
the code compiles fine and appears to run properly. can anyone help?
Here's the code

edited by Dave to format the code with code tags

[ January 30, 2002: Message edited by: Dave Vick ]

Pete<br />"Reality is an illusion <br />brought on by a lack of <br />drink, drugs and smut"
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Where to start???
First you are writing an application - not an Applet. the init() method is something that applets use - because the browser uses that method to initiate the applet. An application needs to use a constructor to create the instance.
Next, using GridBagLayout on your first application is a masochistic thing to do. I commented that stuff out till later.
Theh, when you create a Frame - you need to give it a size bigger than 0x0.
Play with this.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Peter
You define lots of stuff in your init( ) method but it is never called in the code you supplied. Is there more code?
Also, in the code you supply you never instantiate the variables gbMain or gbcMain so in the init method you're going to get a null pointer exception when you try to use them.
At the end of the init method you have:
add(options);
because it is a JFrame you need to add to the contentPane so it should be changed to
getContentPane().add(options);
The following code compiles and displays a really small jframe that you have to expand manually (you can set the size of some its internal components and it should display so you can see it).

hope that helps
[ January 30, 2002: Message edited by: Dave Vick ]

Dave
Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
Thank's for the help guys, but i decided to leave the class as an applet and write a simple application to create a frame with the class inside.
Pete
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Application Trouble
 
Similar Threads
JComboBox
JComboBoxes
help on dynamic select box
JComboBox Action Issues.
Help with drawing random shapes based on JComboBox