Microsoft Windows 7
Netbeans 7.0.1 with cygwin compiler / debugger
I must admit I am completely new to Java programming, and have been completely befuddled by something that should seem so simple. I am learning Java by creating a very simple POS program, but have run into a snag. I have 2 frames (spos.java / spos_customer.java).
spos.java simply has buttons that are the starting point of the program. Each button is supposed to take the user to another section of the program that they want to work with. Currently I am working on the sPOS button, which ideally will open the jframe located in spos_customer for the user to interact with.
To be quite honest, I have been searching most of the day with google trying to find just one example of a program that will open a frame from a different file using an action event listener, as well as reading tutorials I thought would help me understand the subject. In this sense I have no idea how java works or handles calling and using components in different files. I dont even know where to start =(
/*spos.java*/
private void sposActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
My question is hopefully simple to answer. What code goes in the above to call the spos_customer file and tells it to load? Is that even possible? I want to hide spos.java and show spos_customer for the user to interact with.
/*Edit*/
I figured out what I needed to do. I cant believe I looked at the answer so many times today without understanding it. java is like arabic to me, vs C++ which would be english. Apparently you dont have to "call" the other file at all, simply create an instance of the object you want from the other file.
spos_customer customerScreen = new spos_customer();
customerScreen.setVisible(true);
^^ that is what belonged there...