Ejemplo n.º 1
0
 @Override
 public void initialize() {
   try {
     base.initialize();
   } catch (Exception ignore) {
   }
   myDisposable = Disposer.newDisposable();
   Application application = ApplicationManager.getApplication();
   if (application != null) {
     Disposer.register(application, myDisposable);
   }
   myMnemonicAlarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, myDisposable);
   IdeEventQueue.getInstance()
       .addDispatcher(
           e -> {
             if (e instanceof KeyEvent && ((KeyEvent) e).getKeyCode() == KeyEvent.VK_ALT) {
               myAltPressed = e.getID() == KeyEvent.KEY_PRESSED;
               myMnemonicAlarm.cancelAllRequests();
               final Component focusOwner = IdeFocusManager.findInstance().getFocusOwner();
               if (focusOwner != null) {
                 myMnemonicAlarm.addRequest(() -> repaintMnemonics(focusOwner, myAltPressed), 10);
               }
             }
             return false;
           },
           myDisposable);
 }
Ejemplo n.º 2
0
 @Override
 public void uninitialize() {
   try {
     base.initialize();
   } catch (Exception ignore) {
   }
   Disposer.dispose(myDisposable);
   myDisposable = null;
 }
Ejemplo n.º 3
0
  /*
   * (non-Javadoc)
   *
   * @see javax.swing.plaf.basic.BasicLookAndFeel#initClassDefaults(javax.swing .UIDefaults)
   */
  @Override
  protected void initClassDefaults(UIDefaults table) {
    super.initClassDefaults(table);

    try {
      String className = "com.quiltplayer.view.swing.buttons.QButtonUI";

      Class<?> buttonClass = Class.forName(className);

      table.put("ButtonUI", className);
      table.put(className, buttonClass);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 4
0
  /*
   * (non-Javadoc)
   *
   * @see javax.swing.plaf.basic.BasicLookAndFeel#initComponentDefaults(javax.swing .UIDefaults)
   */
  @Override
  protected void initComponentDefaults(UIDefaults table) {
    super.initComponentDefaults(table);

    Object[] defaults = {
      "Button.font",
      FontFactory.getFont(14f),
      "Button.background",
      new ColorUIResource(40, 40, 40),
      "Button.foreground",
      new ColorUIResource(200, 200, 200)
    };

    table.putDefaults(defaults);
  }