public CustomIconDemo() {
    Icon leftButtonIcon = new ArrowIcon(SwingConstants.RIGHT);
    Icon middleButtonIcon = createImageIcon("images/middle.gif", "the middle button");
    Icon rightButtonIcon = new ArrowIcon(SwingConstants.LEFT);

    b1 = new JButton("Disable middle button", leftButtonIcon);
    b1.setVerticalTextPosition(AbstractButton.CENTER);
    b1.setHorizontalTextPosition(AbstractButton.LEADING);
    b1.setMnemonic(KeyEvent.VK_D);
    b1.setActionCommand("disable");

    b2 = new JButton("Middle button", middleButtonIcon);
    b2.setVerticalTextPosition(AbstractButton.BOTTOM);
    b2.setHorizontalTextPosition(AbstractButton.CENTER);
    b2.setMnemonic(KeyEvent.VK_M);

    b3 = new JButton("Enable middle button", rightButtonIcon);
    // Use the default text position of CENTER, TRAILING (RIGHT).
    b3.setMnemonic(KeyEvent.VK_E);
    b3.setActionCommand("enable");
    b3.setEnabled(false);

    // Listen for actions on buttons 1 and 3.
    b1.addActionListener(this);
    b3.addActionListener(this);

    b1.setToolTipText("Click this button to disable the middle button.");
    b2.setToolTipText("This middle button does nothing when you click it.");
    b3.setToolTipText("Click this button to enable the middle button.");

    // Add Components to this container, using the default FlowLayout.
    add(b1);
    add(b2);
    add(b3);
  }
  public UpgradesPanel(ORUIManager orUIManager) {
    super(BoxLayout.Y_AXIS);

    this.orUIManager = orUIManager;

    preferredSize = new Dimension((int) Math.round(100 * (2 + Scale.getFontScale()) / 3), 200);
    setSize(preferredSize);
    setVisible(true);

    upgradePanel = new JPanel();

    upgradePanel.setOpaque(true);
    upgradePanel.setBackground(Color.DARK_GRAY);
    upgradePanel.setBorder(border);
    upgradePanel.setLayout(new GridLayout(defaultNbPanelElements, 1));

    scrollPane = new JScrollPane(upgradePanel);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setSize(getPreferredSize());

    doneButton.setActionCommand("Done");
    doneButton.setMnemonic(KeyEvent.VK_D);
    doneButton.addActionListener(this);
    cancelButton.setActionCommand("Cancel");
    cancelButton.setMnemonic(KeyEvent.VK_C);
    cancelButton.addActionListener(this);

    add(scrollPane);
  }
Example #3
0
  public RmColRow(Editor theeditor) {
    editor = theeditor;

    JButton ColButton = new JButton("Rem Col");
    ColButton.setMnemonic(KeyEvent.VK_L);
    ColButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            editor.getModel().remColumn();
            editor.doDisplay();
          }
        });

    JButton RowButton = new JButton("Rem Row");
    RowButton.setMnemonic(KeyEvent.VK_L);
    RowButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            editor.getModel().remRow();
            editor.doDisplay();
          }
        });

    this.add(ColButton, RowButton);
    this.add(RowButton, RowButton);
  }
Example #4
0
  public CreInvChecker(Component parent) {
    typeButtons = new JCheckBox[CHECKTYPES.length];
    JPanel boxPanel = new JPanel(new GridLayout(0, 1));
    for (int i = 0; i < typeButtons.length; i++) {
      typeButtons[i] = new JCheckBox(CHECKTYPES[i], true);
      boxPanel.add(typeButtons[i]);
    }
    bstart.setMnemonic('s');
    bcancel.setMnemonic('c');
    bstart.addActionListener(this);
    bcancel.addActionListener(this);
    selectframe.getRootPane().setDefaultButton(bstart);
    selectframe.setIconImage(Icons.getIcon("Find16.gif").getImage());
    boxPanel.setBorder(BorderFactory.createTitledBorder("Select test to check:"));

    JPanel bpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    bpanel.add(bstart);
    bpanel.add(bcancel);

    JPanel mainpanel = new JPanel(new BorderLayout());
    mainpanel.add(boxPanel, BorderLayout.CENTER);
    mainpanel.add(bpanel, BorderLayout.SOUTH);
    mainpanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

    JPanel pane = (JPanel) selectframe.getContentPane();
    pane.setLayout(new BorderLayout());
    pane.add(mainpanel, BorderLayout.CENTER);

    selectframe.pack();
    Center.center(selectframe, parent.getBounds());
    selectframe.setVisible(true);
  }
Example #5
0
  // Constructor
  public FileWindow() {

    myWindow = new JFrame("New File");
    myWindow.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    Container contentPane = myWindow.getContentPane();
    contentPane.setLayout(new BorderLayout());

    saveButton = new JButton("Save File");
    saveButton.setSelected(false);
    saveButton.setActionCommand("save");
    saveButton.setMnemonic('S');
    // saveButton.addActionListener(new ScriptWindowButtonListener());

    clearButton = new JButton("Clear Contents");
    clearButton.setSelected(false);
    clearButton.setActionCommand("clear");
    clearButton.setMnemonic('B');
    clearButton.addActionListener(new ScriptWindowButtonListener());

    cancelButton = new JButton("Quit");
    cancelButton.setSelected(false);
    cancelButton.setActionCommand("quit");
    cancelButton.setMnemonic('Q');
    cancelButton.addActionListener(new ScriptWindowButtonListener());

    //		loadButton = new JButton("Load Script");
    //		loadButton.setSelected(false);
    //		loadButton.setActionCommand("load");
    //		loadButton.setMnemonic('L');
    //		loadButton.addActionListener(new ScriptWindowButtonListener());
    //
    //		runButton = new JButton("Run Script");
    //		runButton.setSelected(false);
    //		runButton.setActionCommand("run");
    //		runButton.setMnemonic('L');
    //		runButton.addActionListener(new ScriptWindowButtonListener());

    buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(1, 0));
    // buttonPanel.add(runButton);
    buttonPanel.add(saveButton);
    // buttonPanel.add(loadButton);
    buttonPanel.add(clearButton);
    // buttonPanel.add(cancelButton);

    fileChooser = new JFileChooser();

    scriptArea = new JTextArea(35, 30);
    JScrollPane scroller = new JScrollPane(scriptArea);

    textHolder = new JPanel();
    textHolder.setLayout(new BorderLayout());
    textHolder.add(scroller, BorderLayout.CENTER);

    contentPane.add(buttonPanel, BorderLayout.NORTH);
    contentPane.add(textHolder, BorderLayout.CENTER);
    myWindow.pack();
  }
Example #6
0
  public hostelStatus() {
    setTitle("Hostel");
    connect();
    updateRecord();

    JFrame fr = new JFrame();
    Toolkit tkt = fr.getToolkit();
    Dimension frsize = tkt.getScreenSize();
    setBounds(frsize.width / 4, frsize.height / 12, frsize.width / 2, frsize.height / 8);
    setLayout(null);

    cn = getContentPane();
    cn.setBackground(new Color(190, 180, 170));

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    tl = new JLabel("Current Hostels Status");
    tl.setFont(new Font("Engravers MT", 1, 25));
    tl.setForeground(new Color(247, 251, 249));

    p1 = new JPanel();
    p1.setBounds(0, 0, 600, 50);
    p1.add(tl);
    p1.setBackground(new Color(31, 88, 166));
    cn.add(p1);

    b1 = new JButton("LOAD");
    b1.setMnemonic('L');
    b1.addActionListener(new dispListener());
    b1.setBounds(230, 320, 120, 30);

    b2 = new JButton("EXIT");
    b2.setMnemonic('X');
    b2.addActionListener(new exitListener());
    b2.setBounds(350, 320, 100, 30);

    cn.add(b1);
    cn.add(b2);

    table = new JTable(data, col);
    table.setFont(new Font("Serif", Font.BOLD, 16));
    table.setBackground(new Color(250, 250, 250));
    table.setEnabled(false);

    JScrollPane jsp = new JScrollPane(table);
    jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jsp.setBounds(5, 100, 590, 200);
    cn.add(jsp);

    screensize = Toolkit.getDefaultToolkit().getScreenSize();

    setSize(600, 400);
    setVisible(true);
    setVisible(true);
    setResizable(true);
    connect();
  }
  private void init() throws Exception {
    this.propertyChangeListeners = new PropertyChangeSupport(this);

    backButton = new JButton();
    nextButton = new JButton();
    finishButton = new JButton();
    cancelButton = new JButton();

    panelList = new ArrayList();
    currentIndex = 0;
    wizardPanelsContainer = new JPanel();

    backButton.setText("< Back");
    backButton.setMnemonic("B".charAt(0));
    backButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            backButton_actionPerformed(e);
          }
        });

    nextButton.setText("Next >");
    nextButton.setMnemonic("N".charAt(0));
    nextButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            nextButton_actionPerformed(e);
          }
        });

    cancelButton.setText("Cancel");
    cancelButton.setMnemonic("C".charAt(0));
    cancelButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cancelButton_actionPerformed(e);
          }
        });

    finishButton.setText("Finish");
    finishButton.setMnemonic("F".charAt(0));
    finishButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            finishButton_actionPerformed(e);
          }
        });

    wizardPanelsContainer.setLayout(new CardLayout());
  }
  /**
   * Constrcutor. Draws the dialog.
   *
   * @param parent the parent frame for this dialog.
   * @param oColour the starting colour to select;
   */
  public UIColorChooserDialog(JFrame parent, Color oColour) {
    super(parent, true);

    setTitle(
        LanguageProperties.getString(
            LanguageProperties.DIALOGS_BUNDLE, "UIColorChooserDialog.title")); // $NON-NLS-1$

    tcc = new JColorChooser(oColour);
    oContentPane = getContentPane();
    JPanel mainpanel = new JPanel(new BorderLayout());
    mainpanel.setBorder(new EmptyBorder(10, 10, 10, 10));

    mainpanel.add(tcc, BorderLayout.CENTER);

    JPanel buttonpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));

    // Add export button
    pbSave =
        new UIButton(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIColorChooserDialog.saveButton")); //$NON-NLS-1$
    pbSave.setMnemonic(
        LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE, "UIColorChooserDialog.saveButtonMnemonic")
            .charAt(0)); // $NON-NLS-1$
    pbSave.addActionListener(this);
    getRootPane().setDefaultButton(pbSave);
    buttonpanel.add(pbSave);

    // Add close button
    pbCancel =
        new UIButton(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UIColorChooserDialog.cancelButton")); //$NON-NLS-1$
    pbCancel.setMnemonic(
        LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE, "UIColorChooserDialog.cancelButtonMnemonic")
            .charAt(0)); // $NON-NLS-1$
    pbCancel.addActionListener(this);
    buttonpanel.add(pbCancel);

    mainpanel.add(buttonpanel, BorderLayout.SOUTH);
    oContentPane.add(mainpanel);

    pack();
  }
 /**
  * Cria e devolve o botão de comando btnConverter.
  *
  * @return botão de comando btnConverter
  */
 private JButton criarBotaoConverter() {
   JButton btn = new JButton("Converter");
   btn.setMnemonic(KeyEvent.VK_C);
   btn.setToolTipText("Efectua a conversão centígrados->fahrnheit");
   btn.addActionListener(trataEvento);
   return btn;
 }
 /**
  * Cria e devolve o botão de comando btnSair.
  *
  * @return botão de comando btnSair
  */
 private JButton criarBotaoSair() {
   JButton btn = new JButton("Sair");
   btn.setToolTipText("Fecha o programa");
   btn.setMnemonic(KeyEvent.VK_S);
   btn.addActionListener(trataEvento);
   return btn;
 }
 private void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20);
   contentPane.setBorder(border1);
   contentPane.setLayout(borderLayout1);
   controlsPane.setLayout(gridLayout1);
   gridLayout1.setColumns(1);
   gridLayout1.setHgap(10);
   gridLayout1.setRows(0);
   gridLayout1.setVgap(10);
   okButton.setVerifyInputWhenFocusTarget(true);
   okButton.setMnemonic('O');
   okButton.setText("OK");
   buttonsPane.setLayout(flowLayout1);
   flowLayout1.setAlignment(FlowLayout.CENTER);
   messagePane.setEditable(false);
   messagePane.setText("");
   borderLayout1.setHgap(10);
   borderLayout1.setVgap(10);
   this.setTitle("Subscription Authorization");
   this.getContentPane().add(contentPane, BorderLayout.CENTER);
   contentPane.add(controlsPane, BorderLayout.SOUTH);
   controlsPane.add(responsesComboBox, null);
   controlsPane.add(buttonsPane, null);
   buttonsPane.add(okButton, null);
   contentPane.add(messageScrollPane, BorderLayout.CENTER);
   messageScrollPane.getViewport().add(messagePane, null);
 }
