Search in sources :

Example 26 with JScrollPane

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Example 27 with JScrollPane

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) JTextArea(javax.swing.JTextArea) BorderLayout(java.awt.BorderLayout) Color(java.awt.Color) JLabel(javax.swing.JLabel) Font(java.awt.Font)

Example 28 with JScrollPane

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);
}
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 29 with JScrollPane

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);
}
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 30 with JScrollPane

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;
}
Also used : JScrollPane(javax.swing.JScrollPane) DefaultListModel(javax.swing.DefaultListModel) Dimension(java.awt.Dimension) JList(javax.swing.JList)

Aggregations

JScrollPane (javax.swing.JScrollPane)832 JPanel (javax.swing.JPanel)431 Dimension (java.awt.Dimension)271 JLabel (javax.swing.JLabel)269 BorderLayout (java.awt.BorderLayout)260 JButton (javax.swing.JButton)191 GridBagLayout (java.awt.GridBagLayout)149 JTable (javax.swing.JTable)148 BoxLayout (javax.swing.BoxLayout)140 Insets (java.awt.Insets)122 GridBagConstraints (java.awt.GridBagConstraints)121 ActionEvent (java.awt.event.ActionEvent)120 JTextArea (javax.swing.JTextArea)110 ActionListener (java.awt.event.ActionListener)103 FlowLayout (java.awt.FlowLayout)96 JTextField (javax.swing.JTextField)70 FormLayout (com.jgoodies.forms.layout.FormLayout)60 Container (java.awt.Container)55 JSplitPane (javax.swing.JSplitPane)55 MouseEvent (java.awt.event.MouseEvent)52