Book a Demo

Author Topic: Problem importing/reverse engineering inner class  (Read 3010 times)

peterdat

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Problem importing/reverse engineering inner class
« on: November 02, 2004, 09:46:29 am »
Hello,
  I was just trying to see how EA imports java inner classes and didn't get the result I expected.  The code imported is:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class TwoButtons {
   
   JFrame frame;
   JLabel label;
   
   public static void main(String[] args) {
       TwoButtons gui = new TwoButtons();
       gui.go();
   }
   
   public void go() {
       frame = new JFrame();
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       
       JButton labelButton = new JButton("Change Label");
       labelButton.addActionListener(new LabelListener());
       
       JButton colorButton = new JButton("Change Circle");
       colorButton.addActionListener(new ColorListener());
       
       label = new JLabel("I'm a label");
       MyDrawPanel drawPanel = new MyDrawPanel();
       
       frame.getContentPane().add(BorderLayout.SOUTH, colorButton);
       frame.getContentPane().add(BorderLayout.CENTER, drawPanel);
       frame.getContentPane().add(BorderLayout.EAST, labelButton);
       frame.getContentPane().add(BorderLayout.WEST, label);
       
       frame.setSize(300,300);
       frame.setVisible(true);
   }
   
   class LabelListener implements ActionListener {
       public void actionPerformed(ActionEvent event) {
           label.setText("Ouch!");
       }
   } // close inner class
   
   class ColorListener implements ActionListener {
       public void actionPerformed(ActionEvent event) {
           frame.repaint();
       }
   } // close inner class
}

The result I got was one class for the main class (TwoButtons) and one class for only one of the inner classes (LabelListener). The other inner class is listed and an attribute in the main class (~ ActionListener: ColorListener). It is quite possible I've done something incorrectly, however I doubt it. If I have done something wrong could you please guide my in the right way to import inner classes. If I haven't done anything wrong, when might this problem be fixed. Thank you for your time.

peterdat

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Problem importing/reverse engineering inner
« Reply #1 on: November 02, 2004, 03:40:18 pm »
I've just tested the same code with argouml and it creates the classes correctly. Does anyone know how to make EA import the code correctly? Thanks.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Problem importing/reverse engineering inner cl
« Reply #2 on: November 02, 2004, 04:08:08 pm »
Hi,

I had a look at the code and found that EA will import the code correctly if you remove the "// close inner class" comment from the previous inner class.

I'm looking into fixing the problem now.

Simon

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Problem importing/reverse engineering inner cl
« Reply #3 on: November 03, 2004, 09:01:20 pm »
Hi, just confirming that this problem and some that are related to it will be fixed for build 740.  :)