The Artima Developer Community
Sponsored Link

Java Answers Forum
Super dupper questions about GUI!

1 reply on 1 page. Most recent reply: Feb 26, 2002 8:23 AM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic    
Flat View: This topic has 1 reply on 1 page
Eduardo

Posts: 21
Nickname: eduardo
Registered: Feb, 2002

Super dupper questions about GUI! Posted: Feb 26, 2002 7:54 AM
Reply to this message Reply
Advertisement
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?

Thanks!


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Super dupper questions about GUI! Posted: Feb 26, 2002 8:23 AM
Reply to this message Reply
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

Flat View: This topic has 1 reply on 1 page
Topic: sorting arrays Previous Topic    

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use