Hi Folks,:)

I am a new Programmer in NetBeans. I ma creating a Desktop Application in NetBeans 6.0. Almost my Whole Application is Completed. now my Customer Request me to get Authorisation Access(Password Window) at the Startup of Application.

:S Now The problem is that i can't create a JFrame Object in FrameView subclass means main Window.

I also can't load Password JFrame Window at the Startup of Application cause it require FrameView.

So please tellme how to add a Password Window or Authorisation to my NetBeans 6.0 DesktopApplication:(

Recommended Answers

All 2 Replies

I do not want to sound rude, but you sound as classic example of drag&drop programmer that just got stack with his project because he is simply not able modify that crucial section of code need it.

I start every one of my projects with class that holds only main() method and nothing else. Something like this

package guifilereader;

/**
 * Created by IntelliJ IDEA.
 * User: Peter
 * Date: 03-Mar-2009
 * Time: 18:33:25
 */
import javax.swing.SwingUtilities;

public class GUIFileReader {

    public static void main(String[] args){

        SwingUtilities.invokeLater(new Runnable(){
           public void run(){
               ReadersGUI reader = new ReadersGUI();
               reader.init();
           }
        });
    }
}

This gives me flexibility of quickly and easily change starting frame by modifying 2-3 lines depending on import statement. Like this

SwingUtilities.invokeLater(new Runnable(){
           public void run(){
               LoginForm loginForm = new LoginForm();
               loginForm.init();
           }
        });

After that I would deploy background processes (form validation, connection to DB, retrieving DB result and acting on the result). SO if everything goes right I will open application, else return back to login frame

commented: Ahh ..... we both arrived at the same conclusion (drag n drop programmer) only via different paths, :P +7

Thanks for replay my friend,

when we click desktop application in netbeanse it gives us three files. First is exampleApp.java , exampleView.java , and Third is exampleAboutBox.java

here the exampleApp.java file is the main file that contain main method and another startup method. this file Loads the exampleView.java file.

I was think that if i load Password.java(password JFrame) instad of exampleView.java. But my friend it is NOT POSSIBLE because exampleApp.java file sends some parameter which only except exampleView.java because it extends FrameView Class

for more undersatnding i m giving you exampleApp.java file code and exampleView.java file code

exampleApp.java

package jobplacement;

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

/**
 * The main class of the application.
 */
public class exampleApp extends SingleFrameApplication {

    /**
     * At startup create and show the main frame of the application.
     */
   @Override protected void startup() {
        show(new exampleView(this));
    }

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

    /**
     * A convenient static getter for the application instance.
     * @return the instance of exampleApp
     */
    public static exampleApp getApplication() {
        return Application.getInstance(exampleApp.class);
    }

    /**
     * Main method launching the application.
     */
    public static void main(String[] args) {
        launch(exampleApp.class, args);
    }
}

exampleView.java file Code is as follows

public class exampleView extends FrameView {
 // if i create any any JFrame object here it returns Compiletime error that can't find class name <JFrame>
    public exampleView(SingleFrameApplication app) {
        super(app);
        
        initComponents();
     }
 // other code
}

my friend my deficulty is that how to i directly load my Password.java file form exampleApp.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.