use of java.awt.BorderLayout 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 java.awt.BorderLayout 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 java.awt.BorderLayout in project binnavi by google.
the class CGraphSelectionDialog method createGui.
/**
* Creates the GUI of the dialog.
*
* @param views The views to be shown in the table.
*/
private void createGui(final List<INaviView> views) {
setLayout(new BorderLayout());
final JTextArea field = new JTextArea("The debugger stopped at an instruction that does not belong to any open graphs.\nPlease select a graph from the list to continue debugging.");
field.setEditable(false);
add(field, BorderLayout.NORTH);
m_table = new JTable(new CGraphSelectionTableModel(views));
m_table.addMouseListener(m_listener);
add(new JScrollPane(m_table), BorderLayout.CENTER);
final CPanelTwoButtons panel = new CPanelTwoButtons(m_listener, "OK", "Cancel");
add(panel, BorderLayout.SOUTH);
setSize(500, 300);
}
use of java.awt.BorderLayout in project binnavi by google.
the class CProgressPanel method createPanel.
private void createPanel(final boolean indeterminate, final boolean showSeconds, final boolean showCancelButton, final boolean addBorder) {
setLayout(new BorderLayout());
final JPanel pPb = new JPanel(new BorderLayout());
pPb.setBorder(new TitledBorder(""));
if (m_description == null) {
m_label.setVisible(false);
} else {
m_label.setText(convertTextToHtml(m_description));
}
pPb.add(m_label, BorderLayout.NORTH);
m_progressBar.setIndeterminate(indeterminate);
m_progressBar.setStringPainted(true);
final JPanel borderPanel = new JPanel(new BorderLayout());
if (addBorder) {
borderPanel.setBorder(BorderFactory.createCompoundBorder(new LineBorder(Color.GRAY), new EmptyBorder(1, 1, 1, 1)));
}
if (showCancelButton) {
final JPanel buttonPanel = new JPanel(new BorderLayout());
final JButton cancelButton = new JButton(new CancelAction());
cancelButton.setFocusable(false);
final JPanel paddingPanel = new JPanel(new BorderLayout());
paddingPanel.setBorder(new EmptyBorder(0, 1, 0, 0));
paddingPanel.setMinimumSize(new Dimension(1, 0));
buttonPanel.add(paddingPanel, BorderLayout.WEST);
buttonPanel.add(cancelButton, BorderLayout.EAST);
borderPanel.add(buttonPanel, BorderLayout.EAST);
}
borderPanel.add(m_progressBar, BorderLayout.CENTER);
pPb.add(borderPanel, BorderLayout.CENTER);
if (indeterminate && showSeconds) {
updateSecondsText();
m_timer.setRepeats(true);
}
add(pPb, BorderLayout.NORTH);
}
use of java.awt.BorderLayout in project binnavi by google.
the class ErrorDialog method createGui.
private void createGui() {
final JPanel topPanel = new JPanel(new BorderLayout());
final JPanel messagePanel = new JPanel(new BorderLayout());
final JTextField messageField = new JTextField();
messageField.setEditable(false);
messageField.setText(message);
messageField.setBackground(Color.WHITE);
messagePanel.add(messageField);
messagePanel.setBorder(new TitledBorder("Error Message"));
topPanel.add(messagePanel, BorderLayout.NORTH);
final JTabbedPane tabbedPane = new JTabbedPane();
final JTextArea descriptionArea = new JTextArea();
descriptionArea.setEditable(false);
descriptionArea.setText(description);
descriptionArea.setLineWrap(true);
descriptionArea.setWrapStyleWord(true);
tabbedPane.addTab("Description", descriptionArea);
if (exception != null) {
final JTextArea traceArea = new JTextArea();
traceArea.setEditable(false);
traceArea.setText(StackTrace.toString(exception.getStackTrace()));
tabbedPane.addTab("Stack Trace", new JScrollPane(traceArea));
}
add(topPanel, BorderLayout.NORTH);
add(tabbedPane);
final JPanel bottomButtonPanel = new JPanel(new BorderLayout());
final JPanel leftButtonPanelBottom = new JPanel();
final JButton reportButton = new JButton(new ReportAction());
reportButton.setMinimumSize(new Dimension(180, reportButton.getHeight()));
leftButtonPanelBottom.add(reportButton);
bottomButtonPanel.add(leftButtonPanelBottom, BorderLayout.WEST);
final JPanel rightButtonPanelBottom = new JPanel();
final JButton okButton = new JButton(new CloseButtonListener());
getRootPane().setDefaultButton(okButton);
rightButtonPanelBottom.add(okButton);
bottomButtonPanel.add(rightButtonPanelBottom, BorderLayout.EAST);
add(bottomButtonPanel, BorderLayout.SOUTH);
}
Aggregations