View Single Post
  #6 (permalink)  
Old 07-08-2007, 02:33 PM
JavaBean's Avatar
JavaBean JavaBean is offline
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
First of all you need to read/see all tutorials/demos here:

Java GUIs and Project Matisse Learning Trail
form: Homepage

The above tutorials/demos will help you in the long term even if they might not help with your current problem.

And for this problem, as far as i see the confusion is because of that you cant understand the relation between a Java form and a Java class.

First of all Netbeans GUI builder is just a tool which helps you design your GUI forms. If you do not use Netbeans GUI builder, you had to write your code without immediate visual feedback. (You will need to write codes which are written automatically by Netbeans GUI builder, and run the code to see the results. But you can see them immediately now with the help of Netbeans GUI builder.)

So without Netbeans GUI builder, the first thing you will need to do for your JDialog class is to write a class which extends JDialog class:

Code:
class MyJDialog extends JDialog { ... }
In this way, you are getting all functionality of a JDialog but also have the ability to change the behavior of this class base on your needs.

So what Netbeans GUI builder does at the background while you create a new JDialog form. (File -> New File -> Java GUI Forms -> JDialog Form)? Lets assume that you gave MyJDialog as the name of your JDialog Form. In that case Netbeans GUI builder creates two files:

MyJDialog.java -> This is what Java needs! It has a class named MyJDialog which extends JDialog just like the above code lines.

MyJDialog.form -> This is not needed by Java compiler. It is needed by Netbeans GUI builder to allow you to change your form later.

For both of these files Netbeans shows you one file and allow you to view it in two modes: Visual and Code.

When you open your JDialog, check the top left corner of the editor, you will see two buttons for these modes. When you click on "Code" button, you will see your JDialog in Code mode and i think you will understand what i mean if you already studied object oriented programming and read/watch the tutorials/demos above!

If you still can not solve your problem after these information, write the name of your JDialog class here, i will give you the lines you needed in your button action.
Reply With Quote