protected void installStrings(JFileChooser fc) {
    super.installStrings(fc);

    Locale l = fc.getLocale();

    enterFileNameLabelText = UIManager.getString("FileChooser.enterFileNameLabelText", l);
    enterFileNameLabelMnemonic = UIManager.getInt("FileChooser.enterFileNameLabelMnemonic");

    filesLabelText = UIManager.getString("FileChooser.filesLabelText", l);
    filesLabelMnemonic = UIManager.getInt("FileChooser.filesLabelMnemonic");

    foldersLabelText = UIManager.getString("FileChooser.foldersLabelText", l);
    foldersLabelMnemonic = UIManager.getInt("FileChooser.foldersLabelMnemonic");

    pathLabelText = UIManager.getString("FileChooser.pathLabelText", l);
    pathLabelMnemonic = UIManager.getInt("FileChooser.pathLabelMnemonic");

    filterLabelText = UIManager.getString("FileChooser.filterLabelText", l);
    filterLabelMnemonic = UIManager.getInt("FileChooser.filterLabelMnemonic");
  }
Ejemplo n.º 2
0
  /**
   * Returns the buttons to display from the JOptionPane the receiver is providing the look and feel
   * for. If the JOptionPane has options set, they will be provided, otherwise if the optionType is
   * YES_NO_OPTION, yesNoOptions is returned, if the type is YES_NO_CANCEL_OPTION yesNoCancelOptions
   * is returned, otherwise defaultButtons are returned.
   */
  protected Object[] getButtons() {
    if (optionPane != null) {
      Object[] suppliedOptions = optionPane.getOptions();

      if (suppliedOptions == null) {
        Object[] defaultOptions;
        int type = optionPane.getOptionType();
        Locale l = optionPane.getLocale();
        int minimumWidth =
            DefaultLookup.getInt(optionPane, this, "OptionPane.buttonMinimumWidth", -1);
        if (type == JOptionPane.YES_NO_OPTION) {
          defaultOptions = new ButtonFactory[2];
          defaultOptions[0] =
              new ButtonFactory(
                  UIManager.getString("OptionPane.yesButtonText", l),
                  getMnemonic("OptionPane.yesButtonMnemonic", l),
                  (Icon) DefaultLookup.get(optionPane, this, "OptionPane.yesIcon"),
                  minimumWidth);
          defaultOptions[1] =
              new ButtonFactory(
                  UIManager.getString("OptionPane.noButtonText", l),
                  getMnemonic("OptionPane.noButtonMnemonic", l),
                  (Icon) DefaultLookup.get(optionPane, this, "OptionPane.noIcon"),
                  minimumWidth);
        } else if (type == JOptionPane.YES_NO_CANCEL_OPTION) {
          defaultOptions = new ButtonFactory[3];
          defaultOptions[0] =
              new ButtonFactory(
                  UIManager.getString("OptionPane.yesButtonText", l),
                  getMnemonic("OptionPane.yesButtonMnemonic", l),
                  (Icon) DefaultLookup.get(optionPane, this, "OptionPane.yesIcon"),
                  minimumWidth);
          defaultOptions[1] =
              new ButtonFactory(
                  UIManager.getString("OptionPane.noButtonText", l),
                  getMnemonic("OptionPane.noButtonMnemonic", l),
                  (Icon) DefaultLookup.get(optionPane, this, "OptionPane.noIcon"),
                  minimumWidth);
          defaultOptions[2] =
              new ButtonFactory(
                  UIManager.getString("OptionPane.cancelButtonText", l),
                  getMnemonic("OptionPane.cancelButtonMnemonic", l),
                  (Icon) DefaultLookup.get(optionPane, this, "OptionPane.cancelIcon"),
                  minimumWidth);
        } else if (type == JOptionPane.OK_CANCEL_OPTION) {
          defaultOptions = new ButtonFactory[2];
          defaultOptions[0] =
              new ButtonFactory(
                  UIManager.getString("OptionPane.okButtonText", l),
                  getMnemonic("OptionPane.okButtonMnemonic", l),
                  (Icon) DefaultLookup.get(optionPane, this, "OptionPane.okIcon"),
                  minimumWidth);
          defaultOptions[1] =
              new ButtonFactory(
                  UIManager.getString("OptionPane.cancelButtonText", l),
                  getMnemonic("OptionPane.cancelButtonMnemonic", l),
                  (Icon) DefaultLookup.get(optionPane, this, "OptionPane.cancelIcon"),
                  minimumWidth);
        } else {
          defaultOptions = new ButtonFactory[1];
          defaultOptions[0] =
              new ButtonFactory(
                  UIManager.getString("OptionPane.okButtonText", l),
                  getMnemonic("OptionPane.okButtonMnemonic", l),
                  (Icon) DefaultLookup.get(optionPane, this, "OptionPane.okIcon"),
                  minimumWidth);
        }
        return defaultOptions;
      }
      return suppliedOptions;
    }
    return null;
  }
