facebook

Automatic Event code problems

  1. MyEclipse Archived
  2.  > 
  3. Matisse/Swing UI Development
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #259317 Reply

    Richly
    Participant

    When I add code for an event, e.g., ActionPerformed, from the Properties|Events, I click on <none> in the appropriate line, and then as soon as I press Enter, the source editor bounces around for a while (entertaining to watch…the first few times), highlights the new, automatically generated code and then scrolls to the bottom of the file, so I have to scroll up to find the highlighted code.

    If I then decide to remove the code, I go back to the Properties|Events page, click on the … on the ActionPerformed line, and select Remove from the form that pops up. Most — but not all — of the generated code will be removed. The remaining code, e.g.,
    private void jButton1ActionPerformed(
    generates a couple of errors when the class is saved. The same thing happens if I simply remove the name from the line by backspacing or clicking and pressing delete, i.e., without bringing up the form.

    Best regards,
    Richard

    #259327 Reply

    Riyad Kalla
    Member

    Richard,
    Thank you for the detailed report, I was able to reproduce the problems right away.

    #259416 Reply

    Richly
    Participant

    More in the same area: put a button onto a form, say jButton1, and click to add an ActionPerformed. Then change the name of the button to okButton. The result is not pretty! Go back to the Properties|Events. The name of the handler hasn’t changed, but click on the ActionPerformed’s …, and on the pop-up you will see that the name of the handler has changed, so click OK. Then look at the source code: you’ll see that jButton1ActionPerformed is still there, but there is now an error “The method okButtotnActionPerformed(ActionEvent) is undefined for the type new ActionListener(){}”.

    Best regards,
    Richard

    #259417 Reply

    Richly
    Participant

    P.S. Then delete the button from the form. You’d expect its handlers to go away, too. They don’t.

    #259557 Reply

    Luc
    Member

    The problems appears when some option of the Java code formatter are set. It appears the critical option is the one managing the position of the the opening brace for a method declaration.
    A workaround is to use the default formatter settings, or at least set ‘constructor declaration’ to ‘Same line’ in the Brace tab.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Automatic Event code problems

You must be logged in to post in the forum log in