I'm currently developing a GUI interface in Java Swing, to an application that was running in the console. The GUI interface is ready with all the necessary fields, etc. My initial idea was to use the modularity that Java offers and re-use the old console program, by calling the specific classes inside the actionPerformed in the GUI. Can I really do that? The other question is that in the console application, there is a menu that calls for inputs. There is a method clear() to "clear" the screen by printing " " (blank spaces). Is there any similar method in the Swing... I mean to clear the screen from the inputs entered?
I think the answer to your first question is yes. The only problem may be in accessing the other classes. If they are in the same directory, then no problem should occur. But if not, then you would have to add them to your CLASSPATH and possibly use an import statement.
2nd question: JTextComponent has a method public void setText(String t) JTextArea, JTextField, and JEditorPane inherit from JTextComponent so these components can use this method. To clear any JTextComponent just use setText("");
Examples: JTextArea textarea = new JTextArea (); textarea.setText(""); //clears it JTextField textfield = new JTextField(); textfield.setText(""); //clears it