Ejemplo n.º 3
0
  protected void installStrings(JFileChooser fc) {

    Locale l = fc.getLocale();
    newFolderErrorText = UIManager.getString("FileChooser.newFolderErrorText", l);
    newFolderErrorSeparator = UIManager.getString("FileChooser.newFolderErrorSeparator", l);

    newFolderParentDoesntExistTitleText =
        UIManager.getString("FileChooser.newFolderParentDoesntExistTitleText", l);
    newFolderParentDoesntExistText =
        UIManager.getString("FileChooser.newFolderParentDoesntExistText", l);

    fileDescriptionText = UIManager.getString("FileChooser.fileDescriptionText", l);
    directoryDescriptionText = UIManager.getString("FileChooser.directoryDescriptionText", l);

    saveButtonText = UIManager.getString("FileChooser.saveButtonText", l);
    openButtonText = UIManager.getString("FileChooser.openButtonText", l);
    saveDialogTitleText = UIManager.getString("FileChooser.saveDialogTitleText", l);
    openDialogTitleText = UIManager.getString("FileChooser.openDialogTitleText", l);
    cancelButtonText = UIManager.getString("FileChooser.cancelButtonText", l);
    updateButtonText = UIManager.getString("FileChooser.updateButtonText", l);
    helpButtonText = UIManager.getString("FileChooser.helpButtonText", l);
    directoryOpenButtonText = UIManager.getString("FileChooser.directoryOpenButtonText", l);

    saveButtonMnemonic = getMnemonic("FileChooser.saveButtonMnemonic", l);
    openButtonMnemonic = getMnemonic("FileChooser.openButtonMnemonic", l);
    cancelButtonMnemonic = getMnemonic("FileChooser.cancelButtonMnemonic", l);
    updateButtonMnemonic = getMnemonic("FileChooser.updateButtonMnemonic", l);
    helpButtonMnemonic = getMnemonic("FileChooser.helpButtonMnemonic", l);
    directoryOpenButtonMnemonic = getMnemonic("FileChooser.directoryOpenButtonMnemonic", l);

    saveButtonToolTipText = UIManager.getString("FileChooser.saveButtonToolTipText", l);
    openButtonToolTipText = UIManager.getString("FileChooser.openButtonToolTipText", l);
    cancelButtonToolTipText = UIManager.getString("FileChooser.cancelButtonToolTipText", l);
    updateButtonToolTipText = UIManager.getString("FileChooser.updateButtonToolTipText", l);
    helpButtonToolTipText = UIManager.getString("FileChooser.helpButtonToolTipText", l);
    directoryOpenButtonToolTipText =
        UIManager.getString("FileChooser.directoryOpenButtonToolTipText", l);
  }
Ejemplo n.º 4
0
 public String getDescription() {
   return UIManager.getString("FileChooser.acceptAllFileFilterText");
 }
 public String getDisplayName() {
   return UIManager.getString("ColorChooser.rgbNameText");
 }
  protected void buildChooser() {

    String redString = UIManager.getString("ColorChooser.rgbRedText");
    String greenString = UIManager.getString("ColorChooser.rgbGreenText");
    String blueString = UIManager.getString("ColorChooser.rgbBlueText");

    setLayout(new BorderLayout());
    Color color = getColorFromModel();

    JPanel enclosure = new JPanel();
    enclosure.setLayout(new SmartGridLayout(3, 3));
    enclosure.setInheritsPopupMenu(true);

    // The panel that holds the sliders

    add(enclosure, BorderLayout.CENTER);
    //        sliderPanel.setBorder(new LineBorder(Color.black));

    // The row for the red value
    JLabel l = new JLabel(redString);
    l.setDisplayedMnemonic(AbstractColorChooserPanel.getInt("ColorChooser.rgbRedMnemonic", -1));
    enclosure.add(l);
    redSlider = new JSlider(JSlider.HORIZONTAL, 0, 255, color.getRed());
    redSlider.setMajorTickSpacing(85);
    redSlider.setMinorTickSpacing(17);
    redSlider.setPaintTicks(true);
    redSlider.setPaintLabels(true);
    redSlider.setInheritsPopupMenu(true);
    enclosure.add(redSlider);
    redField = new JSpinner(new SpinnerNumberModel(color.getRed(), minValue, maxValue, 1));
    l.setLabelFor(redSlider);
    redField.setInheritsPopupMenu(true);
    JPanel redFieldHolder = new JPanel(new CenterLayout());
    redFieldHolder.setInheritsPopupMenu(true);
    redField.addChangeListener(this);
    redFieldHolder.add(redField);
    enclosure.add(redFieldHolder);

    // The row for the green value
    l = new JLabel(greenString);
    l.setDisplayedMnemonic(AbstractColorChooserPanel.getInt("ColorChooser.rgbGreenMnemonic", -1));
    enclosure.add(l);
    greenSlider = new JSlider(JSlider.HORIZONTAL, 0, 255, color.getGreen());
    greenSlider.setMajorTickSpacing(85);
    greenSlider.setMinorTickSpacing(17);
    greenSlider.setPaintTicks(true);
    greenSlider.setPaintLabels(true);
    greenSlider.setInheritsPopupMenu(true);
    enclosure.add(greenSlider);
    greenField = new JSpinner(new SpinnerNumberModel(color.getGreen(), minValue, maxValue, 1));
    l.setLabelFor(greenSlider);
    greenField.setInheritsPopupMenu(true);
    JPanel greenFieldHolder = new JPanel(new CenterLayout());
    greenFieldHolder.add(greenField);
    greenFieldHolder.setInheritsPopupMenu(true);
    greenField.addChangeListener(this);
    enclosure.add(greenFieldHolder);

    // The slider for the blue value
    l = new JLabel(blueString);
    l.setDisplayedMnemonic(AbstractColorChooserPanel.getInt("ColorChooser.rgbBlueMnemonic", -1));
    enclosure.add(l);
    blueSlider = new JSlider(JSlider.HORIZONTAL, 0, 255, color.getBlue());
    blueSlider.setMajorTickSpacing(85);
    blueSlider.setMinorTickSpacing(17);
    blueSlider.setPaintTicks(true);
    blueSlider.setPaintLabels(true);
    blueSlider.setInheritsPopupMenu(true);
    enclosure.add(blueSlider);
    blueField = new JSpinner(new SpinnerNumberModel(color.getBlue(), minValue, maxValue, 1));
    l.setLabelFor(blueSlider);
    blueField.setInheritsPopupMenu(true);
    JPanel blueFieldHolder = new JPanel(new CenterLayout());
    blueFieldHolder.add(blueField);
    blueField.addChangeListener(this);
    blueFieldHolder.setInheritsPopupMenu(true);
    enclosure.add(blueFieldHolder);

    redSlider.addChangeListener(this);
    greenSlider.addChangeListener(this);
    blueSlider.addChangeListener(this);

    redSlider.putClientProperty("JSlider.isFilled", Boolean.TRUE);
    greenSlider.putClientProperty("JSlider.isFilled", Boolean.TRUE);
    blueSlider.putClientProperty("JSlider.isFilled", Boolean.TRUE);
  }