'Debugging java swing application in eclipse

I have a large application made in java swing. Its a children drawing app. I need to put some restrictions, for example, if they draw a rectangle, then they can't link it to a circle on the same page. In most of the classes below are the packages imported:

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;

I am able to run it in eclipse. What I want to do is to understand what code is getting called when we draw a rectangle, then which exact code gets called when we draw a line to link it to a circle etc.

Is it possible to do with eclipse? Please note that there are 2300 java classes in it overall and there is no documentation. To make matters worse, I am new to java. Please can someone help? If any other suggestion apart from eclipse, that will be fine too.



Solution 1:[1]

I figured this out the hard way. Hope this solution helps someone very new to Java and needs to debug/fix some issue.

What one needs to understand is that a Java application starts with a class that has a method main() as:

    class HelloWorld {
    public static void main(String[] args)
    {
        System.out.println("Hello");
    }
   }

What you can do is first find this class, put some debug messages beginning from this class and observe how the flow is as you use the application. This is the only approach that worked for as I was debugging a java app that had no documentation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SarahB