Search in sources :

Example 36 with Box

use of javax.swing.Box in project processdash by dtuma.

the class ProgressDialog method borderComponent.

private Component borderComponent(Component comp) {
    Box horizBox = Box.createHorizontalBox();
    horizBox.add(Box.createHorizontalGlue());
    horizBox.add(comp);
    horizBox.add(Box.createHorizontalGlue());
    return horizBox;
}
Also used : Box(javax.swing.Box)

Example 37 with Box

use of javax.swing.Box in project processdash by dtuma.

the class WBSFilterAction method buildGui.

private void buildGui() {
    JPanel panel = filterPanel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    GridBagLayout layout = new GridBagLayout();
    panel.setLayout(layout);
    lc = new GridBagConstraints();
    lc.gridx = lc.gridy = 0;
    lc.anchor = GridBagConstraints.WEST;
    lc.gridwidth = 2;
    lc.weightx = 1;
    lc.insets = new Insets(0, 0, 0, 40);
    JLabel label = new JLabel(resources.getString("Prompt"));
    panel.add(label);
    layout.setConstraints(label, lc);
    GridBagConstraints hc = new GridBagConstraints();
    hc.gridx = 2;
    lc.anchor = GridBagConstraints.EAST;
    JButton helpButton = new JButton(new HelpAction());
    helpButton.setBorder(null);
    helpButton.setMargin(new Insets(1, 1, 1, 1));
    helpButton.setFocusable(false);
    helpButton.setContentAreaFilled(false);
    panel.add(helpButton);
    layout.setConstraints(helpButton, hc);
    lc.gridwidth = lc.gridy = 1;
    lc.anchor = GridBagConstraints.EAST;
    lc.weightx = 0;
    lc.insets = new Insets(5, 0, 1, 0);
    label = new JLabel(resources.getString("Items.Name"));
    panel.add(label);
    layout.setConstraints(label, lc);
    vc = new GridBagConstraints();
    vc.weightx = vc.gridx = vc.gridy = 1;
    vc.gridwidth = 2;
    vc.fill = GridBagConstraints.HORIZONTAL;
    vc.insets = new Insets(5, 5, 0, 0);
    nameFilter = new TextField();
    panel.add(nameFilter);
    layout.setConstraints(nameFilter, vc);
    lc.gridy++;
    vc.gridy++;
    label = new JLabel(resources.getString("Items.Assigned_To"));
    panel.add(label);
    layout.setConstraints(label, lc);
    groupFilter = new GroupField();
    panel.add(groupFilter);
    layout.setConstraints(groupFilter, vc);
    lc.gridy++;
    vc.gridy++;
    label = new JLabel(resources.getString("Items.Labels"));
    panel.add(label);
    layout.setConstraints(label, lc);
    labelFilter = new CompletingField(TaskLabelColumn.COLUMN_ID, "[ ,]+");
    labelFilter.testAtLeaves = true;
    panel.add(labelFilter);
    layout.setConstraints(labelFilter, vc);
    lc.gridy++;
    vc.gridy++;
    label = new JLabel(resources.getString("Items.Milestone"));
    panel.add(label);
    layout.setConstraints(label, lc);
    milestoneFilter = new CompletingField(MilestoneColumn.COLUMN_ID);
    milestoneFilter.mask = WBSFilterFactory.ENTIRE_VALUE;
    milestoneFilter.nullItemText = resources.getString("Items.Milestone_None");
    milestoneFilter.testAtLeaves = true;
    panel.add(milestoneFilter);
    layout.setConstraints(milestoneFilter, vc);
    lc.gridy++;
    vc.gridy++;
    label = new JLabel(resources.getString("Items.Notes"));
    panel.add(label);
    layout.setConstraints(label, lc);
    notesFilter = new TextField();
    panel.add(notesFilter);
    layout.setConstraints(notesFilter, vc);
    lc.gridy++;
    vc.gridy++;
    blameLabel = new JLabel(resources.getString("Items.Changes"));
    blameLabel.setVisible(wbsBlameData != null);
    panel.add(blameLabel);
    layout.setConstraints(blameLabel, lc);
    blameFilter = new ChangedItemsField();
    blameFilter.setVisible(wbsBlameData != null);
    panel.add(blameFilter);
    layout.setConstraints(blameFilter, vc);
    customColumnFilterPos = lc.gridy + 1;
    buildCustomColumns();
    lc.gridy = vc.gridy = 9000;
    showCompletedTasks = new JCheckBox(resources.getString("Show_Completed"), true);
    panel.add(showCompletedTasks);
    layout.setConstraints(showCompletedTasks, vc);
    lc.gridy++;
    vc.gridy++;
    showRelatedTasks = new JCheckBox(resources.getString("Show_Related"));
    showRelatedTasks.setToolTipText(resources.getString("Show_Related_Tooltip"));
    panel.add(showRelatedTasks);
    layout.setConstraints(showRelatedTasks, vc);
    Box buttonBox = new Box(BoxLayout.X_AXIS);
    buttonBox.add(Box.createHorizontalGlue());
    buttonBox.add(new JButton(removeAction));
    buttonBox.add(Box.createHorizontalGlue());
    buttonBox.add(new JButton(applyAction));
    buttonBox.add(Box.createHorizontalGlue());
    GridBagConstraints bc = new GridBagConstraints();
    bc.gridy = lc.gridy + 1;
    bc.gridwidth = 3;
    bc.fill = GridBagConstraints.HORIZONTAL;
    bc.insets = new Insets(8, 0, 0, 0);
    panel.add(buttonBox);
    layout.setConstraints(buttonBox, bc);
    panel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "removeFilter");
    panel.getActionMap().put("removeFilter", removeAction);
    dialog = new JDialog((Frame) getDialogParent(), resources.getString("Title"), false);
    dialog.getContentPane().add(panel);
    dialog.pack();
    dialog.setVisible(true);
    dialog.setLocationRelativeTo(getDialogParent());
    needsShowInfoMessage = preferences.getBoolean(INFO_MSG_PREF, true);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Frame(java.awt.Frame) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) AssignedToComboBox(net.sourceforge.processdash.ui.lib.autocomplete.AssignedToComboBox) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) JCheckBox(javax.swing.JCheckBox) JTextField(javax.swing.JTextField) JDialog(javax.swing.JDialog)

