Exemplo n.º 1
0
  private JButton createButton(String text, String eventid, String shortcut, boolean def) {
    final JButton b = new JButton(text);
    b.setMaximumSize(new Dimension(80, b.getPreferredSize().height));
    b.setPreferredSize(new Dimension(80, b.getPreferredSize().height));
    b.setMinimumSize(new Dimension(80, b.getPreferredSize().height));
    b.setActionCommand(eventid);
    b.addActionListener(this);
    b.setMnemonic(shortcut.charAt(0));
    if ((shortcut != null) && (shortcut.length() > 0)) {
      this.eventKeyMap.put(Character.valueOf(shortcut.charAt(0)), eventid);
    }
    if (def) {
      getRootPane().setDefaultButton(b);
      b.requestFocus();
      addWindowListener(
          new WindowAdapter() {

            @Override
            public void windowActivated(WindowEvent e) {
              b.requestFocusInWindow();
            }
          });
    }
    b.addKeyListener(this.keyListener);
    SubstanceThemeHelper.setComponentToGeneralArea(b);
    return b;
  }
Exemplo n.º 2
0
  public DatabaseTab(final UISubsystem ui) throws Exception {
    init(ui.getRl(), ui.getRl().getResourceStream("xui/optionstabs/databasetab.xui.xml"));
    this.ui = ui;

    Language.translateXUIElements(getClass(), xui.getXUIComponents());
    SubstanceThemeHelper.setButtonsToGeneralArea(xui.getXUIComponents());
    tab = (JPanel) xui.getComponent("databasetab");
    tab.setName(Language.getLocalizedString(getClass(), "title"));
    tab.setToolTipText(Language.getLocalizedString(getClass(), "tooltip"));
  }