private JPanel createPreviewPanel() {
    JPanel panel;
    YBoxPanel headerPanel;
    JScrollPane scroll;

    panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder(Translator.get("preview")));

    headerPanel = new YBoxPanel();
    headerPanel.add(new JLabel(Translator.get("run_dialog.run_command_description") + ":"));
    headerPanel.add(historyPreview = new EditableComboBox(new JTextField("mucommander -v")));
    historyPreview.addItem("mucommander -v");
    historyPreview.addItem("java -version");

    headerPanel.addSpace(10);
    headerPanel.add(new JLabel(Translator.get("run_dialog.command_output") + ":"));

    panel.add(headerPanel, BorderLayout.NORTH);

    shellPreview = new JTextArea(15, 15);
    panel.add(
        scroll =
            new JScrollPane(
                shellPreview,
                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED),
        BorderLayout.CENTER);
    scroll.getViewport().setPreferredSize(shellPreview.getPreferredSize());
    shellPreview.append(RuntimeConstants.APP_STRING);
    shellPreview.append("\nCopyright (C) ");
    shellPreview.append(RuntimeConstants.COPYRIGHT);
    shellPreview.append(
        " Maxence Bernard\nThis is free software, distributed under the terms of the GNU General Public License.");
    //        shellPreview.setLineWrap(true);
    shellPreview.setCaretPosition(0);

    setForegroundColors();
    setBackgroundColors();

    return panel;
  }
Example #2
0
    public OptionsDialog(JFrame parent) {
      super(parent, Globals.lang("Writing XMP metadata for selected entries..."), false);
      okButton.setEnabled(false);

      okButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              dispose();
            }
          });

      AbstractAction cancel =
          new AbstractAction() {
            private static final long serialVersionUID = -338601477652815366L;

            public void actionPerformed(ActionEvent e) {
              canceled = true;
            }
          };
      cancelButton.addActionListener(cancel);

      InputMap im = cancelButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
      ActionMap am = cancelButton.getActionMap();
      im.put(Globals.prefs.getKey("Close dialog"), "close");
      am.put("close", cancel);

      progressArea = new JTextArea(15, 60);

      JScrollPane scrollPane =
          new JScrollPane(
              progressArea,
              JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
              JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      Dimension d = progressArea.getPreferredSize();
      d.height += scrollPane.getHorizontalScrollBar().getHeight() + 15;
      d.width += scrollPane.getVerticalScrollBar().getWidth() + 15;

      panel.setSize(d);

      progressArea.setBackground(Color.WHITE);
      progressArea.setEditable(false);
      progressArea.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
      progressArea.setText("");

      JPanel panel = new JPanel();
      panel.setBorder(BorderFactory.createEmptyBorder(3, 2, 3, 2));
      panel.add(scrollPane);

      // progressArea.setPreferredSize(new Dimension(300, 300));

      ButtonBarBuilder bb = new ButtonBarBuilder();
      bb.addGlue();
      bb.addGridded(okButton);
      bb.addRelatedGap();
      bb.addGridded(cancelButton);
      bb.addGlue();
      JPanel bbPanel = bb.getPanel();
      bbPanel.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3));
      getContentPane().add(panel, BorderLayout.CENTER);
      getContentPane().add(bbPanel, BorderLayout.SOUTH);

      pack();
      this.setResizable(false);
    }