Example 38 with Box

use of javax.swing.Box in project processdash by dtuma.

the class ItemListEditor method buildButtons.

private Component buildButtons() {
    Box buttons = Box.createHorizontalBox();
    buttons.add(Box.createHorizontalGlue());
    buttons.add(insertButton = new JButton("Insert"));
    insertButton.addActionListener((ActionListener) EventHandler.create(ActionListener.class, this, "insert"));
    buttons.add(Box.createHorizontalGlue());
    buttons.add(deleteButton = new JButton("Delete"));
    deleteButton.addActionListener((ActionListener) EventHandler.create(ActionListener.class, this, "delete"));
    buttons.add(Box.createHorizontalGlue());
    buttons.add(upButton = new JButton("Move Up"));
    upButton.addActionListener((ActionListener) EventHandler.create(ActionListener.class, this, "moveUp"));
    buttons.add(Box.createHorizontalGlue());
    buttons.add(downButton = new JButton("Move Down"));
    downButton.addActionListener((ActionListener) EventHandler.create(ActionListener.class, this, "moveDown"));
    buttons.add(Box.createHorizontalGlue());
    enableButtons();
    Box result = Box.createVerticalBox();
    result.add(Box.createVerticalStrut(2));
    result.add(buttons);
    result.add(Box.createVerticalStrut(2));
    return result;
}
Also used : JButton(javax.swing.JButton) Box(javax.swing.Box)

Example 39 with Box

use of javax.swing.Box in project uncommons-maths by dwdyer.

the class RandomDemo method createControls.

private JComponent createControls() {
    Box controls = new Box(BoxLayout.Y_AXIS);
    controls.add(distributionPanel);
    controls.add(rngPanel);
    JButton executeButton = new JButton("Go");
    executeButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionEvent) {
            RandomDemo.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            new SwingBackgroundTask<GraphData>() {

                private ProbabilityDistribution distribution;

                protected GraphData performTask() {
                    distribution = distributionPanel.createProbabilityDistribution();
                    Map<Double, Double> observedValues = distribution.generateValues(rngPanel.getIterations(), rngPanel.getRNG());
                    Map<Double, Double> expectedValues = distribution.getExpectedValues();
                    return new GraphData(observedValues, expectedValues, distribution.getExpectedMean(), distribution.getExpectedStandardDeviation());
                }

                protected void postProcessing(GraphData data) {
                    graphPanel.generateGraph(distribution.getDescription(), data.getObservedValues(), data.getExpectedValues(), data.getExpectedMean(), data.getExpectedStandardDeviation(), distribution.isDiscrete());
                    RandomDemo.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            }.execute();
        }
    });
    controls.add(executeButton);
    return controls;
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) Box(javax.swing.Box) SwingBackgroundTask(org.uncommons.swing.SwingBackgroundTask)

Example 40 with Box

use of javax.swing.Box in project processdash by dtuma.

the class TaskScheduleDialog method buildMainButtons.

