Hello I am working on a Payroll application and I am using the palette to design my GUI. I have four jTextFields which are labeled as Employee Name, Hours worked, and PayRate. Three Jbuttons which are calculate, clear, and exit. I have the exit button and the clear jButtons functioning as they should. My question is how do I calculate (hours worked* payrate) JTextField2 and jTextField3 to be displayed in the jTextField4 box once I have pressed the calculate button? any help is appreciated. The main reason for using the palette is I am not good at coding.
You need to add actionListeners to buttons to perform actions when button is clicked. You have already added such listeners for the 'Exit' button. You need to do similarly for the 'Calculate' button.
You can read more about event handlers here
Also, provide meaningful names to the variables. For example, instead of jTextField1, you can have txtHoursWorked. Likewise, jButton1, you can have btnCalculate. This provides handy information on the component name and the functionality side too.
Names like textField1 are usualy supplied automatically by the IDE. It is probably a good idea to stop using NetBeans. For one thing you won’t have all that illegible group layout code with the long lines.
posted 5 years ago
Opinions on whether or not to use programs like NetBeans or Eclipse tend to be very mixed. In my view, the advantages they offer are invaluable: syntax checking, doing the correct imports, and running and jarring the program at the click of a button, to name just a few. True, it takes some time to be able to use these programs (they never stop to look daunting), but for me, the advantages far outweigh the disadvantages. I certainly would advise any beginner to use them.
posted 5 years ago
Piet Souris wrote: . . . NetBeans or Eclipse . . . I certainly would advise any beginner to use them.
I would certainly warn any beginner against going anywhere near them. They have a steep learning curve, which will cause information overload when you need to learn programming. They hide the basic operations from the user, preventing one from understanding the instructions sent to the OS (command line).
Nobody who has not got enough experience to know what jarring is (I presume you mean creating .jar files; I have never seen that word used like that before) should go anywhere near an IDE.