本文整理汇总了Java中java.awt.KeyEventPostProcessor类的典型用法代码示例。如果您正苦于以下问题:Java KeyEventPostProcessor类的具体用法?Java KeyEventPostProcessor怎么用?Java KeyEventPostProcessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
KeyEventPostProcessor类属于java.awt包,在下文中一共展示了KeyEventPostProcessor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeAll
import java.awt.KeyEventPostProcessor; //导入依赖的package包/类
public void closeAll()
{
final ArrayList< KeyEventPostProcessor > ks = new ArrayList< KeyEventPostProcessor >( keyEventPostProcessorSet );
for ( final KeyEventPostProcessor ke : ks )
removeKeyEventPostProcessor( ke );
repeatedKeyEventsFixer.remove();
viewerFrameP.setVisible( false );
viewerFrameQ.setVisible( false );
landmarkFrame.setVisible( false );
viewerFrameP.getViewerPanel().stop();
viewerFrameQ.getViewerPanel().stop();
viewerFrameP.dispose();
viewerFrameQ.dispose();
landmarkFrame.dispose();
}
示例2: initialize
import java.awt.KeyEventPostProcessor; //导入依赖的package包/类
private static void initialize() {
Properties swingProps = loadSwingProperties();
initializeSystemDefaults(swingProps);
initializeDefaultLAF(swingProps);
initializeAuxiliaryLAFs(swingProps);
initializeInstalledLAFs(swingProps);
// Install Swing's PaintEventDispatcher
if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
sun.awt.PaintEventDispatcher.setPaintEventDispatcher(
new SwingPaintEventDispatcher());
}
// Install a hook that will be invoked if no one consumes the
// KeyEvent. If the source isn't a JComponent this will process
// key bindings, if the source is a JComponent it implies that
// processKeyEvent was already invoked and thus no need to process
// the bindings again, unless the Component is disabled, in which
// case KeyEvents will no longer be dispatched to it so that we
// handle it here.
KeyboardFocusManager.getCurrentKeyboardFocusManager().
addKeyEventPostProcessor(new KeyEventPostProcessor() {
public boolean postProcessKeyEvent(KeyEvent e) {
Component c = e.getComponent();
if ((!(c instanceof JComponent) ||
(c != null && !c.isEnabled())) &&
JComponent.KeyboardState.shouldProcess(e) &&
SwingUtilities.processKeyBindings(e)) {
e.consume();
return true;
}
return false;
}
});
AWTAccessor.getComponentAccessor().
setRequestFocusController(JComponent.focusController);
}
示例3: Picking
import java.awt.KeyEventPostProcessor; //导入依赖的package包/类
/**
* Crée un comportement de picking
*
* @param canvas
* le canvas dans lequel est créé le picking
* @param scene
* le BranchGroup contenant les éléments à sélectionner
*/
public Picking(Canvas3D canvas, BranchGroup scene) {
this.canvas3D = canvas;
this.pickCanvas = new PickCanvas(this.canvas3D, scene);
// Tolérance à partir de laquelle les objets en fonction de la distance
// avec la souris
// sera sélectionnée
this.pickCanvas.setTolerance(5f);
// Pour avoir des infos à partir des frontières de l'objet intersecté
this.pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO);
// Le bouton controle est il enfoncé ?
KeyboardFocusManager kbm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
kbm.addKeyEventPostProcessor(new KeyEventPostProcessor() {
@Override
public boolean postProcessKeyEvent(KeyEvent e) {
if (e.getModifiers() == InputEvent.CTRL_MASK) {
if (e.getID() == KeyEvent.KEY_PRESSED) {
Picking.PICKING_IS_CTRL_PRESSED = true;
}
}
if (e.getID() == KeyEvent.KEY_RELEASED) {
Picking.PICKING_IS_CTRL_PRESSED = false;
}
return false;
}
});
}
示例4: GenerateNodesDialog
import java.awt.KeyEventPostProcessor; //导入依赖的package包/类
/**
* The constructor for the GenerateNodesDialog class.
*
* @param p The parent Frame to add the Dialog to.
*/
public GenerateNodesDialog(GUI p){
super(p, "Create new Nodes", true);
GuiHelper.setWindowIcon(this);
cancel.addActionListener(this);
ok.addActionListener(this);
Font f = distributionModelComboBox.getFont().deriveFont(Font.PLAIN);
distributionModelComboBox.setFont(f);
nodeTypeComboBox.setFont(f);
connectivityModelComboBox.setFont(f);
interferenceModelComboBox.setFont(f);
mobilityModelComboBox.setFont(f);
reliabilityModelComboBox.setFont(f);
// Detect ESCAPE button
KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
focusManager.addKeyEventPostProcessor(new KeyEventPostProcessor() {
public boolean postProcessKeyEvent(KeyEvent e) {
if(!e.isConsumed() && e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_ESCAPE) {
GenerateNodesDialog.this.setVisible(false);
}
return false;
}
});
this.setLocationRelativeTo(p);
this.parent = p;
}
示例5: addKeyEventPostProcessor
import java.awt.KeyEventPostProcessor; //导入依赖的package包/类
public void addKeyEventPostProcessor( final KeyEventPostProcessor ke )
{
keyEventPostProcessorSet.add( ke );
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor( ke );
}
示例6: removeKeyEventPostProcessor
import java.awt.KeyEventPostProcessor; //导入依赖的package包/类
public void removeKeyEventPostProcessor( final KeyEventPostProcessor ke )
{
keyEventPostProcessorSet.remove( ke );
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventPostProcessor( ke );
}
示例7: initialize
import java.awt.KeyEventPostProcessor; //导入依赖的package包/类
private static void initialize() {
Properties swingProps = loadSwingProperties();
initializeSystemDefaults(swingProps);
initializeDefaultLAF(swingProps);
initializeAuxiliaryLAFs(swingProps);
initializeInstalledLAFs(swingProps);
// Enable the Swing default LayoutManager.
String toolkitName = Toolkit.getDefaultToolkit().getClass().getName();
// don't set default policy if this is XAWT.
if (!"sun.awt.X11.XToolkit".equals(toolkitName)) {
if (FocusManager.isFocusManagerEnabled()) {
KeyboardFocusManager.getCurrentKeyboardFocusManager().
setDefaultFocusTraversalPolicy(
new LayoutFocusTraversalPolicy());
}
}
// Install Swing's PaintEventDispatcher
if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
sun.awt.PaintEventDispatcher.setPaintEventDispatcher(
new SwingPaintEventDispatcher());
}
// Install a hook that will be invoked if no one consumes the
// KeyEvent. If the source isn't a JComponent this will process
// key bindings, if the source is a JComponent it implies that
// processKeyEvent was already invoked and thus no need to process
// the bindings again, unless the Component is disabled, in which
// case KeyEvents will no longer be dispatched to it so that we
// handle it here.
KeyboardFocusManager.getCurrentKeyboardFocusManager().
addKeyEventPostProcessor(new KeyEventPostProcessor() {
public boolean postProcessKeyEvent(KeyEvent e) {
Component c = e.getComponent();
if ((!(c instanceof JComponent) ||
(c != null && !c.isEnabled())) &&
JComponent.KeyboardState.shouldProcess(e) &&
SwingUtilities.processKeyBindings(e)) {
e.consume();
return true;
}
return false;
}
});
AWTAccessor.getComponentAccessor().
setRequestFocusController(JComponent.focusController);
}
示例8: GlobalSettingsDialog
import java.awt.KeyEventPostProcessor; //导入依赖的package包/类
/**
* The constructor for the GlobalSettingsDialog class.
*
* @param parent The parent Frame to attach the dialog to.
*/
public GlobalSettingsDialog(JFrame parent){
super(parent, "Global Settings", true);
GuiHelper.setWindowIcon(this);
this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(650, 500));
JTextArea text = new JTextArea();
text.setEditable(false);
ByteArrayOutputStream os = new ByteArrayOutputStream();
Configuration.printConfiguration(new PrintStream(os));
text.setText(os.toString());
text.setCaretPosition(0); // ensure that the top of the text is shown
JScrollPane spane = new JScrollPane(text);
this.add(spane);
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BorderLayout());
JPanel settingsPanel = new JPanel();
settingsPanel.setLayout(new BorderLayout());
testForUpdatesAtStartup.setSelected(AppConfig.getAppConfig().checkForSinalgoUpdate);
testForUpdatesAtStartup.addActionListener(this);
settingsPanel.add(BorderLayout.LINE_START, testForUpdatesAtStartup);
versionTest.addActionListener(this);
settingsPanel.add(BorderLayout.EAST, versionTest);
buttonPanel.add(settingsPanel);
close.addActionListener(this);
JPanel closePanel = new JPanel();
closePanel.add(close);
buttonPanel.add(BorderLayout.SOUTH, closePanel);
this.add(BorderLayout.SOUTH, buttonPanel);
// Detect ESCAPE button
KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
focusManager.addKeyEventPostProcessor(new KeyEventPostProcessor() {
public boolean postProcessKeyEvent(KeyEvent e) {
if(!e.isConsumed() && e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_ESCAPE) {
GlobalSettingsDialog.this.setVisible(false);
}
return false;
}
});
this.getRootPane().setDefaultButton(close);
this.pack();
this.setLocationRelativeTo(parent);
this.setVisible(true);
}
示例9: addKeyEventPostProcessor
import java.awt.KeyEventPostProcessor; //导入依赖的package包/类
/**
* Wraps
* {@link KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)}.
*
* @param p the post processor
*/
public void addKeyEventPostProcessor(KeyEventPostProcessor p)
{
wrapped.addKeyEventPostProcessor(p);
}
示例10: removeKeyEventPostProcessor
import java.awt.KeyEventPostProcessor; //导入依赖的package包/类
/**
* Wraps
* {@link KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)}.
*
* @param p the post processor
*/
public void removeKeyEventPostProcessor(KeyEventPostProcessor p)
{
wrapped.removeKeyEventPostProcessor(p);
}