Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cut and Paste, what is the difference with ContentPane and a Panel?  RSS feed

 
Matt Midcap
Sheriff
Posts: 440
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy all,
Why is it that I can cut, copy and paste in a JTextArea that is added to a JPanel but I can NOT do the same when a JTextArea is added to a Container content pane of a JFrame?
Thanks in advance,
Matt
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In the literature I have read generally JTextArea is
added to a JScrollPane (to gain the advantage of scrolling).
The JScrollPane is then added to the JFrame. In this manner
the literature suggested no reason why Cut, Copy, Paste should
not be supported.
However, in your case it seems like you are adding the
JTextArea to the JFrame directly. Is this true?
regds.
- satya
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Matt,
Not sure exactly what you are doing. The following works for me using JDK1.2.

Regards,
Manfred.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

yes, it does. I also checked the Cut (Control-X)
Copy (Control-C) and Paste (Control-V) operations
using the above code, with the accelerator keys
mentioned.
Thanks Manfred.
- satya
 
Matt Midcap
Sheriff
Posts: 440
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help. I did a little more investigation and I found out that the class is not a JFrame but is being extended from a JDialog. I did a little test and I can not cut and paste from a JDialog. Looks like a little refactoring is in order...
Thanks again!
Matt
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!