protected Component buildMainButtons(boolean isRollup) {
    JPanel result = new JPanel(new BorderLayout());
    result.setBorder(BorderFactory.createRaisedBevelBorder());
    Box box = Box.createHorizontalBox();
    result.add(newVBox(Box.createVerticalStrut(2), box, Box.createVerticalStrut(2)), BorderLayout.CENTER);
    box.add(Box.createHorizontalGlue());
    JPopupMenu popupMenu = treeTable.getComponentPopupMenu();
    /*
        if (isRollup) {
            recalcButton = new JButton("Refresh");
            recalcButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    recalcAll(); }});
            box.add(recalcButton);
        }
        */
    errorAction = new TSAction("Buttons.Errors") {

        public void actionPerformed(ActionEvent e) {
            displayErrorDialog(getErrors());
        }
    };
    final JButton errorButton = new JButton(errorAction);
    errorButton.setBackground(Color.red);
    errorButton.setFocusPainted(false);
    errorAction.addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            errorButton.setVisible(errorAction.isEnabled());
        }
    });
    errorAction.setEnabled(getErrors() != null);
    box.add(errorButton);
    box.add(Box.createHorizontalStrut(2));
    filteredChartAction = new TSAction("Buttons.Filtered_Chart") {

        public void actionPerformed(ActionEvent e) {
            showFilteredChart();
        }
    };
    filteredChartAction.setEnabled(false);
    addRenamedPopupMenuItem(popupMenu, filteredChartAction, "Buttons.View_Filtered_Chart");
    chartAction = new TSAction("Buttons.Chart") {

        public void actionPerformed(ActionEvent e) {
            showChart();
        }
    };
    box.add(makeDropDownButton(chartAction, filteredChartAction));
    box.add(Box.createHorizontalStrut(2));
    altReportActions = buildAltReportActions();
    weekReportAction = new TSAction("Buttons.Weekly_Report") {

        public void actionPerformed(ActionEvent e) {
            showWeekReport();
        }
    };
    filteredReportAction = new TSAction("Buttons.Filtered_Report") {

        public void actionPerformed(ActionEvent e) {
            showFilteredHTML();
        }
    };
    filteredReportAction.setEnabled(false);
    addRenamedPopupMenuItem(popupMenu, filteredReportAction, "Buttons.View_Filtered_Report");
    reportAction = new TSAction("Buttons.Report") {

        public void actionPerformed(ActionEvent e) {
            showHTML();
        }
    };
    box.add(makeDropDownButton(reportAction, weekReportAction, altReportActions, filteredReportAction));
    box.add(Box.createHorizontalStrut(2));
    closeAction = new TSAction("Close") {

        public void actionPerformed(ActionEvent e) {
            confirmClose(true);
        }
    };
    box.add(new JButton(closeAction));
    box.add(Box.createHorizontalStrut(2));
    saveAction = new TSAction("Save") {

        public void actionPerformed(ActionEvent e) {
            save();
        }
    };
    if (canEdit()) {
        box.add(new JButton(saveAction));
        box.add(Box.createHorizontalStrut(2));
    }
    Dimension size = result.getMinimumSize();
    size.width = 2000;
    result.setMaximumSize(size);
    return result;
}
Also used : JPanel(javax.swing.JPanel) PropertyChangeEvent(java.beans.PropertyChangeEvent) BorderLayout(java.awt.BorderLayout) PropertyChangeListener(java.beans.PropertyChangeListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) Dimension(java.awt.Dimension) JPopupMenu(javax.swing.JPopupMenu)

Aggregations

Box (javax.swing.Box)192 JCheckBox (javax.swing.JCheckBox)95 JLabel (javax.swing.JLabel)93 JPanel (javax.swing.JPanel)87 Dimension (java.awt.Dimension)65 BorderLayout (java.awt.BorderLayout)51 JButton (javax.swing.JButton)48 JComboBox (javax.swing.JComboBox)46 JScrollPane (javax.swing.JScrollPane)42 BoxLayout (javax.swing.BoxLayout)38 ActionEvent (java.awt.event.ActionEvent)31 ActionListener (java.awt.event.ActionListener)28 JTextField (javax.swing.JTextField)25 EmptyBorder (javax.swing.border.EmptyBorder)19 Insets (java.awt.Insets)17 SearchFilterPanel (pcgen.gui2.filter.SearchFilterPanel)14 FlippingSplitPane (pcgen.gui2.tools.FlippingSplitPane)14 TitledBorder (javax.swing.border.TitledBorder)13 FilterBar (pcgen.gui2.filter.FilterBar)13 GridBagConstraints (java.awt.GridBagConstraints)12