java-gnome version 4.0.19

org.gnome.gtk
Class AcceleratorGroup

Object
  extended by org.freedesktop.bindings.Pointer
      extended by org.freedesktop.bindings.Proxy
          extended by org.gnome.glib.Object
              extended by org.gnome.gtk.AcceleratorGroup

public class AcceleratorGroup
extends Object

Accelerator are for key bindings for windows. For example, Ctrl+O is the typical accelerator for opening a file. Accelerator in this case refers to pressing these keys together and the action that results.

When a key binding is pressed the action related to the Widget is being activated. Therefore each key binding is directly tied to the Widget in question. You generally only need one AcceleratorGroup object per Window. Create one, then tell the toplevel about it with Window's addAcceleratorGroup().

Key bindings are only bound to MenuItems or Actions. For example, given a Window, a Menu, and a MenuItem, we setup an AcceleratorGroup for the toplevel and then assign a key binding to the MenuItem:

 group = new AcceleratorGroup();
 window.addAcceleratorGroup(group);
 ..
 menu.setAcceleratorGroup(group);
 item.setAccelerator(group, Keyval.O, ModifierType.CONTROL_MASK);
 

For ImageMenuItem you can either use the key binding that is associated with it through the Stock item and only invoke:

 imageitem.setAccelerator(group);
 
or you can set a custom key binding through the method from parent class MenuItem:
 imageitem.setAccelerator(group, Keyval.N, ModifierType.CONTROL_MASK);
 

In order to set multiple Modifier Types you can use the static method or()

Since:
4.0.16
Author:
Thijs Leibbrand

Constructor Summary
AcceleratorGroup()
           
 
Method Summary
 
Methods inherited from class org.freedesktop.bindings.Pointer
toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AcceleratorGroup

public AcceleratorGroup()


java-gnome