File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
Swing / AWT / SWT
Help With JTabbed Pane
Joined: Dec 28, 2006
Dec 28, 2006 19:00:00
I have a
with 5 JPanels added to it. Each
has its own components like text field,
I am trying to implement Cut, Copy, Paste functionality for all these Jpanels. Ctrl+x, Ctrl+v, ctrl+c works fine as it is inbuilt with windows but when i try to implement with event hadler i am facing the problem.
public void actionPerformed(
scrollPane = (
textPane = (
would work fine provided
is the only component in th my
but that is not the case how do i find out what is the component he is copying from(may be
Otherway i tried is using getText() method that is there in textArea but again the same proble comes that is textArea is not the only component in my
In short i would like to copy everything that is selected by the mouse irespective of the component.
Please help me.
Joined: Jan 14, 2004
Dec 29, 2006 00:03:00
For an easy way see the menu code and discussion for the DragPictureDemo2 example in the
How to Use Drag and Drop and Data Transfer
tutorial: last section
Adding Cut/Copy/Paste Support
If you decide to do it on your own you might consider the
class. It has a handy getFocusedComponent method that returns the focused
It is sorta covered in the
JavaRanch Style Guide
subject: Help With JTabbed Pane
JTable in JScrollPane sizeing
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015