encodingPanel.add(Box.createVerticalStrut(5)); final JOptionPane fileFilterDialog = new JOptionPane(); fileFilterDialog.setMessage(encodingPanel); JButton[] options = new JButton[3]; JButton useNewEncoding = new JButton("Use " + encoding);
frame.setLocationByPlatform(true); timer.setCoalesce(false); optPane.setMessage(message()); optPane.setMessageType(JOptionPane.INFORMATION_MESSAGE); optPane.setOptionType(JOptionPane.DEFAULT_OPTION); optPane.setMessage(message()); if (count == 0) { thatsAllFolks();
String htmlMsg = "<html>You can use</b>HTML here</html>"; JOptionPane dialogBox = new JOptionPane(); dialogBox.setMessage(msg); dialogBox.setMessageType(JOptionPane.INFORMATION_MESSAGE); //....
fileFilterDialog.setMessage(fileFilterPanel); JButton[] options = new JButton[3]; JButton okay = new JButton("Okay");
public static void showPrettyMessageDialog(Component parent, Object message, String title, int type) { class PrettyOptionPane extends JOptionPane { PrettyOptionPane() { } @Override public int getMaxCharactersPerLineCount() { return maxCharactersPerLineCount; } } JOptionPane narrowPane = new PrettyOptionPane(); narrowPane.setMessage(message); narrowPane.setMessageType(type); JDialog errorDialog = narrowPane.createDialog(parent, title); errorDialog.setVisible(true); }
prefPane.setMessage(prefPanel);
JDialog dialog = null; JOptionPane optionPane = new JOptionPane(); optionPane.setMessage("Set Message"); optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(3,1)); String[] buttonTxt = {"Need Help","Help Me","Counting"}; JButton[] buttons = new JButton[buttonTxt.length]; for (int i = 0; i < buttonTxt.length; i++) { buttons[i] = new JButton(buttonTxt[i]); panel.add(buttons[i]); } optionPane.setOptionType(JOptionPane.DEFAULT_OPTION); optionPane.add(panel); dialog = optionPane.createDialog(null, "Icon/Text Button"); dialog.setVisible(true);
public void showInformationDialog(String message) { JOptionPane optionPane = new JOptionPane(); JLabel label = new JLabel(message); label.setFont(label.getFont().deriveFont(Font.PLAIN)); optionPane.setIcon(this.genericInfoImageIcon); optionPane.setMessage(label); showDialog(optionPane, this.genericInfoTitle, true); }
JDialog dialog = null; JOptionPane optionPane = new JOptionPane(); optionPane.setMessage("Set Message"); optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(3,1)); String[] buttonTxt = {"Need Help","Help Me","Counting"}; JButton[] buttons = new JButton[buttonTxt.length]; for (int i = 0; i < buttonTxt.length; i++) { buttons[i] = new JButton(buttonTxt[i]); panel.add(buttons[i]); } optionPane.setOptionType(JOptionPane.DEFAULT_OPTION); optionPane.add(panel,1); dialog = optionPane.createDialog(null, "Icon/Text Button"); dialog.setVisible(true);
public void showErrorDialog(String message) { JOptionPane optionPane = new JOptionPane(); JLabel label = new JLabel(message); label.setFont(label.getFont().deriveFont(Font.PLAIN)); optionPane.setIcon(this.genericErrorImageIcon); optionPane.setMessage(label); showDialog(optionPane, this.genericErrorTitle, true); }
/** * Get the server-config.wsdd as a document to retrieve deployed services * * @return */ private Document getServerWSDD() { Document doc = null; try { String[] param = new String[]{"-u" + axisUser, "-w" + axisPass, "-l " + axisURL, "list"}; String ret = adminClient.process(param); doc = XMLUtils.newDocument( new ByteArrayInputStream(ret.getBytes())); } catch (Exception e) { JOptionPane pane = new JOptionPane(); String msg = e.toString(); pane.setMessageType(JOptionPane.WARNING_MESSAGE); pane.setMessage(msg); pane.setOptions(new String[]{"OK"}); JDialog dlg = pane.createDialog(null, "Login status"); dlg.setVisible(true); } return doc; }
public void showWarningDialog(String message) { JOptionPane optionPane = new JOptionPane(); JLabel label = new JLabel(message); label.setFont(label.getFont().deriveFont(Font.PLAIN)); optionPane.setIcon(this.genericWarningImageIcon); optionPane.setMessage(label); showDialog(optionPane, this.genericWarningTitle, true); }
/** * Get the server-config.wsdd as a document to retrieve deployed services * * @return */ private Document getServerWSDD() { Document doc = null; try { String[] param = new String[]{"-u" + axisUser, "-w" + axisPass, "-l " + axisURL, "list"}; String ret = adminClient.process(param); doc = XMLUtils.newDocument( new ByteArrayInputStream(ret.getBytes())); } catch (Exception e) { JOptionPane pane = new JOptionPane(); String msg = e.toString(); pane.setMessageType(JOptionPane.WARNING_MESSAGE); pane.setMessage(msg); pane.setOptions(new String[]{"OK"}); JDialog dlg = pane.createDialog(null, "Login status"); dlg.setVisible(true); } return doc; }
private static boolean isUrl(String url) { if(url == null | (url != null && url.equals("null"))) { JOptionPane message = new JOptionPane(); message.setMessage("Failed to upload screenshot. Check your internet connection then try again."); JDialog dialog = message.createDialog(null, "Error"); dialog.setLocationRelativeTo(null); dialog.setModal(false); dialog.setVisible(true); return false; } return true; }
/** * Get the server-config.wsdd as a document to retrieve deployed services * * @return */ private Document getServerWSDD() { Document doc = null; try { String[] param = new String[]{"-u" + axisUser, "-w" + axisPass, "-l " + axisURL, "list"}; String ret = adminClient.process(param); doc = XMLUtils.newDocument( new ByteArrayInputStream(ret.getBytes())); } catch (Exception e) { JOptionPane pane = new JOptionPane(); String msg = e.toString(); pane.setMessageType(JOptionPane.WARNING_MESSAGE); pane.setMessage(msg); pane.setOptions(new String[]{"OK"}); JDialog dlg = pane.createDialog(null, "Login status"); dlg.setVisible(true); } return doc; }
String title = resources.getString("dialog.error_version.title"); JOptionPane optionPane = new JOptionPane(); optionPane.setMessage(message); this.dialogFactory.showDialog(optionPane, title, true); System.exit(1);
JOptionPane optionPane = new JOptionPane(); JTextField field = getField(); optionPane.setMessage(new Object[]{"Type something: ", field}); optionPane.setMessageType(JOptionPane.QUESTION_MESSAGE); optionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
public void start() { PrintPanel printPanel = new PrintPanel(this.graph); JOptionPane optionPane = new JOptionPane(); optionPane.setOptions(new String[] { this.printCloseText }); optionPane.setMessage(printPanel); optionPane.setBorder(new EmptyBorder(0, 0, 10, 0)); this.dialogFactory.showDialog(optionPane, this.printTitle, true); }
public class Main { public static List<Component> getAllComponents(final Container c) { Component[] comps = c.getComponents(); List<Component> compList = new ArrayList<Component>(); for (Component comp : comps) { compList.add(comp); if (comp instanceof Container) compList.addAll(getAllComponents((Container) comp)); } return compList; } public static void main(String[] args) { JOptionPane optionPane = new JOptionPane(); optionPane.setMessage("What's your name?"); optionPane.setMessageType(JOptionPane.QUESTION_MESSAGE); optionPane.setWantsInput(true); JDialog dialog = optionPane.createDialog("Simple Question"); for (Component c : getAllComponents(dialog)) { if (c instanceof JTextField) { c.setToolTipText("I'm a tooltip!"); } } dialog.setVisible(true); dialog.dispose(); } }
@Override public void exportToClipboard() { FileExportService.exportToclipBoard(this.graph); JOptionPane optionPane = new JOptionPane(); optionPane.setIcon(this.clipBoardDialogIcon); optionPane.setMessage(this.clipBoardDialogMessage); optionPane.setName(this.clipBoardDialogTitle); this.dialogFactory.showDialog(optionPane, this.clipBoardDialogTitle, true); }