How to respond to delete key in JTree

How do you catch key events in a JTree or any Java component for that matter ?

It's part of The Java Tutorial
http://java.sun.com/docs/books/tutorial/uiswing/events/index.html

Similar Messages

  • HT3986 Does anyone know how to enable the "Delete" key for logging on the Windows 7 partition on the latest iMac, via the latest Apple wireless keyboard? Many Thanks

    Hi All
    Does anyone know how to enable the "Delete" key for logging on the Windows 7 partition on the latest iMac, via the latest Apple wireless keyboard - the standard wired apple keyboard works fine via this key but not the new wireless keyboard?
    Many Thanks

    Holy crap, this fixes the issue.  At least temporarily it has.  I should add that my issue was single finger forward/back swipe stopped working on the magic mouse in Firefox since Mavericks came along.  I have been fighting this since I upgraded to Mavericks a few months ago.  Thank you, tbirdvet.  You have no idea how much easier you just made using my iMac again.
    Message was edited by: wadems

  • How to trap the Delete Key..

    Hi
    I have implemented key handler for a text area and I want to do something when the delete key is pressed, but somehow the delete key press event is never trapped.
    Any ideas?? Here is the code:
    text_area.addKeyListener(new KeyAdapter(){
    public void keyTyped(KeyEvent e){
    if(e.getKeyCode() == e.VK_DELETE){
    System.out.println("This was deltete");
    I checked in the debugger....this method is never invoked for the delete key.
    How do I trap the delete key event??
    Thank you for your time.

    I agree. Something like:
    String actionName = DefaultEditorKit.deletePrevCharAction;
    final Action deletePrevCharAction = textpane.getActionMap().get(actionName);
    Action myAction = new AbstractAction()
    public void actionPerformed(ActionEvent e)
    System.out.println("Pressing backspace...");
    deletePrevCharAction.actionPerformed(e);
    textpane.getActionMap().put(actionName, myAction);
    mrai3

  • How to repair broken delete key on wireless keyboard?

    My wireless keyboard has a stuck delete key that will not come back up ( releasing the key). I have taken it off but am not sure if there should be a spring or if the 2 clips under key are in the wrong position when placed onto the key's slot. Any one familiar with keyboards?

    Hi,
    You can forward delete by pressing down the Fn (Function) key and then afterwards (while holding down the Fn key) pressing the Backspace key. Apple does not include a dedicated Delete key because for most applications on Mac OS X, the backspace key does what a dedicated Delete key would usually do; for example, in the Pages application, deleting a table or an image in a document.
    For a list of keyboard shortcuts, such as screenshots, etc., see: http://homepage.mac.com/frakes/MOSXPT/content/keyboard.html (someone's website I found doing a quick Google search for "mac keyboard shortcuts").

  • Since I must create a folder to send questionable emails I may read or refer to later, how do I change the action of the delete key so it'll be just as easy?

    After recognizing and following the suggestions I skimmed in the Q&A, my trash is still being emptied against my wishes. Everything looked familiar involving settings, etc. I think and hope and will re-check that I've all the correct settings applied. I would like to verify; Do I have to really create a folder to send my email to instead of trash/delete if I want to view it later? If so that sucks, but I'll obviously work around it. My frustration with this matter over the years caused me to stop reading and here I am, agitated. I can probably figure out how to create a folder and MAYBE even figure out how to make it somewhat easier than it sounds to move the emails there. My biggest obstacle is learning how to program the delete key on my keyboard to send them there, because it's simply common sense to everyday users not to mention a terrible habit occurred over the many years of practicing to strike the delete key when a "I'll get to it later" email is highlighted AND without any worry knowing you can always find it in the trash because you know the last time the trash was emptied/permenantly deleted. Can you somehow make this a little more user friendly. It sucks to not be able to trust having an email when you go back to look for it. Can you imagine having to pay attention anything for longer than 5-7 seconds when you're trying to find that one email amongst possibly thousands in one of my in boxes because you're scared to death to delete anything that may be of value one day in the future, or not. Pretty please tell me I'm on the wrong track here and there's a simple solution and how to find it. And

    IMHO, the mistake is to put anything in Trash if you think you'll ever want to look at it again. Do you ever "file" actual paper documents in the real Trash bin, down there on the floor?
    However...
    Your Trash folder may be on the email provider's server and subject to their housekeeping regime. Have a look at your account settings; if the account uses IMAP then you might try setting it to use a local Trash folder, for instance in your Local Folders account. That should put emptying of Trash under your control and safe from the whims of any third parties. But in my book, using Trash for persistent storage is perverse. Or as you might put it, it sucks.
    I'd set up a Pending folder, and use QuickFolderMove, or use star and a filter, or a tag and a filter to park indeterminate messages in it.
    The delete key is for deleting things, and nothing else.

  • DELETE KEY FROM KEY BOARD

    hi,
    in ALV GRID Delete button is working fine but if u select any record and press DELETE in KEYBOARD, that record is deleting but how to disable that delete key  in KEY BOARD.
    how to solve this problem

    Use "CL_GUI_ALV_GRID=>MC_STYLE_NO_DELETE_ROW" to disable DEL key from Keyboard in ALV Grid.

  • Delete key not always responding

    Recently I installed RAM and when removing the keyboard I must of jarred the delete key because it is sluggish, only responding half the time I tap it.
    Any suggestions on how to fix this?
    iBook G4 1.33ghz   Mac OS X (10.3.9)   1.25 gigs RAM

    Welcome to Apple Discussions!
    It's possible the key is bad. You can go to System Preferences>International>Input Menu and check "Keyboard Viewer" and "Show input menu in menu bar". This will install a little flag in the menu bar. You can click on it and on "show keyboard viewer" and it will highlight the keys as you type. If a key doesn't highlight, it likely doesn't work any more. I think you need to replace the entire keyboard, but you can do it yourself and it is not difficult. You should be able to get a replacement from Apple.
    Good luck!

  • How can I restore Thunderbird behavior so I can delete emails by pressing delete key multiple times (without using mouse to change focus back to message list)?

    Thunderbird 24.3.0 (latest under OpenBSD)
    I (like most people) get spam in my inbox. When there are multiple spam messages in a row in my inbox I used to click on the first message and then press the delete key repeatedly for each sequential spam message.
    After upgrading, this doesn't work. Instead, when I click a message it opens in the message preview pane and moves the focus to the message. Thus I need to click twice to even be able to press the delete key to delete one message. When I press the delete key, the message is deleted and the highlighted message becomes the next one in the list. This opens the message in the preview pane and again shifts the focus to the message. Thus I can't press the delete key again but must move the mouse to click on the message before I can delete it.
    As a result, what used to be a very fast process of weeding through spam has become a real annoyance.
    I realize I can hide the message preview pane to prevent the focus from moving, but this means I must delete solely based on the email subject/sender -- or open each message (which is even slower).
    I also realize that I can press tab multiple times (sometime 4, sometimes many more) to shift the focus back but that's not much faster than using the mouse.
    How can I prevent Thunderbird from shifting the focus away from the email list panel unless I actually click somewhere else?

    Well said! And you said it about six weeks ago. And 4 other people said "Me Too." - I guess we're screwed.
    I guess it's time to switch to GMail.
    Such a trivial thing, but it irritates me every single time.
    MOZILLA - YOU'RE GOING DOWNHILL...

  • How to delete a row in ADF Table by pressing "Delete" Key

    I want to delete a row in my ADF table by pressing the "Delete" key..How can i achieve it?

    hai ,
    I write clientListener and ServerListener..But in the script i printed the event.getKeyCode() ...*When i press Delete Key or EnterKey ,it is not printing the value*..
    The code i write is pasted below..
    In the code backing_Comm is my backingbean..Is there any problem in the code that i had written?I want to delete a selected row from my table using keypress Event...pls advice..
    <script type="text/javascript">
    onPressDeleteKey=function(event){
    alert(event.getKeyCode()); // *Here i am not getting the alert, when i press Delete Key or Enter Key..But getting alert when i press A- Z or 1 - 0*
    if(event.getKeyCode()==AdfKeyStroke.ENTER_KEY) {
    var source = event.getSource();
    AdfCustomEvent.queue(source,performDeleteOnPress,{},false);
    </script>
    <*af:table* value="#{bindings.ComMastVO.collectionModel}"
    var="row"
    rows="#{bindings.ComMastVO.rangeSize}"
    emptyText="#{bindings.ComMastVO.viewable ? 'No rows yet.' : 'Access Denied.'}"
    fetchSize="#{bindings.CompMastVO.rangeSize}"
    rowSelection="single"
    id="tblCom"
    columnStretching="last" inlineStyle="width:100%;"
    width="273"
    selectionListener="#{backing_Comm.rowSelectCom}"
    binding="#{backing_Comm.tblCom}"
    clientComponent="true" >
    <*af:column* sortProperty="Com" sortable="true">
    <*af:inputText* value="#{row.bindings.Com.inputValue}"
    label="#{bindings.ComMastVO.hints.Com.label}"
    required="#{bindings.ComMastVO.hints.Com.mandatory}"
    columns="150"
    maximumLength="#{bindings.ComMastVO.hints.Com.precision}"
    shortDesc="#{bindings.ComMastVO.hints.Com.tooltip}">
    valueChangeListener="#{backing_Comm.onValueChange}"
    autoSubmit="true" >
    <f:validator binding="#{row.bindings.Com.validator}"/>
    *</af:inputText>*
    *<af:serverListener type="performDeleteOnPress"*
    *method="#{backing_Comm.goDeleteCurrentRow}"/>*
    </af:column>
    *<af:clientListener type="keyPress"*
    *method="onPressDeleteKey"/>*
    </af:table>
    =================================================
    anybody pls help??
    Edited by: Briston Thomas on Jun 3, 2009 2:25 AM

  • When I use my Delete key to delete a song, I get a pop-up.  This is OK, except the Keep File button is defaulted and I cannot tab or arrow to the "Move to Trash" button, and so i need to use my mouse.  How can I do this only with keyboard?

    When using iTunes on my iMac, I use my Delete key to delete a song and I get a pop-up.  This is OK, except the Keep File button is defaulted and I cannot tab or arrow to the "Move to Trash" (or Cancel) button, and so I need to use my mouse.  How can I do this only with keyboard?

    Huh.. Interesting. I went back to check these proceedures and found there is a difference between using the return key or the space bar as the action command.
    tabbing the blue ring moves the selection and then spacebar takes that action. The return key takes action of only the blue collored button.
    .... learn somting new every day, even if it is somthing I previously forgot

  • How do I clear the control alt delete key downs when using input acquire.vi?

    I am trying to monitor keystroks...  When I use the Input Acquire.vi after I log in to my system it says the Control LAlt and the Delete key are down and my code does not like that because the keyboard value is not corect...the Keypressed array always has 3 keys down....
    Is there a way to clear them or send key ups some how to get rid of them.
    Thanks for any help you can provide...
    I am using Labview 8.0
    Thanks
    Eric Horwitz

    There is no way that you can press multiple buttons at exactly the same time. Which keys are you trying to press? Are you talking about "PlatMods" (shift, ctrl, etc.)?
    Keep a shift registers with the states of the desired buttons in a boolean array and change the respective elements to true or false, depending on key-up and key-down events. On the Key down events, check if all elements are true and act accordingly.
    LabVIEW Champion . Do more with less code and in less time .

  • How to open files with "return" key and delete files with "delete" key?

    Hi friends,
    It's been over a week since I got my iMac and I'm loving it. However, while I'm adapting alright to 'mac' key shortcuts (e.g. using the COMMAND-S for save as opposed to CONTROL-S used in PC).
    However, there are 2 things that are annoying me greatly right now.
    1. I like selecting files with keys as opposed to using the mouse. I make animations and prefer keyboard shortcuts. However, when I hit "return", instead of opening the file it goes into file-renaming mode. How do I change this? Likewise, I would like to delete files by hitting the delete key. This does not work - how do I change this?
    2. When I click SHIFT key sometimes, it gets 'stuck' - which is annoying because I start typing CAPITALS when I wasn't aware I've activated the CAP-LOCK key. How do I get rid of this? Like, I don't want to hit SHIFT for instance, and have that up arrow thing 'stuck' there.
    Your help would be greatly appreciated! Thanks!
    iMac G5   Mac OS X (10.4.9)  

    Hi
    Thanks for the star.
    If you went into Mac Help & searched, 2 results come up:
    Full keyboard access shortcuts for interacting with items (for selecting & activating controls).
    Full keyboard navigation keyboard shortcuts (for navigating Desktop, Windows, Menu bar etc)
    From the lists, select the link that closely describes your situation.
    I have to say that I can't reproduce your problem, does this happen just in applications or in everything? I don't know if it's to do with this but pressing Shift 5 times turns on Sticky Keys & Option(Alt) 5 times to turn on Mouse Keys (System Preferences>Universal Access>Keyboard).
    After typing "Sticky Keys" into Mac Help, I found this:
    "Pressing a group of modifier keys as a sequence
    To perform many tasks on your computer, you need to press one or more modifier keys (Shift, Command, Option, and Control) at the same time as another key. For example, pressing Shift-Command-Q in the Finder opens the Logout dialog.
    If you have difficulty pressing several keys at once, you can make it easier to press a set of keys by turning on Sticky Keys in the Universal Access preferences pane. With Sticky Keys turned on, you can press a set of modifier keys as a sequence. As you press each key, the symbol for the modifier key appears on the screen.
    Choose Apple menu > System Preferences and click Universal Access. Then click Keyboard.
    Select the On button next to Sticky Keys.
    To hear a sound whenever the computer registers that you have pressed a modifier key, select "Beep when a modifier key is set."
    To see an icon indicating which modifier keys you have pressed, select "Display pressed keys on screen."
    You can also use Slow Keys to adjust the amount of time between when you press a key and when it is activated."
    Any of this close to your problem?
    Steve
    Edit: I'm right, it's Sticky Keys:
    http://www.macusenet.com/190284-post2.html

  • How would I make it so that when "deleting" an image I can make it so that the delete key does it or a button I put on the application?

    How would I make it so that when "deleting" an image I can make it so that the delete key does it or a button I put on the application?
    I want it so that I can use either a button on the designer window or the delete key. I know how to do the or part but the trouble I'm having is coding the button in.
    if (LastImageClicked != null && (e.Key == Key.Delete || Button))
    This is the code that I have in the format I'm looking for I just don't know how to do it. Thanks for your help!

    There are a number of things which are unclear about your question.
    I'll tell you one way to approach this though.
    Handle Window.PreviewKeyDown.
    <Window
    Window.PreviewKeyDown="Mainwindow_PreviewKeyDown"
    Code behind
    private void Mainwindow_PreviewKeyDown(object sender, KeyEventArgs e)
    if (e.Key == Key.Delete)
    File.Delete("p001.jpg");
    I don't know enough about what you mean by LastImageClicked  but you need some way of knowing which path you are going to delete.
    Then you might well have a problem if it's showing in an image control.
    You will need to copy the picture off disk into a new bitmapimage object.
    If you just do
    <Image Source="p001.jpg"
    Then that image will grab the file and you won't be able to delete it - you'll  get an error.
    In my experimental code p001.jpg is set as content copy always so it ends up next to the exe in the bin when the solution compiles.
    You would probably want a full path to a file there.
    Hope that helps.
    Recent Technet articles:
    Property List Editing;  
    Dynamic XAML

  • My delete key on my macbook isn't responding.

    Today I was typing when all of a sudden my delete key on my macbook stop responding, I try resetting still no luck.
    Any ideas what can be the problem?

    Ok, so after being on hold for 20 minutes with the Apple Tech support line got me nowhere!!! They told me if I wanted them to help me, I would have to pay a 49.99 fee first! That was a definite NO!
    I trashed it and reinstalled it- DID NOT WORK!
    I searched and searched online for solutions and here is what I ran across and it actually worked (I lost no pictures and was able to retrieve everything like it never happened):
    1. I went to my desktop screen and held down BOTH the option/ alt button and the command button (do not release buttons)
    2. Open your iPhoto app and a box should pop up with the option to rebuild library.
    3. I personally selected 'rebuild thumbnails small', 'recover orphaned photos', and 'rebuild iPhoto Library database from automatic backup'
    4. Hit rebuild and let it run its course
    5.  When it's done you should be able to retrieve your photos.

  • How can I change the key to delete a message from the delete key to command-delete like it is in the finder?

    These new forums confuse me... Sorry.
    I often think I am typing in another window but I'm actually typing while Mail.app is selected.  When I discover this, I often (without really thinking) start whacking the delete key.  When I whack the delete key, of course, a message is moved to the trash.  So, without really thinking about it, I delete three to six messages.  Go ahead -- call me stupid.  But...
    If delete is not used to delete files in the Finder, then why is it used to delete files in Mail?
    One group suggested making customer keyboard macros.  Sounded like a plausible solution.  I could make a customer keyboard macro so that delete did nothing (or something benign) and make command-delete delete the message.  Alas, using the Apple => System Preferences => Keyboard => Keyboard Shortcuts => Application Shortcuts gave me no Joy because it won't let me do either of those.  When I try to enter either delete or command-delete into the "Keyboard Shortcut" box, it just beeps at me.
    Does anyone here have a suggestion?
    Thank you,
    pedz
    p.s.   I can get the deleted messages back using Undo (repeatedly) but I think that is new with Lion.  So life isn't tragic but it still is an interface that I'd like to change if I could.

    You can define your own custom keystrokes in System Preferences -> Keyboard.  I'm not 100% sure that this blocks the old keystroke, though, and am posting from my iPad and can't check that at the moment.

Maybe you are looking for

  • Re: Error in submitting Import Standard Purchase orders from Pl/Sql

    Hi All, Iam using the following code to submit a concurret program "Import Standard Purchase orders" from pl/sql Program is sucessfully submittted but it is Completing in error status i am stuck there please help me in resolving this My instance R12

  • Multiple user account question

    I have created a second user account on my G5 but every time the person logs on the computer asks for a administrator name and password. I think the reason is to access the wireless internet connection. Is there any way to set this account up so that

  • Ical displays Wednesday every day in Week and day view

    Upgraded to SnowLeopard and added "calendar.app" from the app store, evr since ical displays "Wednesday" everyday in week and day views. Any ideas?

  • Print panel: wrong axis scale

    I am using Print Panel to automatically get a copy of the graph produced on the front panel at the end of a run. The printed graph sometimes has an axis whose scale is wrong by a factor of 10 (in either direction). This happens to both the x- and y-

  • Importing iTunes Music

    Hello. Is it still the case, with iMovie '11, that it's still recommended that we convert AAC music files to AIF when adding music? I recall in previous versions it WAS recommended for eliminating the audio track from breaking up after it was burned