use of java.awt.FlowLayout 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.FlowLayout 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.FlowLayout in project binnavi by google.
the class MemberDialog method createControls.
private void createControls(final TypeManager typeManager) {
setBounds(100, 100, 450, 215);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
final GridBagLayout gbl_contentPanel = new GridBagLayout();
gbl_contentPanel.columnWidths = new int[] { 0, 0, 0 };
gbl_contentPanel.rowHeights = new int[] { 0, 0, 0, 0 };
gbl_contentPanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
contentPanel.setLayout(gbl_contentPanel);
{
final JLabel lblMemberName = new JLabel("Member name:");
final GridBagConstraints gbc_lblMemberName = new GridBagConstraints();
gbc_lblMemberName.insets = new Insets(0, 0, 5, 5);
gbc_lblMemberName.anchor = GridBagConstraints.EAST;
gbc_lblMemberName.gridx = 0;
gbc_lblMemberName.gridy = 0;
contentPanel.add(lblMemberName, gbc_lblMemberName);
}
{
memberName = new JTextField();
final GridBagConstraints gbc_memberName = new GridBagConstraints();
gbc_memberName.insets = new Insets(0, 0, 5, 0);
gbc_memberName.fill = GridBagConstraints.HORIZONTAL;
gbc_memberName.gridx = 1;
gbc_memberName.gridy = 0;
contentPanel.add(memberName, gbc_memberName);
memberName.setColumns(10);
}
{
final JLabel lblMemberType = new JLabel("Member type:");
final GridBagConstraints gbc_lblMemberType = new GridBagConstraints();
gbc_lblMemberType.anchor = GridBagConstraints.EAST;
gbc_lblMemberType.insets = new Insets(0, 0, 5, 5);
gbc_lblMemberType.gridx = 0;
gbc_lblMemberType.gridy = 1;
contentPanel.add(lblMemberType, gbc_lblMemberType);
}
{
memberType = new TypeComboBox(new TypeListModel(typeManager.getTypes(), new TypeListModel.PrototypesFilter()));
final GridBagConstraints gbc_memberType = new GridBagConstraints();
gbc_memberType.insets = new Insets(0, 0, 5, 0);
gbc_memberType.fill = GridBagConstraints.HORIZONTAL;
gbc_memberType.gridx = 1;
gbc_memberType.gridy = 1;
contentPanel.add(memberType, gbc_memberType);
}
{
final JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
final JButton okButton = new JButton("OK");
okButton.addActionListener(new OkActionListener());
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
final JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
dispose();
}
});
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
}
use of java.awt.FlowLayout in project binnavi by google.
the class TypeDialog method createButtons.
private void createButtons() {
final JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
final JButton okButton = new JButton("Ok");
okButton.addActionListener(new OkActionListener());
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
final JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
dispose();
}
});
buttonPane.add(cancelButton);
}
use of java.awt.FlowLayout in project zaproxy by zaproxy.
the class ScanProgressDialog method initialize.
private void initialize() {
this.setSize(new Dimension(580, 504));
JTabbedPane tabbedPane = new JTabbedPane();
JPanel tab1 = new JPanel();
tab1.setLayout(new GridBagLayout());
JPanel hostPanel = new JPanel();
hostPanel.setLayout(new GridBagLayout());
hostPanel.add(new JLabel(Constant.messages.getString("ascan.progress.label.host")), LayoutHelper.getGBC(0, 0, 1, 0.4D));
hostPanel.add(getHostSelect(), LayoutHelper.getGBC(1, 0, 1, 0.6D));
tab1.add(hostPanel, LayoutHelper.getGBC(0, 0, 3, 1.0D, 0.0D));
tab1.add(getJScrollPane(), LayoutHelper.getGBC(0, 1, 3, 1.0D, 1.0D));
JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
buttonsPanel.add(getCopyToClipboardButton());
buttonsPanel.add(getCloseButton());
tab1.add(buttonsPanel, LayoutHelper.getGBC(0, 2, 3, 1.0D));
tabbedPane.insertTab(Constant.messages.getString("ascan.progress.tab.progress"), null, tab1, null, 0);
this.add(tabbedPane);
int mins = extension.getScannerParam().getMaxChartTimeInMins();
if (mins > 0) {
// Treat zero mins as disabled
JPanel tab2 = new JPanel();
tab2.setLayout(new GridBagLayout());
// Name not shown, so no need to i18n
this.seriesTotal = new TimeSeries("TotalResponses");
final TimeSeriesCollection dataset = new TimeSeriesCollection(this.seriesTotal);
this.series100 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.1xx"));
this.series200 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.2xx"));
this.series300 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.3xx"));
this.series400 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.4xx"));
this.series500 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.5xx"));
long maxAge = mins * 60;
this.seriesTotal.setMaximumItemAge(maxAge);
this.series100.setMaximumItemAge(maxAge);
this.series200.setMaximumItemAge(maxAge);
this.series300.setMaximumItemAge(maxAge);
this.series400.setMaximumItemAge(maxAge);
this.series500.setMaximumItemAge(maxAge);
dataset.addSeries(series100);
dataset.addSeries(series200);
dataset.addSeries(series300);
dataset.addSeries(series400);
dataset.addSeries(series500);
chart = createChart(dataset);
// Set up some vaguesly sensible colours
// Totals
chart.getXYPlot().getRenderer(0).setSeriesPaint(0, Color.BLACK);
// 100: Info
chart.getXYPlot().getRenderer(0).setSeriesPaint(1, Color.GRAY);
// 200: OK
chart.getXYPlot().getRenderer(0).setSeriesPaint(2, Color.GREEN);
// 300: Info
chart.getXYPlot().getRenderer(0).setSeriesPaint(3, Color.BLUE);
// 400: Bad req
chart.getXYPlot().getRenderer(0).setSeriesPaint(4, Color.MAGENTA);
// 500: Internal error
chart.getXYPlot().getRenderer(0).setSeriesPaint(5, Color.RED);
final ChartPanel chartPanel = new ChartPanel(chart);
tab2.add(chartPanel, LayoutHelper.getGBC(0, 0, 1, 1.0D, 1.0D));
tabbedPane.insertTab(Constant.messages.getString("ascan.progress.tab.chart"), null, tab2, null, 1);
}
// Stop the updating thread when the window is closed
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
stopThread = true;
}
});
}
Aggregations