Package java.awt.event

Examples of java.awt.event.AWTEventListener


            //logEvents();
            Toolkit.getDefaultToolkit().addAWTEventListener(new GlobalListener(), AWTEvent.KEY_EVENT_MASK);

            // For the magnifier
            Toolkit.getDefaultToolkit().addAWTEventListener(new MagnifierListener(), AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.WINDOW_EVENT_MASK);
            Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

                public void eventDispatched(AWTEvent e) {

                    if (e instanceof WindowEvent) {
                        WindowEvent w = (WindowEvent) e;
                        String param = w.paramString();
                        if (w.getID() == WindowEvent.WINDOW_OPENED) {
                           
                            Window window  = w.getWindow();
                            // Is it a code completion window?
                            boolean isCodeCompletion = isCodeCompletionWindow(window, true, !CodeCompletionListener.isCodeCompletionOpen());

                            if (!isCodeCompletion) {
                                AccessibleContext ac = window.getAccessibleContext();
                                if (ac != null) {
                                    String name = ac.getAccessibleName();
                                    if (name == null) {
                                        name = "";
                                    }
                                    if (TextToSpeechOptions.isScreenReading() && !name.trim().isEmpty()) {
                                        speech.speak(name + " window opened", SpeechPriority.MEDIUM_HIGH);
                                    }
                                }
                            }
                        } else if (w.getID() == WindowEvent.WINDOW_CLOSING) {
                            Window window = w.getWindow();
                            AccessibleContext ac = window.getAccessibleContext();
                            // Is it a code completion window?
                            if (ac != null) {
                                String name = ac.getAccessibleName();
                                if (name == null) {
                                    name = "";
                                }
                                if (TextToSpeechOptions.isScreenReading()) {
                                    speech.speak(name + " window closing", SpeechPriority.MEDIUM_HIGH);
                                }
                            }
                        }
                    }
                }
            }, AWTEvent.WINDOW_EVENT_MASK);

            // Window opening/closing as well as Code Completion support
            Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

                public void eventDispatched(AWTEvent e) {
                    if (e instanceof WindowEvent) {
                        final int MINIMIZED = 7;
                        final int MINIMIZED2 = 1;
                        WindowEvent w = (WindowEvent) e;
                        //I would think that there are constants in java.awt.Frame,
                        //but I did not immediatley see them for minimized windows.
                        if (w.getNewState() == MINIMIZED || w.getNewState() == MINIMIZED2) {
                            Window window = w.getWindow();
                            AccessibleContext ac = window.getAccessibleContext();
                            if (ac != null) {
                                String name = ac.getAccessibleName();
                                if (name == null) {
                                    name = "";
                                }
                                if (TextToSpeechOptions.isScreenReading()) {
                                    speech.speak(name + " window minimized", SpeechPriority.MEDIUM_HIGH);
                                }
                            }
                        }
                    }
                }
            }, AWTEvent.WINDOW_STATE_EVENT_MASK);

            // Editor hint support
            Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

                public void eventDispatched(AWTEvent evt) {
                    HierarchyEvent e = (HierarchyEvent) evt;
                    if (e.getChangeFlags() == HierarchyEvent.DISPLAYABILITY_CHANGED) {
                        Object source = e.getSource();
View Full Code Here


        System.out.print("" + event + " - ");
        event++;
    }

    public void logEvents() {
        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("ACTION_EVENT_MASK: " + e);
            }
        }, AWTEvent.ACTION_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("ADJUSTMENT_EVENT_MASK: " + e);
            }
        }, AWTEvent.ADJUSTMENT_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("COMPONENT_EVENT_MASK: " + e);
            }
        }, AWTEvent.COMPONENT_EVENT_MASK);


        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("CONTAINER_EVENT_MASK: " + e);
            }
        }, AWTEvent.CONTAINER_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("FOCUS_EVENT_MASK: " + e);
            }
        }, AWTEvent.FOCUS_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("HIERARCHY_BOUNDS_EVENT_MASK: " + e);
            }
        }, AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK);


        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("HIERARCHY_EVENT_MASK: " + e);
            }
        }, AWTEvent.HIERARCHY_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("INPUT_METHOD_EVENT_MASK: " + e);
            }
        }, AWTEvent.INPUT_METHOD_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("INVOCATION_EVENT_MASK: " + e);
            }
        }, AWTEvent.INVOCATION_EVENT_MASK);


        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("ITEM_EVENT_MASK: " + e);
            }
        }, AWTEvent.ITEM_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("KEY_EVENT_MASK: " + e);
            }
        }, AWTEvent.KEY_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("MOUSE_EVENT_MASK: " + e);
            }
        }, AWTEvent.MOUSE_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("MOUSE_MOTION_EVENT_MASK: " + e);
            }
        }, AWTEvent.MOUSE_MOTION_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("MOUSE_WHEEL_EVENT_MASK: " + e);
            }
        }, AWTEvent.MOUSE_WHEEL_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                //outputEventNumber();
                //System.out.println("PAINT_EVENT_MASK: " + e);
            }
        }, AWTEvent.PAINT_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                //outputEventNumber();
                //System.out.println("RESERVED_ID_MAX: " + e);
            }
        }, AWTEvent.RESERVED_ID_MAX);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("TEXT_EVENT_MASK: " + e);
            }
        }, AWTEvent.TEXT_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("WINDOW_EVENT_MASK: " + e);
            }
        }, AWTEvent.WINDOW_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("WINDOW_FOCUS_EVENT_MASK: " + e);
            }
        }, AWTEvent.WINDOW_FOCUS_EVENT_MASK);

        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {

            public void eventDispatched(AWTEvent e) {
                outputEventNumber();
                System.out.println("WINDOW_STATE_EVENT_MASK: " + e);
            }
View Full Code Here

     * Creates new form EventsExFrame
     */
    public EventsExFrame() {
        initComponents();
        setLocationRelativeTo(null);
        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener(){

            @Override
            public void eventDispatched(final AWTEvent event) {
                //System.out.println(event);
                final MouseEvent m = (MouseEvent)event;
View Full Code Here

  private AWTEventListener listener;

  private AWTEventListener getListener() {
  if (listener == null) {
    listener = new AWTEventListener() {
    @Override
    public void eventDispatched(AWTEvent event) {
      if (event instanceof InputEvent) {
      InputEvent ie = (InputEvent) event;
      ie.consume();
View Full Code Here

   
    final RealtimeCanvas canvas = tempCanvas;

    // Add Escape and Q as quitting keys
    Toolkit t = Toolkit.getDefaultToolkit();
    t.addAWTEventListener(new AWTEventListener() {
        public void eventDispatched(AWTEvent event) {
          KeyEvent ke = (KeyEvent)event;
          if(ke.getKeyCode() == KeyEvent.VK_T) {
            long time = System.currentTimeMillis();
            if(time - toggleTime > 5000) {
View Full Code Here

      if(isInProcess_()) {
        InProcess.initialize();
      } else {
        OutProcess.initialize();
      }
      Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
        public void eventDispatched(AWTEvent e) {
          KeyEvent ke = (KeyEvent)e;
          if(ke.getID() == KeyEvent.KEY_PRESSED && ke.getKeyCode() == KeyEvent.VK_F3 && ke.isControlDown() && ke.isAltDown() && ke.isShiftDown()) {
            printStackTraces();
          }
View Full Code Here

  protected JDialog spyDialog;
  protected SwingSpyPanel spyPanel;
  protected SwingSpyGlassPane spyGlass;

  public SwingSpy() {
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
      /**
       * Mouse hot-key combination clicked.
       */
      public void eventDispatched(AWTEvent awtEvent) {
        MouseEvent event = (MouseEvent) awtEvent;
View Full Code Here

TOP

Related Classes of java.awt.event.AWTEventListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.