use of com.mucommander.commons.util.ui.combobox.EditableComboBox in project mucommander by mucommander.
the class ShellPanel method createPreviewPanel.
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("\nThis is free software, distributed under the terms of the GNU General Public License.");
// shellPreview.setLineWrap(true);
shellPreview.setCaretPosition(0);
setForegroundColors();
setBackgroundColors();
return panel;
}
use of com.mucommander.commons.util.ui.combobox.EditableComboBox in project mucommander by mucommander.
the class SplitFileDialog method initialize.
/**
* Initializes the dialog.
*/
protected void initialize() {
Container content = getContentPane();
content.setLayout(new BorderLayout(0, 5));
XAlignedComponentPanel pnlMain = new XAlignedComponentPanel(10);
pnlMain.addRow(Translator.get("split_file_dialog.file_to_split") + ":", new JLabel(file.getName()), 0);
String size = SizeFormat.format(file.getSize(), SizeFormat.DIGITS_FULL | SizeFormat.UNIT_LONG | SizeFormat.INCLUDE_SPACE);
pnlMain.addRow(Translator.get("size") + ":", new JLabel(size), 10);
edtTargetDirectory = new FilePathField(destFolder.getAbsolutePath(), 40);
pnlMain.addRow(Translator.get("split_file_dialog.target_directory") + ":", edtTargetDirectory, 5);
XBoxPanel pnlSize = new XBoxPanel();
String[] sizes = new String[] { MSG_AUTO, "10 " + Translator.get("unit.mb"), "100 " + Translator.get("unit.mb"), "250 " + Translator.get("unit.mb"), "650 " + Translator.get("unit.mb"), "700 " + Translator.get("unit.mb") };
edtSize = new JTextField();
EditableComboBox cbSize = new EditableComboBox(edtSize, sizes);
cbSize.setComboSelectionUpdatesTextField(true);
cbSize.setSelectedIndex(1);
edtSize.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
updatePartsNumber();
}
});
cbSize.addComboBoxListener(new ComboBoxListener() {
public void comboBoxSelectionChanged(SaneComboBox source) {
updatePartsNumber();
}
});
pnlSize.add(cbSize);
pnlSize.addSpace(10);
pnlSize.add(new JLabel(Translator.get("split_file_dialog.parts") + ":"));
pnlSize.addSpace(5);
spnParts = new JSpinner(new SpinnerNumberModel(1, 1, file.getSize(), 1));
spnParts.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
if (!edtChange) {
long parts = ((Number) spnParts.getValue()).longValue();
long newsize = file.getSize() / parts;
if (file.getSize() % parts != 0) {
newsize++;
}
if (getBytes() != newsize) {
edtSize.setText(Long.toString(newsize));
}
}
}
});
pnlSize.add(spnParts);
pnlMain.addRow(Translator.get("split_file_dialog.part_size") + ":", pnlSize, 0);
cbGenerateCRC = new JCheckBox(Translator.get("split_file_dialog.generate_CRC"));
cbGenerateCRC.setSelected(true);
pnlMain.addRow("", cbGenerateCRC, 0);
content.add(pnlMain, BorderLayout.CENTER);
content.add(getPnlButtons(), BorderLayout.SOUTH);
getRootPane().setDefaultButton(btnSplit);
updatePartsNumber();
}
Aggregations