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;
}
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);
}
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;
}
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;
}
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;
}
Aggregations