Here you can find the source of removeButtonClickKeystroke(AbstractButton b, KeyStroke key)
Parameter | Description |
---|---|
key | The KeyStroke to remove |
b | the button to work on |
public static void removeButtonClickKeystroke(AbstractButton b, KeyStroke key)
//package com.java2s; /*/* w ww . j ava 2 s . com*/ * funCKit - functional Circuit Kit * Copyright (C) 2013 Lukas Elsner <open@mindrunner.de> * Copyright (C) 2013 Peter Dahlberg <catdog2@tuxzone.org> * Copyright (C) 2013 Julian Stier <mail@julian-stier.de> * Copyright (C) 2013 Sebastian Vetter <mail@b4sti.eu> * Copyright (C) 2013 Thomas Poxrucker <poxrucker_t@web.de> * Copyright (C) 2013 Alexander Treml <alex.treml@directbox.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import javax.swing.AbstractButton; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JComponent; import javax.swing.KeyStroke; public class Main { /** * The reverse Operation of * {@link #addButtonClickKeystroke(AbstractButton, KeyStroke, Object)}. * * @param key * The {@link KeyStroke} to remove * @param b * the button to work on */ public static void removeButtonClickKeystroke(AbstractButton b, KeyStroke key) { InputMap inMap = b.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap acMap = b.getActionMap(); acMap.remove(inMap.get(key)); inMap.remove(key); } }