Ejemplo n.º 1
0
 public static void main(String... args) {
   EventQueue.invokeLater(
       new Runnable() {
         @Override
         public void run() {
           createAndShowGUI();
         }
       });
 }
Ejemplo n.º 2
0
 /**
  * Perform the specified Action on the object
  *
  * @param i zero-based index of actions
  * @return true if the action was performed; otherwise false.
  */
 public boolean doAccessibleAction(int i) {
   if (i == 0) {
     // Simulate a button click
     Toolkit.getEventQueue()
         .postEvent(
             new ActionEvent(
                 MenuItem.this,
                 ActionEvent.ACTION_PERFORMED,
                 MenuItem.this.getActionCommand(),
                 EventQueue.getMostRecentEventTime(),
                 0));
     return true;
   } else {
     return false;
   }
 }
Ejemplo n.º 3
0
 @Override
 public void popupMenuWillBecomeVisible(final PopupMenuEvent e) {
   EventQueue.invokeLater(
       new Runnable() {
         @Override
         public void run() {
           JComboBox combo = (JComboBox) e.getSource();
           Accessible a = combo.getAccessibleContext().getAccessibleChild(0);
           // Or Accessible a = combo.getUI().getAccessibleChild(combo, 0);
           if (a instanceof BasicComboPopup) {
             BasicComboPopup pop = (BasicComboPopup) a;
             Point p = new Point(combo.getSize().width, 0);
             SwingUtilities.convertPointToScreen(p, combo);
             pop.setLocation(p);
           }
         }
       });
 }