Search in sources :

Example 51 with BorderLayout

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);
}
Also used : SettingModel(com.gitblit.models.SettingModel) JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) MouseEvent(java.awt.event.MouseEvent) FlowLayout(java.awt.FlowLayout) ActionEvent(java.awt.event.ActionEvent) KeyAdapter(java.awt.event.KeyAdapter) JButton(javax.swing.JButton) ListSelectionEvent(javax.swing.event.ListSelectionEvent) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) ListSelectionListener(javax.swing.event.ListSelectionListener) KeyEvent(java.awt.event.KeyEvent) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout)

Example 52 with BorderLayout

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) GridLayout(java.awt.GridLayout) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable)

Example 53 with BorderLayout

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JTextArea(javax.swing.JTextArea) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) CPanelTwoButtons(com.google.security.zynamics.zylib.gui.CPanelTwoButtons)

Example 54 with BorderLayout

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);
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) LineBorder(javax.swing.border.LineBorder) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder) EmptyBorder(javax.swing.border.EmptyBorder)

Example 55 with BorderLayout

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTextArea(javax.swing.JTextArea) BorderLayout(java.awt.BorderLayout) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) TitledBorder(javax.swing.border.TitledBorder)

Aggregations

BorderLayout (java.awt.BorderLayout)761 JPanel (javax.swing.JPanel)514 JLabel (javax.swing.JLabel)238 JScrollPane (javax.swing.JScrollPane)191 Dimension (java.awt.Dimension)155 JButton (javax.swing.JButton)134 FlowLayout (java.awt.FlowLayout)90 ActionEvent (java.awt.event.ActionEvent)88 JTextField (javax.swing.JTextField)85 EmptyBorder (javax.swing.border.EmptyBorder)73 ActionListener (java.awt.event.ActionListener)70 JCheckBox (javax.swing.JCheckBox)69 Insets (java.awt.Insets)64 BoxLayout (javax.swing.BoxLayout)62 GridBagConstraints (java.awt.GridBagConstraints)57 GridBagLayout (java.awt.GridBagLayout)57 JTable (javax.swing.JTable)57 JTextArea (javax.swing.JTextArea)52 GridLayout (java.awt.GridLayout)49 Box (javax.swing.Box)45