Results 1 to 4 of 4
Thread: Help with two java forms
- 05-02-2010, 11:04 PM #1
Member
- Join Date
- May 2010
- Posts
- 2
- Rep Power
- 0
Help with two java forms
Hello, I've found this forum after exhaustive search on the internet...
I'm trying to make two forms with the Netbeans editor. One that contains an introduction to the game and another that has the game itself. Both forms are created with the Drag/Drop features of Netbeans, with auto-generation of code. The problem is I want the program to close Display.java and open Choice.java when the user clicks on Label1 ...
I'm beginner to java and I don't know how swing works in depth .. It has been two nights for me to find out the code to do this ... can any one help me in this specific task ?
thanks
-
To learn about Swing coding, you need to read the Swing tutorials which you can find here:
Lesson: Using Swing Components (The Java™ Tutorials > Creating a GUI With JFC/Swing)
As you're finding out, there's a lot more to it than dragging and dropping.
If you want to do an action on clicking a JLable, then you'll want to add a MouseListener to that JLabel whose mousePressed method does the desired action. If you read the tutorial section on MouseListeners, you'll know what I'm talking about. Much luck!
- 05-03-2010, 12:24 AM #3
Member
- Join Date
- May 2010
- Posts
- 2
- Rep Power
- 0
Thanks .. Now that is done using automated code ...
The Problem is what is to put in the function .. I'm obviously noob in java .. but my project depends on this thingJava Code:private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) { }
waiting for your reply !
-
Again I refer you to the tutorials so you can learn how to code in Swing and how to do this specifically. We're not going to write this for you.
edit: Look into disposing your current JFrame or JDialog and displaying the new JFrame. Methods that can help include setVisible(boolean visible), dispose(), etc...Last edited by Fubarable; 05-03-2010 at 01:16 AM.
Similar Threads
-
Issues with a particular website (Java + forms)
By aromes in forum Advanced JavaReplies: 1Last Post: 04-13-2009, 03:16 AM -
Java web forms in Eclipse
By johnathan in forum Java AppletsReplies: 1Last Post: 05-23-2008, 08:36 PM -
How to make online jsp forms from Microsoft word forms in java
By jiten.mistry in forum Advanced JavaReplies: 2Last Post: 04-28-2008, 10:56 AM -
Full Forms of Java Tech
By Gajesh Tripathi in forum New To JavaReplies: 1Last Post: 10-18-2007, 09:59 AM -
Creating Sub forms in java netbeans 5.0
By java_newbie in forum NetBeansReplies: 14Last Post: 08-06-2007, 07:19 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks