Ejemplo n.º 1
0
 public void focusLost(FocusEvent e) {
   e.getComponent().setBackground(UiConfig.getThemeColor(ThemeColor.BACKGROUND));
 }
Ejemplo n.º 2
0
  private void build() {
    // ============= le panel du dialog
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    // ================================
    catBox = new JComboBox(categories);
    catBox.setMinimumSize(new Dimension(150, 60));
    catBox.setMaximumSize(new Dimension(2000, 80));
    catBox.setBorder(BorderFactory.createTitledBorder("TYPE"));
    catBox.addFocusListener(this);
    panel.add(catBox);

    // ========= Le nom du nouveau media
    nameField.setMinimumSize(new Dimension(150, 60));
    nameField.setMaximumSize(new Dimension(2000, 80));
    nameField.setBorder(BorderFactory.createTitledBorder("NAME"));
    nameField.addFocusListener(this);
    nameField.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {
            nameField.selectAll();
          }

          public void focusLost(FocusEvent e) {}
        });
    panel.add(nameField);

    // ========== La release date par default
    dateChooser.setMinimumSize(new Dimension(150, 60));
    dateChooser.setMaximumSize(new Dimension(2000, 80));
    dateChooser.setFormats(UiConfig.getProperty(UiConfig.LONG_DATE_FORMAT));
    dateChooser.setDate(new Date());
    dateChooser.setBorder(BorderFactory.createTitledBorder("RELEASE DATE"));
    panel.add(dateChooser);

    // ============
    formatField.setMinimumSize(new Dimension(150, 60));
    formatField.setMaximumSize(new Dimension(2000, 80));
    formatField.setBorder(BorderFactory.createTitledBorder("FORMAT(experimental)"));
    formatField.addFocusListener(this);
    formatField.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {
            formatField.selectAll();
          }

          public void focusLost(FocusEvent e) {}
        });
    panel.add(formatField);

    // ============ Le bouton ok
    okButton.setActionCommand("CREATE");
    okButton.setToolTipText("Create " + catBox.getSelectedItem() + " " + nameField.getText());
    okButton.addActionListener(this);
    Icon icon1 = ThemeIcon.SAVE.d32x32();
    if (icon1 != null) {
      okButton.setText("");
      okButton.setIcon(icon1);
    }

    // =========== Le bouton cancel
    cancelButton.setActionCommand("CANCEL");
    cancelButton.addActionListener(this);
    cancelButton.setToolTipText("Cancel");
    Icon icon2 = ThemeIcon.CANCEL.d32x32();
    if (icon2 != null) {
      cancelButton.setText("");
      cancelButton.setIcon(icon2);
    }

    // =========== La toolBar
    toolBar.add(okButton);
    toolBar.add(cancelButton);
    panel.add(new JLabel());
    panel.add(toolBar);
    toolBar.setAlignmentX(CENTER_ALIGNMENT);
  }
Ejemplo n.º 3
0
 // =========== Les listeners
 public void focusGained(FocusEvent e) {
   e.getComponent().setBackground(UiConfig.getThemeColor(ThemeColor.TABLE_CELL_FOCUSED));
 }