Example #12
0
  /** Initializes the call button. */
  private void initCallButton() {
    List<ProtocolProviderService> telephonyProviders = CallManager.getTelephonyProviders();

    if (telephonyProviders != null && telephonyProviders.size() > 0) {
      if (callButton.getParent() != null) return;

      callButton.setAlignmentX(JButton.CENTER_ALIGNMENT);

      callButton.setMnemonic(
          GuiActivator.getResources().getI18nMnemonic("service.gui.CALL_CONTACT"));

      buttonPanel.add(callButton);

      callButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              String searchText = parentWindow.getCurrentSearchText();

              if (searchText == null) return;

              CallManager.createCall(searchText, callButton);
            }
          });
    } else {
      buttonPanel.remove(callButton);
    }
  }
  private JButton getNewInputVariableQueryButton() {
    inputVariableQueryButton = new JButton("XPath Expression");
    inputVariableQueryButton.setToolTipText(
        "Generates an XPath expression returning this variable");
    inputVariableQueryButton.setMnemonic(KeyEvent.VK_X);
    inputVariableQueryButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            try {
              xQueryEditor
                  .getDocument()
                  .insertString(
                      xQueryEditor.getCaretPosition(),
                      XMLUtilities.getXPathPredicateExpression(
                          inputVariableComboBox.getSelectedVariable()),
                      null);
            } catch (Exception e) {
              xQueryEditor.setText(
                  xQueryEditor.getText()
                      + XMLUtilities.getXPathPredicateExpression(
                          inputVariableComboBox.getSelectedVariable()));
            }
          }
        });

    return inputVariableQueryButton;
  }
 /**
  * Cria e devolve o botão de comando btnLimpar.
  *
  * @return botão de comando btnLimpar
  */
 private JButton criarBotaoLimpar() {
   JButton btn = new JButton("Limpar");
   btn.setToolTipText("Limpa o contéudo dos campos de texto");
   btn.setMnemonic(KeyEvent.VK_L);
   btn.addActionListener(trataEvento);
   return btn;
 }
 private JButton getPredefinedQualityButton() {
   if (predefinedQualityButton == null) {
     predefinedQualityButton = new JButton("Quality");
     predefinedQualityButton.setMnemonic('Q');
     predefinedQualityButton.addActionListener(eventHandler);
   }
   return predefinedQualityButton;
 }
Example #16
0
 public JButton getReplaceFindButton() {
   if (replaceFindButton == null) {
     replaceFindButton = new JButton("Replace...");
     replaceFindButton.setMnemonic('R');
     replaceFindButton.addActionListener(this);
   }
   return replaceFindButton;
 }
 public objUpdate() {
   super("Person");
   setBounds(150, 150, 200, 120);
   setResizable(false);
   setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
   Container con = this.getContentPane();
   con.setLayout(new FlowLayout());
   con.add(n);
   con.add(d);
   next.setMnemonic('N');
   newPerson.setMnemonic('P');
   con.add(next);
   con.add(newPerson);
   this.addWindowListener(new Window());
   next.addActionListener(new Next());
   newPerson.addActionListener(new NewPerson());
   setVisible(true);
 }
 private JButton getDisableAllSoundsButton() {
   if (disableAllSoundsButton == null) {
     disableAllSoundsButton = new JButton("Disable all");
     disableAllSoundsButton.setMnemonic('i');
     disableAllSoundsButton.setDisplayedMnemonicIndex(1);
     disableAllSoundsButton.addActionListener(eventHandler);
   }
   return disableAllSoundsButton;
 }
Example #19
0
 public JButton getCloseButton() {
   if (closeButton == null) {
     closeButton = new JButton();
     closeButton.setText("Close");
     closeButton.setMnemonic('C');
     closeButton.addActionListener(this);
   }
   return closeButton;
 }
 private JButton getPredefinedPlatformDefaultButton() {
   if (predefinedPlaformDefaultButton == null) {
     predefinedPlaformDefaultButton = new JButton("Default");
     predefinedPlaformDefaultButton.setMnemonic('u');
     predefinedPlaformDefaultButton.setDisplayedMnemonicIndex(4);
     predefinedPlaformDefaultButton.addActionListener(eventHandler);
   }
   return predefinedPlaformDefaultButton;
 }
 private JButton getEnableAllSoundsButton() {
   if (enableAllSoundsButton == null) {
     enableAllSoundsButton = new JButton("Enable all");
     enableAllSoundsButton.setMnemonic('a');
     enableAllSoundsButton.setDisplayedMnemonicIndex(7);
     enableAllSoundsButton.addActionListener(eventHandler);
   }
   return enableAllSoundsButton;
 }
 private JButton getMixerDefaultButton() {
   if (mixerDefaultButton == null) {
     mixerDefaultButton = new JButton("Default");
     mixerDefaultButton.setMnemonic('u');
     mixerDefaultButton.setDisplayedMnemonicIndex(4);
     mixerDefaultButton.addActionListener(eventHandler);
   }
   return mixerDefaultButton;
 }
