Lexi Turgeon wrote:I have many errors with my variables and my "nameInputActionPerformed" method. Does anyone know where I went wrong?
Lexi Turgeon wrote:My errors from my compiler are:
error: reached end of file while parsing
Lexi Turgeon wrote:I have edited a few things but come up with some compiler issues that I do not understand.
Here is what my compiler says is wrong:
The eaiest way to do that is to indent the code correctly, which you can probably do with a ctrl combination in NetBeans, and hover your mouse over a { and see which } changes colour. Your indentation in the posted code is not quite consistent and that makes it easy to mismatch {} without noticing.Norm Radder wrote:. . . Check that the {}s are properly paired.
Lexi Turgeon wrote:
The line " nameOutput.setText(newName); " has the "newName" underlined in saying it is wrong. I am trying to call that from my "convertNameActionPerformed". Why is what I put wrong and how would I fix it?
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
I think that is code written automatically by NetBeans and it defaults to using the fully‑qualified name of the class. It may be impossible to change that code without moving it out of NetBeans.Cooper Gates wrote:. . . I bet the function line doesn't need all the . operators, it could be
private void nameInputActionPerformed(ActionEvent evt)
Why? The fields should have been initialised to “real” values before that code it executed. If there is a null anywhere, it will be necessary to alter the source code to correct the error. I would think it is correct to wait for an exception and assume all is well if no exception is thrown.. . . You also should check for a null before reaching into a member. . . .
That is a style matter where there are differing opinions.Cooper Gates wrote:. . . you don't need to declare a string to hold getText(), it can go in immediately.
Yes, all that code is generated automatically by the GUI designer when you give it the placement of the Components. When you click a component and tell it to add a Listener, it writes the appropriate method automatically. I think the GUI designer will cause most of that code to revert to its previous state if you try to change anything.Lexi Turgeon wrote:All the code is generated when I create the design of the project I want. . . .
All things are lawful, but not all things are profitable.
Cooper Gates wrote:
private void nameInputActionPerformed()
{
if (nameInput != null && nameOutput != null)
nameOutput.setText(nameInput.getText());
}
Knute Snortum wrote:I'd like to see the code for NewJApplet.init, especially line 47.
All things are lawful, but not all things are profitable.
Knute Snortum wrote:I'd like to see the code for NewJApplet.init, especially line 47.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |