This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes sun solaris , copy keyboard button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "sun solaris , copy keyboard button" Watch "sun solaris , copy keyboard button" New topic
Author

sun solaris , copy keyboard button

khaja mohideen
Greenhorn

Joined: May 20, 2011
Posts: 12
Hi

In ay java application , where i want to copy a text , with "Copy" special button in sun solariskeyboard , it does not work

but ctrl+c is working , any ideas ?

I use JTextArea in my application

Regards
kmm
khaja mohideen
Greenhorn

Joined: May 20, 2011
Posts: 12
hi

is there a way to map the keys in java i..e

if the user presses "Copy" button in sun keyboard , is it possible to translate it to "Ctrl+c" within java application

i know i can create a key listener , but after i get the Copy key , how do i map to "Ctrl+c"

or may be i can say

JTextArea area;
area.getselectedtext

and then where should i put this text in order for this text to be available for writing into say for ex. texteditor ?

regards
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

We first need to know what key code that button is:
Once you know that you can use it in a key stroke; check how key binding works in Java.

As for the actual copying, JTextArea inherits method copy() from JTextComponent. All you need to do is call that.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
khaja mohideen
Greenhorn

Joined: May 20, 2011
Posts: 12
Hi

thankyou for your reply

KeyStroke ksF12 = KeyStroke.getKeyStroke("F12");
displayArea.getInputMap().put(ksF12, "copy");

KeyStroke ksF11 = KeyStroke.getKeyStroke("F11");
displayArea.getInputMap().put(ksF11, "paste");

the code above works for windows
what is the equivalent of "copy" , "paste" in Sun Solaris , how can i find it ?

although for Sun Solaris , i found the following with xev
keycode 131 = F16 F16 SunCopy
keycode 132 = F18 F18 SunPaste

Regards
khaja mohideen
Greenhorn

Joined: May 20, 2011
Posts: 12
Rob Spoor wrote:We first need to know what key code that button is:
Once you know that you can use it in a key stroke; check how key binding works in Java.

As for the actual copying, JTextArea inherits method copy() from JTextComponent. All you need to do is call that.


JTextArea --> copy() , does not work in Solaris !!!
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

khaja , please BeForthrightWhenCrossPostingToOtherSites

https://forums.oracle.com/forums/thread.jspa?threadID=2288717


luck, db
There are no new questions, but there may be new answers.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2155
    
    7
is there a way to map the keys in java i..e if the user presses "Copy" button in sun keyboard , is it possible to translate it to "Ctrl+c" within java application


Swing uses Key Bindings to map KeyStrokes to an Action. You can map any KeyStroke to any existing Action.

See Key Bindings for a list of all the bindings for a given component and an example of how to share an Action with a different binding.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

khaja mohideen wrote:JTextArea --> copy() , does not work in Solaris !!!

Does Solaris have an actual system clipboard? If the system clipboard is not available, usually an IllegalStateException is thrown when retrieving the clipboard. However, the implementation behind the copy() method catches that IllegalStateException, then calls UIManager.getLookAndFeel().provideErrorFeedback(c). If that call does nothing, then indeed nothing will happen at all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sun solaris , copy keyboard button
 
Similar Threads
Shallow Copying And Deep copying ?
Deploying in Websphere!
Sun ONE Application Server 7 plugin
Trying to get jar to run GUI
my first activity runing happen error:Uncaught handler: thread main exiting due to uncaught exceptio