Example #23
0
 private JButton getAddButton() {
   if (addButton == null) {
     addButton = new JButton();
     addButton.setText("Add ->");
     addButton.setMnemonic('A');
     addButton.addActionListener(eventHandler);
   }
   return addButton;
 }
 private JButton getPredefinedSpeedButton() {
   if (predefinedSpeedButton == null) {
     predefinedSpeedButton = new JButton("Speed");
     predefinedSpeedButton.setMnemonic('p');
     predefinedSpeedButton.setDisplayedMnemonicIndex(1);
     predefinedSpeedButton.addActionListener(eventHandler);
   }
   return predefinedSpeedButton;
 }
Example #25
0
 private JButton getRemoveButton() {
   if (removeButton == null) {
     removeButton = new JButton();
     removeButton.setText("<- Remove");
     removeButton.setMnemonic('m');
     removeButton.setDisplayedMnemonicIndex(5);
     removeButton.addActionListener(eventHandler);
   }
   return removeButton;
 }
Example #26
0
 private JButton getAddAllButton() {
   if (addAllButton == null) {
     addAllButton = new JButton();
     addAllButton.setText("Add All ->");
     addAllButton.setMnemonic('l');
     addAllButton.setDisplayedMnemonicIndex(5);
     addAllButton.addActionListener(eventHandler);
   }
   return addAllButton;
 }
Example #27
0
 public JButton getFindNextButton() {
   if (findNextButton == null) {
     findNextButton = new JButton();
     findNextButton.setText("Find Next");
     findNextButton.setMnemonic('F');
     findNextButton.setDefaultCapable(true);
     findNextButton.addActionListener(this);
   }
   return findNextButton;
 }
Example #28
0
 public JButton getReplaceButton() {
   if (replaceButton == null) {
     replaceButton = new JButton();
     replaceButton.setText("Replace");
     replaceButton.setMnemonic('R');
     replaceButton.setDefaultCapable(true);
     replaceButton.addActionListener(this);
   }
   return replaceButton;
 }
Example #29
0
 public JButton getReplaceAllButton() {
   if (replaceAllButton == null) {
     replaceAllButton = new JButton();
     replaceAllButton.setText("Replace All");
     replaceAllButton.setMnemonic('A');
     replaceAllButton.setDisplayedMnemonicIndex(8);
     replaceAllButton.addActionListener(this);
   }
   return replaceAllButton;
 }
Example #30
0
  public void addFields() {
    //		gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.ipadx = 20;
    content.add(new JLabel("Host", JLabel.CENTER), gbc);
    gbc.gridy++;
    content.add(new JLabel("Database", JLabel.CENTER), gbc);
    gbc.gridy++;
    content.add(new JLabel("Table", JLabel.CENTER), gbc);
    gbc.gridy++;
    content.add(new JLabel("Username", JLabel.CENTER), gbc);
    gbc.gridy++;
    content.add(new JLabel("Password", JLabel.CENTER), gbc);
    gbc.gridy = 0;
    gbc.gridx = 1;
    content.add(host, gbc);
    gbc.gridy++;
    content.add(database, gbc);
    gbc.gridy++;
    content.add(table, gbc);
    gbc.gridy++;
    content.add(username, gbc);
    gbc.gridy++;
    content.add(password, gbc);
    gbc.gridy++;
    login.setMnemonic(KeyEvent.VK_L);

    ActionListener act =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (e.getSource() == login) {
              if (username.getText().length() > 0) alive = false;
              else {
                showMessage("Username required", "At least enter a username :)");
              }
            }
            if (e.getSource() == exit) {
              System.exit(0);
            }
          }
        };

    login.addActionListener(act);
    exit.addActionListener(act);
    JPanel p = new JPanel(new FlowLayout());
    p.add(login);
    p.add(exit);

    gbc.gridx = 0;
    gbc.gridwidth = 2;
    content.add(p, gbc);

    username.addKeyListener(this);
    password.addKeyListener(this);
    login.addKeyListener(this);
  }