• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Ctrl+X,Ctrl+C,Ctrl+V not working!

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am facing an issue where in my GUI (which is developed using Swings), the short cut keys Ctrl+X,Ctrl+C,Ctrl+V keys not working for text,panel and cell fields (I didnt check for all the other fileds which can be editable).

Our servers which runs on solaris use CDE/JDS environments. (CDE- Common Desktop Env., JDS- Java Desktop System). I found the issue on CDE with look and feel set as "SYSTEMLOOKANDFEEL". When the look and changed to "METALLOOKANDFEEL", the issue is not seen. Also, On JDS machine, i dnt see the issue in both the cases.

Any help in resolving the issue is appreciated.

Thanks & Best Regards,
Santhi
 
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Santhi ch wrote:Swings


Swing is a proper noun.

Also, read your private messages.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe the LAF doesn't support those key bindings. You can try the Key Bindings app for your environment to see what binding are used.
 
Santhi Chalasani
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rob,

Thank you very much for the response. Unfortunately i dnt have access to the link you have provided.

I am working out on the alternate shortcut keys ctrl+insert,shift+insert,shift+delete instead of ctrl+c,ctrl+v,ctrl+x. Those alternate keys works fine for all the JComponents we are used in our GUI's excpet for JTable cell.

I just wanted to know whether this JTable supports these alternate shortcut keys or not. I explored alot in this front but as of now i have no clue.

Could someone send me the info like JTable component supports which lookandfeel, which version of java for which type keys in windows as well as Unix enviroments and all the stuff related to JTable component? That would really help me to resolve the issue soon.

Thank you in advance,
Santhi
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The link I provided has all the information. Try it again. I'll get back to you in a month.
 
Santhi Chalasani
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can we support both short cut keys(ctrl+x,ctrl+insert) for Copy operation at a time. Is it possible to include keyevents for both keys together?

My code as below:

myCutAction = createAction("Cut", myEditMenu, false,KeyStroke.getKeyStroke(KeyEvent.VK_X , KeyEvent.CTRL_MASK));

The above code is written for ctrl+X for copy operation.

Can we have the same code works for ctrl+insert as well for Copy operation?

Thank you in advance,
Santhi
 
Rob Spoor
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You would need a new Action object because Action objects can only contain one keystroke.

If you check out how key bindings work then you can do it with only one Action object. Key bindings map from a keystroke to some key, and from this key to an Action. This allows one Action to be mapped to from multiple keystrokes, and this is just what you want.
 
Santhi Chalasani
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rob,

Thanks for your response. I understood how keybinding works...but i dnt know how to implement the same in code.

I've tried like this...but it is working as Ctrl+Shift+Delete. but i want the code for Ctrl+X and Shift+Delete.

myCutAction = createAction("C", myEditMenu, false,
KeyStroke.getKeyStroke(KeyEvent.VK_C | KeyEvent.VK_DELETE, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK));

Please correct me.

Best Regards,
Santhi
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need 2 separate bindings. See you again in a couple of weeks when you decide to reply.

Don't you think it would be better to reply the day you post a question and get an answer?
 
Rob Spoor
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Santhi Chalasani wrote:I've tried like this...but it is working as Ctrl+Shift+Delete. but i want the code for Ctrl+X and Shift+Delete.


That's not a key binding. How To Use Key Bindings.
 
Santhi Chalasani
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rob Camick,

I am sorry for the late respone. I work on several issues depend on their priority. As this issue is of low priority i am not concentrating much on it.
I'll try to respond quickly and close the issue as early as possible.

Thank you for your support.

Hi Rob Prime,

As you mentioned yesterday, Key bindings map from a keystroke to some key, and from this key to an Action. As per my understanding, in our code CTRL+X is the key stroke which is mapping to a key "Cut" and from this key to myCutAction. Only the thing i have to do is to map keystroke CTRL+INSERT to the same key and to the same action.


Please correct me if i am wrong. I am new to Swings so it is taking some time to understand these concepts. I had visited the same url sometime back, but still i'll have a serious look into it once again.

Thank you for your support,
Santhi
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

As per my understanding, in our code CTRL+X is the key stroke which is mapping to a key "Cut" and from this key to myCutAction. Only the thing i have to do is to map keystroke CTRL+INSERT to the same key and to the same action.



I already gave you an examle of how to do that over a month ago.
 
Rob Spoor
Sheriff
Posts: 22815
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Santhi Chalasani wrote:As per my understanding, in our code CTRL+X is the key stroke which is mapping to a key "Cut" and from this key to myCutAction. Only the thing i have to do is to map keystroke CTRL+INSERT to the same key and to the same action.


There is a difference between assigning a key stroke to a single Action and using key bindings. I believe you are doing the former (action.putValue(Action.ACCELERATOR_KEY, keystroke)), and that only allows one key stroke per Action.
 
Yup, yup, yup. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic