use of javax.swing.JScrollPane in project gitblit by gitblit.
the class EditRepositoryDialog method setCustomFields.
public void setCustomFields(RepositoryModel repository, Map<String, String> customFields) {
customFieldsPanel.removeAll();
customTextfields = new ArrayList<JTextField>();
final Insets insets = new Insets(5, 5, 5, 5);
JPanel fields = new JPanel(new GridLayout(0, 1, 0, 5)) {
private static final long serialVersionUID = 1L;
@Override
public Insets getInsets() {
return insets;
}
};
for (Map.Entry<String, String> entry : customFields.entrySet()) {
String field = entry.getKey();
String value = "";
if (repository.customFields != null && repository.customFields.containsKey(field)) {
value = repository.customFields.get(field);
}
JTextField textField = new JTextField(value);
textField.setName(field);
textField.setPreferredSize(new Dimension(450, 26));
fields.add(newFieldPanel(entry.getValue(), 250, textField));
customTextfields.add(textField);
}
JScrollPane jsp = new JScrollPane(fields);
jsp.getVerticalScrollBar().setBlockIncrement(100);
jsp.getVerticalScrollBar().setUnitIncrement(100);
jsp.setViewportBorder(null);
customFieldsPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
customFieldsPanel.add(jsp);
}
use of javax.swing.JScrollPane in project gitblit by gitblit.
the class SettingPanel method initialize.
private void initialize() {
descriptionArea = new JTextArea();
descriptionArea.setRows(6);
descriptionArea.setFont(new Font("monospaced", Font.PLAIN, 11));
descriptionArea.setEditable(false);
settingName = new JLabel(" ");
settingName.setFont(settingName.getFont().deriveFont(Font.BOLD));
settingDefault = new JLabel(" ");
sinceVersion = new JLabel(" ", SwingConstants.RIGHT);
sinceVersion.setForeground(new Color(0, 0x80, 0));
directives = new JLabel(" ", SwingConstants.RIGHT);
directives.setFont(directives.getFont().deriveFont(Font.ITALIC));
JPanel settingParameters = new JPanel(new GridLayout(2, 2, 0, 0));
settingParameters.add(settingName);
settingParameters.add(sinceVersion);
settingParameters.add(settingDefault, BorderLayout.CENTER);
settingParameters.add(directives);
JPanel settingPanel = new JPanel(new BorderLayout(5, 5));
settingPanel.add(settingParameters, BorderLayout.NORTH);
settingPanel.add(new JScrollPane(descriptionArea), BorderLayout.CENTER);
setLayout(new BorderLayout(0, 0));
add(settingPanel, BorderLayout.CENTER);
}
use of javax.swing.JScrollPane in project gitblit by gitblit.
the class SettingsPanel method initialize.
private void initialize() {
JButton refreshSettings = new JButton(Translation.get("gb.refresh"));
refreshSettings.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
refreshSettings();
}
});
final JButton editSetting = new JButton(Translation.get("gb.edit"));
editSetting.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int viewRow = table.getSelectedRow();
int modelRow = table.convertRowIndexToModel(viewRow);
String key = tableModel.keys.get(modelRow);
SettingModel setting = tableModel.settings.get(key);
editSetting(setting);
}
});
NameRenderer nameRenderer = new NameRenderer();
final SettingPanel settingPanel = new SettingPanel();
tableModel = new SettingsTableModel();
defaultSorter = new TableRowSorter<SettingsTableModel>(tableModel);
table = Utils.newTable(tableModel, Utils.DATE_FORMAT);
table.setDefaultRenderer(SettingModel.class, new SettingCellRenderer());
String name = table.getColumnName(UsersTableModel.Columns.Name.ordinal());
table.getColumn(name).setCellRenderer(nameRenderer);
table.setRowSorter(defaultSorter);
table.getRowSorter().toggleSortOrder(SettingsTableModel.Columns.Name.ordinal());
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
boolean singleSelection = table.getSelectedRows().length == 1;
editSetting.setEnabled(singleSelection);
if (singleSelection) {
int viewRow = table.getSelectedRow();
int modelRow = table.convertRowIndexToModel(viewRow);
SettingModel setting = tableModel.get(modelRow);
settingPanel.setSetting(setting);
} else {
settingPanel.clear();
}
}
});
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
int viewRow = table.getSelectedRow();
int modelRow = table.convertRowIndexToModel(viewRow);
SettingModel setting = tableModel.get(modelRow);
editSetting(setting);
}
}
});
filterTextfield = new JTextField();
filterTextfield.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
filterSettings(filterTextfield.getText());
}
});
filterTextfield.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
filterSettings(filterTextfield.getText());
}
});
JPanel settingFilterPanel = new JPanel(new BorderLayout(Utils.MARGIN, Utils.MARGIN));
settingFilterPanel.add(new JLabel(Translation.get("gb.filter")), BorderLayout.WEST);
settingFilterPanel.add(filterTextfield, BorderLayout.CENTER);
JPanel settingsTablePanel = new JPanel(new BorderLayout(Utils.MARGIN, Utils.MARGIN));
settingsTablePanel.add(settingFilterPanel, BorderLayout.NORTH);
settingsTablePanel.add(new JScrollPane(table), BorderLayout.CENTER);
settingsTablePanel.add(settingPanel, BorderLayout.SOUTH);
JPanel settingsControls = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
settingsControls.add(refreshSettings);
settingsControls.add(editSetting);
setLayout(new BorderLayout(Utils.MARGIN, Utils.MARGIN));
header = new HeaderPanel(Translation.get("gb.settings"), "settings_16x16.png");
add(header, BorderLayout.NORTH);
add(settingsTablePanel, BorderLayout.CENTER);
add(settingsControls, BorderLayout.SOUTH);
}
use of javax.swing.JScrollPane in project gitblit by gitblit.
the class StatusPanel method initialize.
private void initialize() {
JButton refreshStatus = new JButton(Translation.get("gb.refresh"));
refreshStatus.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
refreshStatus();
}
});
version = new JLabel();
releaseDate = new JLabel();
bootDate = new JLabel();
url = new JLabel();
servletContainer = new JLabel();
heapMaximum = new JLabel();
heapAllocated = new JLabel();
heapUsed = new JLabel();
JPanel fieldsPanel = new JPanel(new GridLayout(0, 1, 0, Utils.MARGIN)) {
private static final long serialVersionUID = 1L;
@Override
public Insets getInsets() {
return Utils.INSETS;
}
};
fieldsPanel.add(createFieldPanel("gb.version", version));
fieldsPanel.add(createFieldPanel("gb.releaseDate", releaseDate));
fieldsPanel.add(createFieldPanel("gb.bootDate", bootDate));
fieldsPanel.add(createFieldPanel("gb.url", url));
fieldsPanel.add(createFieldPanel("gb.servletContainer", servletContainer));
fieldsPanel.add(createFieldPanel("gb.heapUsed", heapUsed));
fieldsPanel.add(createFieldPanel("gb.heapAllocated", heapAllocated));
fieldsPanel.add(createFieldPanel("gb.heapMaximum", heapMaximum));
tableModel = new PropertiesTableModel();
JTable propertiesTable = Utils.newTable(tableModel, Utils.DATE_FORMAT);
String name = propertiesTable.getColumnName(PropertiesTableModel.Columns.Name.ordinal());
NameRenderer nameRenderer = new NameRenderer();
propertiesTable.getColumn(name).setCellRenderer(nameRenderer);
JPanel centerPanel = new JPanel(new BorderLayout(Utils.MARGIN, Utils.MARGIN));
centerPanel.add(fieldsPanel, BorderLayout.NORTH);
centerPanel.add(new JScrollPane(propertiesTable), BorderLayout.CENTER);
JPanel controls = new JPanel(new FlowLayout(FlowLayout.CENTER, Utils.MARGIN, 0));
controls.add(refreshStatus);
header = new HeaderPanel(Translation.get("gb.status"), "health_16x16.png");
setLayout(new BorderLayout(Utils.MARGIN, Utils.MARGIN));
add(header, BorderLayout.NORTH);
add(centerPanel, BorderLayout.CENTER);
add(controls, BorderLayout.SOUTH);
}
use of javax.swing.JScrollPane in project gephi by gephi.
the class SplineControlPanel method createTemplates.
private Component createTemplates() {
DefaultListModel model = new DefaultListModel();
model.addElement(createTemplate(0.0, 0.0, 1.0, 1.0));
model.addElement(createTemplate(0.0, 1.0, 0.0, 1.0));
model.addElement(createTemplate(0.0, 1.0, 1.0, 1.0));
model.addElement(createTemplate(0.0, 1.0, 1.0, 0.0));
model.addElement(createTemplate(1.0, 0.0, 0.0, 1.0));
model.addElement(createTemplate(1.0, 0.0, 1.0, 1.0));
model.addElement(createTemplate(1.0, 0.0, 1.0, 0.0));
JList list = new JList(model);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setCellRenderer(new TemplateCellRenderer());
list.addListSelectionListener(new TemplateSelectionHandler());
JScrollPane pane = new JScrollPane(list);
pane.getViewport().setPreferredSize(new Dimension(98, 97 * 3));
return pane;
}
Aggregations