aspose file tools*
The moose likes Beginning Java and the fly likes Pasting into a JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Pasting into a JTextArea" Watch "Pasting into a JTextArea" New topic
Author

Pasting into a JTextArea

Joe Lemmer
Ranch Hand

Joined: Oct 24, 2008
Posts: 171
Hi there,

I have made a GUI for a v. small application which has some JTextAreas for entering information. Sometimes, I would like to be able to paste the information in from (say) notepad. However, when I right click on the mouse there is no option to do this. Does anybody know how I might set things up so I can paste into the JTextAreas?

Cheers

Joe


OCPJP 85%
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18114
    
    8

Normally you would just press Control-V. Does that not work?
Clyde DeSouza
Greenhorn

Joined: Mar 16, 2009
Posts: 26
Normally you would just press Control-V. Does that not work?


That is pasting using keyboard if you want a right click option you have to create Popupmenus no good for Application.



If you are talking about popup menus, then until you add a popup menu or add a mouse listener, a JTextArea by default should not have any options.


You can read this document if you do not know to add popupmenu
http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html
Joe Lemmer
Ranch Hand

Joined: Oct 24, 2008
Posts: 171
Hi there

Thanks guys. Yes ctrl v does work. I'm so used to using the mouse I didn't think of that. Sorry about the silly question!
Clyde DeSouza
Greenhorn

Joined: Mar 16, 2009
Posts: 26
that is not good programming practice to use ctrl-V for GUI application mouse is essentially important so while designing must be aware of put both accessibility through keyboard also and through mouse also! in GUI application!
James Mathews
Greenhorn

Joined: Mar 16, 2009
Posts: 7
Not required Mouse popupmenu!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pasting into a JTextArea
 
Similar Threads
JComboBox
JTextArea LineWrap
JList Item Not Getting Mouse Clicks
Problems resizing using a split pane divider.
JTextArea