use of javax.swing.JOptionPane in project jdk8u_jdk by JetBrains.
the class DimensionEncapsulation method run.
@Override
public void run() {
runTest(new Panel());
runTest(new Button());
runTest(new Checkbox());
runTest(new Canvas());
runTest(new Choice());
runTest(new Label());
runTest(new Scrollbar());
runTest(new TextArea());
runTest(new TextField());
runTest(new Dialog(new JFrame()));
runTest(new Frame());
runTest(new Window(new JFrame()));
runTest(new FileDialog(new JFrame()));
runTest(new List());
runTest(new ScrollPane());
runTest(new JFrame());
runTest(new JDialog(new JFrame()));
runTest(new JWindow(new JFrame()));
runTest(new JLabel("hi"));
runTest(new JMenu());
runTest(new JTree());
runTest(new JTable());
runTest(new JMenuItem());
runTest(new JCheckBoxMenuItem());
runTest(new JToggleButton());
runTest(new JSpinner());
runTest(new JSlider());
runTest(Box.createVerticalBox());
runTest(Box.createHorizontalBox());
runTest(new JTextField());
runTest(new JTextArea());
runTest(new JTextPane());
runTest(new JPasswordField());
runTest(new JFormattedTextField());
runTest(new JEditorPane());
runTest(new JButton());
runTest(new JColorChooser());
runTest(new JFileChooser());
runTest(new JCheckBox());
runTest(new JInternalFrame());
runTest(new JDesktopPane());
runTest(new JTableHeader());
runTest(new JLayeredPane());
runTest(new JRootPane());
runTest(new JMenuBar());
runTest(new JOptionPane());
runTest(new JRadioButton());
runTest(new JRadioButtonMenuItem());
runTest(new JPopupMenu());
//runTest(new JScrollBar()); --> don't test defines max and min in
// terms of preferred
runTest(new JScrollPane());
runTest(new JViewport());
runTest(new JSplitPane());
runTest(new JTabbedPane());
runTest(new JToolBar());
runTest(new JSeparator());
runTest(new JProgressBar());
if (!failures.isEmpty()) {
System.out.println("These classes failed");
for (final Component failure : failures) {
System.out.println(failure.getClass());
}
throw new RuntimeException("Test failed");
}
}
use of javax.swing.JOptionPane in project ceylon-compiler by ceylon.
the class SelectToolTask method showGUI.
void showGUI(Properties fileProps) {
Properties guiProps = new Properties(fileProps);
JOptionPane p = createPane(guiProps);
p.createDialog("Select Tool").setVisible(true);
toolName = (String) toolChoice.getSelectedItem();
toolArgs = argsField.getText();
if (defaultCheck.isSelected()) {
if (toolName.equals("")) {
fileProps.remove("tool.name");
} else {
fileProps.put("tool.name", toolName);
fileProps.put(toolName + ".args", toolArgs);
}
writeProperties(propertyFile, fileProps);
}
}
use of javax.swing.JOptionPane in project processdash by dtuma.
the class TaskScheduleChooser method getTemplateName.
protected String getTemplateName(Object parent, String title, String prompt, String initialTaskName, boolean showRollupOptions) {
String taskName = "";
Object message = prompt, button;
Object[] options;
JComboBox rollupOption = null;
if (showRollupOptions) {
String[] rollupOptions = new String[2];
rollupOptions[0] = resources.getString("Create_Schedule_Option");
rollupOptions[1] = resources.getString("Create_Rollup_Option");
rollupOption = new JComboBox(rollupOptions);
options = new Object[] { rollupOption, new JLabel(" "), OK, CANCEL };
} else
options = new Object[] { OK, CANCEL };
JTextField inputField = new JTextField(initialTaskName);
inputField.selectAll();
new JOptionPaneActionHandler(OK).install(inputField);
Component parentComponent = null;
if (parent instanceof Component)
parentComponent = (Component) parent;
while (true) {
JOptionPane optionPane = new JOptionPane(new Object[] { message, inputField }, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options);
optionPane.createDialog(parentComponent, title).setVisible(true);
button = optionPane.getValue();
if (!OK.equals(button))
// user cancel
return null;
taskName = (String) inputField.getText();
taskName = taskName.trim();
String errorMessage = checkNewTemplateName(taskName, dash.getData());
if (errorMessage == null)
break;
else
message = new String[] { errorMessage, prompt };
}
if (rollupOption != null && rollupOption.getSelectedIndex() == 1)
taskName = ROLLUP_PREFIX + taskName;
return taskName;
}
use of javax.swing.JOptionPane in project processdash by dtuma.
the class TaskDependencyCellEditor method buildUIComponents.
private void buildUIComponents(Map iconMap) {
// first, create the button we'll use as our cell editor
button = new JButton();
button.setBackground(Color.white);
button.setFont(UIManager.getFont("TextField.font"));
button.setBorderPainted(false);
button.setMargin(new Insets(0, 0, 0, 0));
button.addKeyListener(EventHandler.create(KeyListener.class, button, "doClick"));
button.addActionListener((ActionListener) EventHandler.create(ActionListener.class, this, "buttonClicked"));
// now, create the components we'll show in the dialog.
List components = new LinkedList();
pathLabel = new JLabel("path label");
components.add(pathLabel);
components.add(Box.createRigidArea(new Dimension(5, 5)));
dependencies = new DependencyTableModel();
dependencyTable = new JTable(dependencies);
dependencyTable.setDefaultRenderer(Object.class, new TaskDependencyCellRenderer());
scrollPane = new JScrollPane(dependencyTable);
components.add(scrollPane);
components.add(Box.createRigidArea(new Dimension(5, 5)));
taskTree = new WBSJTable(dependencySource.getTaskTree(), iconMap);
taskTree.setEditingEnabled(false);
AddAction addAction = new AddAction(taskTree);
RemoveAction removeAction = new RemoveAction(dependencyTable);
SaveChangesAction saveAction = new SaveChangesAction();
// Configure key and mouse bindings for convenience
bindKeys(dependencyTable, new TransferFocusAction(taskTree), "TAB");
bindKeys(dependencyTable, removeAction, "BACK_SPACE", "DELETE", "SUBTRACT");
bindKeys(dependencyTable, saveAction, "ENTER");
bindKeys(taskTree, new TransferFocusAction(dependencyTable), "TAB");
bindKeys(taskTree, addAction, "SPACE", "INSERT", "ADD");
bindKeys(taskTree, saveAction, "ENTER");
taskTree.getInputMap().put(KeyStroke.getKeyStroke("LEFT"), "collapseTree");
taskTree.getInputMap().put(KeyStroke.getKeyStroke("RIGHT"), "expandTree");
taskTree.addMouseListener(new WBSClickHandler(addAction));
Box b = Box.createHorizontalBox();
b.add(Box.createHorizontalGlue());
b.add(new JButton(addAction));
b.add(Box.createHorizontalGlue());
b.add(new JButton(removeAction));
b.add(Box.createHorizontalGlue());
components.add(b);
components.add(Box.createRigidArea(new Dimension(5, 5)));
JScrollPane sp = new JScrollPane(taskTree);
sp.setPreferredSize(new Dimension(300, 200));
components.add(sp);
components.add(new JOptionPaneTweaker.GrabFocus(taskTree));
optionPane = new JOptionPane(components.toArray(), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
// we can't actually create the dialog yet, because we don't know
// who the parent window will be.
}
use of javax.swing.JOptionPane in project languagetool by languagetool-org.
the class LanguageManagerDialog method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == addButton) {
Configuration config;
try {
config = new Configuration(null);
} catch (IOException e1) {
throw new RuntimeException(e1);
}
File initialDir;
File ruleFile;
if (config.getExternalRuleDirectory() != null) {
initialDir = new File(config.getExternalRuleDirectory());
if (initialDir.isDirectory()) {
ruleFile = Tools.openFileDialog(owner, new XMLFileFilter(), initialDir);
} else {
ruleFile = Tools.openFileDialog(owner, new XMLFileFilter());
}
} else {
ruleFile = Tools.openFileDialog(owner, new XMLFileFilter());
}
if (ruleFile == null) {
// dialog was canceled
return;
}
config.setExternalRuleDirectory(ruleFile.getParent());
try {
config.saveConfiguration(null);
} catch (IOException e1) {
throw new RuntimeException(e1);
}
if (!ruleFiles.contains(ruleFile)) {
ruleFiles.add(ruleFile);
list.setListData(ruleFiles.toArray(new File[ruleFiles.size()]));
} else {
JOptionPane jop = new JOptionPane();
JOptionPane.showMessageDialog(jop, messages.getString("guiDuplicate"), messages.getString("guiWarning"), JOptionPane.WARNING_MESSAGE);
}
} else if (e.getSource() == removeButton) {
if (list.getSelectedIndex() != -1) {
ruleFiles.remove(list.getSelectedIndex());
list.setListData(ruleFiles.toArray(new File[ruleFiles.size()]));
}
} else if (e.getSource() == closeButton) {
dialog.setVisible(false);
} else {
throw new IllegalArgumentException("Don't know how to handle " + e);
}
}
Aggregations