aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Saving JTextArea's Content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Saving JTextArea Watch "Saving JTextArea New topic
Author

Saving JTextArea's Content

Dan Hoddinott
Greenhorn

Joined: Jun 11, 2004
Posts: 5
Hello, Good People,

I know I'm probably giving it up about my acute newbie-ism with this question, but here goes anyway... I am trying to save the contents of a JTextArea using a file menu system in a case where the JTextArea is not the only element in the program.

As an example, the file menu system works fine if the JTextArea is the main element in the program (such as in the case of a simple text editor), but what I'm trying to do is save text that arrived in a JTextArea from a JTextField or other sources.

Is this do-able ... or does the menu act only on the JFrame itself?

Any help would be appreciated.

Dan
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Hi,

Welcome to JavaRanch!

There's really no such thing as "the file menu system" (in pure Java, anyway; if you're using some sort of application framework outside of the core Java APIs, there may well be.) You create a JMenuBar object, and JMenu objects, and JMenuItem objects, and you can tell each JMenuItem object what should happen when it is selected. So the answer to your question is that yes, it's absolutely possible. The sky's wide open.


[Jess in Action][AskingGoodQuestions]
Dan Hoddinott
Greenhorn

Joined: Jun 11, 2004
Posts: 5
Originally posted by Ernest Friedman-Hill:
Hi,

Welcome to JavaRanch!

There's really no such thing as "the file menu system" (in pure Java, anyway; if you're using some sort of application framework outside of the core Java APIs, there may well be.) You create a JMenuBar object, and JMenu objects, and JMenuItem objects, and you can tell each JMenuItem object what should happen when it is selected. So the answer to your question is that yes, it's absolutely possible. The sky's wide open.
Dan Hoddinott
Greenhorn

Joined: Jun 11, 2004
Posts: 5
Thanks for responding. Forgive my imprecision of expression (I am a newbie, after all), but what I meant to convey by the clearly unwise "file menu system" reference is that a JMenuBar had indeed been created and that the individual JMenuItems do exactly as advertised in the simple text editor example mentioned. What I'm looking for, then, is the method that would target the JTextArea in the other example I mentioned so that the JMenuItems can act on it.

Again, any help greatly appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Saving JTextArea's Content