I'm just starting to work with Java Swing again, and I have the same problem as last time. I want to write a program that reads user input, executes an algorithm, and displays the result. The program should work with two different user interfaces (console and GUI with Java Swing).
Currently, I have a class package with an algorithm (I can just pass the user input and get the result), a class that contains the main class, a class for the console interface and a class for the graphical interface (which extends from JFrame). Some code:
public class Algorithm {
}
public class MainClass {
public static void main(...) {
Algorithm algorithm = new Algorithm();
algorithm.execute(user input);
algorithm.getResult();
}
}
public class GUI extends JFrame implements ActionListener {
}
, , (, , ) .
GUI GUI?
ActionListener MainClass ( )? , ?
?: D