List of usage examples for javax.swing JOptionPane OK_OPTION
int OK_OPTION
To view the source code for javax.swing JOptionPane OK_OPTION.
Click Source Link
From source file:sim.util.media.chart.ChartGenerator.java
/** Starts a Quicktime movie on the given ChartGenerator. The size of the movie frame will be the size of the chart at the time this method is called. This method ought to be called from the main event loop. Most of the default movie formats provided will result in a gigantic movie, which you can re-encode using something smarter (like the Animation or Sorenson codecs) to put to a reasonable size. On the Mac, Quicktime Pro will do this quite elegantly. */ public void startMovie() { // can't start a movie if we're in an applet if (SimApplet.isApplet()) { Object[] options = { "Oops" }; JOptionPane.showOptionDialog(this, "You cannot create movies from an applet.", "MASON Applet Restriction", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]);//from w ww . ja v a2 s . c o m return; } if (movieMaker != null) return; // already running movieMaker = new MovieMaker(getFrame()); if (!movieMaker.start(getBufferedImage())) movieMaker = null; // failed else { movieButton.setText("Stop Movie"); // emit an image update(FORCE_KEY, true); } }
From source file:com.asprise.imaging.core.Imaging.java
public static void main(String[] args) { if (args == null) { args = new String[0]; }/* w w w. ja v a 2s . c o m*/ // Try UI mode if possible try { if (!(args.length > 0 && "console".equalsIgnoreCase(args[args.length - 1])) && !java.awt.GraphicsEnvironment.isHeadless()) { Class<?> cls = Class.forName("com.asprise.imaging.scan.ui.workbench.demo.FrameScanDemo"); Method meth = cls.getMethod("main", String[].class); String[] params = null; // init params accordingly meth.invoke(null, (Object) args); // static method doesn't have an instance return; } } catch (Throwable e) { e.printStackTrace(); } String copyright = "Copyright Asprise, " + Calendar.getInstance().get(Calendar.YEAR) + ". All Rights Reserved. Visit www.asprise.com"; String version = "Library version: " + getLibraryVersion(); try { JOptionPane.showMessageDialog(null, version, copyright, JOptionPane.OK_OPTION | JOptionPane.INFORMATION_MESSAGE); } catch (Throwable t) { // ignore exception } System.out.println(copyright); System.out.println(version); System.out.println(Utils.getEnvInfo(false)); }
From source file:com.entertailion.java.fling.FlingFrame.java
public FlingFrame(String appId) { super();//www. j av a2s . c o m this.appId = appId; rampClient = new RampClient(this); addWindowListener(this); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Locale locale = Locale.getDefault(); resourceBundle = ResourceBundle.getBundle("com/entertailion/java/fling/resources/resources", locale); setTitle(MessageFormat.format(resourceBundle.getString("fling.title"), Fling.VERSION)); JPanel listPane = new JPanel(); // show list of ChromeCast devices detected on the local network listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS)); JPanel devicePane = new JPanel(); devicePane.setLayout(new BoxLayout(devicePane, BoxLayout.LINE_AXIS)); deviceList = new JComboBox(); deviceList.addActionListener(this); devicePane.add(deviceList); URL url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/refresh.png"); ImageIcon icon = new ImageIcon(url, resourceBundle.getString("button.refresh")); refreshButton = new JButton(icon); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // refresh the list of devices if (deviceList.getItemCount() > 0) { deviceList.setSelectedIndex(0); } discoverDevices(); } }); refreshButton.setToolTipText(resourceBundle.getString("button.refresh")); devicePane.add(refreshButton); url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/settings.png"); icon = new ImageIcon(url, resourceBundle.getString("settings.title")); settingsButton = new JButton(icon); settingsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JTextField transcodingExtensions = new JTextField(50); transcodingExtensions.setText(transcodingExtensionValues); JTextField transcodingParameters = new JTextField(50); transcodingParameters.setText(transcodingParameterValues); JPanel myPanel = new JPanel(new BorderLayout()); JPanel labelPanel = new JPanel(new GridLayout(3, 1)); JPanel fieldPanel = new JPanel(new GridLayout(3, 1)); myPanel.add(labelPanel, BorderLayout.WEST); myPanel.add(fieldPanel, BorderLayout.CENTER); labelPanel.add(new JLabel(resourceBundle.getString("transcoding.extensions"), JLabel.RIGHT)); fieldPanel.add(transcodingExtensions); labelPanel.add(new JLabel(resourceBundle.getString("transcoding.parameters"), JLabel.RIGHT)); fieldPanel.add(transcodingParameters); labelPanel.add(new JLabel(resourceBundle.getString("device.manual"), JLabel.RIGHT)); JPanel devicePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); final JComboBox manualDeviceList = new JComboBox(); if (manualServers.size() == 0) { manualDeviceList.setVisible(false); } else { for (DialServer dialServer : manualServers) { manualDeviceList.addItem(dialServer); } } devicePanel.add(manualDeviceList); JButton addButton = new JButton(resourceBundle.getString("device.manual.add")); addButton.setToolTipText(resourceBundle.getString("device.manual.add.tooltip")); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JTextField name = new JTextField(); JTextField ipAddress = new JTextField(); Object[] message = { resourceBundle.getString("device.manual.name") + ":", name, resourceBundle.getString("device.manual.ipaddress") + ":", ipAddress }; int option = JOptionPane.showConfirmDialog(null, message, resourceBundle.getString("device.manual"), JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION) { try { manualServers.add( new DialServer(name.getText(), InetAddress.getByName(ipAddress.getText()))); Object selected = deviceList.getSelectedItem(); int selectedIndex = deviceList.getSelectedIndex(); deviceList.removeAllItems(); deviceList.addItem(resourceBundle.getString("devices.select")); for (DialServer dialServer : servers) { deviceList.addItem(dialServer); } for (DialServer dialServer : manualServers) { deviceList.addItem(dialServer); } deviceList.invalidate(); if (selectedIndex > 0) { deviceList.setSelectedItem(selected); } else { if (deviceList.getItemCount() == 2) { // Automatically select single device deviceList.setSelectedIndex(1); } } manualDeviceList.removeAllItems(); for (DialServer dialServer : manualServers) { manualDeviceList.addItem(dialServer); } manualDeviceList.setVisible(true); storeProperties(); } catch (UnknownHostException e1) { Log.e(LOG_TAG, "manual IP address", e1); JOptionPane.showMessageDialog(FlingFrame.this, resourceBundle.getString("device.manual.invalidip")); } } } }); devicePanel.add(addButton); JButton removeButton = new JButton(resourceBundle.getString("device.manual.remove")); removeButton.setToolTipText(resourceBundle.getString("device.manual.remove.tooltip")); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Object selected = manualDeviceList.getSelectedItem(); manualDeviceList.removeItem(selected); if (manualDeviceList.getItemCount() == 0) { manualDeviceList.setVisible(false); } deviceList.removeItem(selected); deviceList.invalidate(); manualServers.remove(selected); storeProperties(); } }); devicePanel.add(removeButton); fieldPanel.add(devicePanel); int result = JOptionPane.showConfirmDialog(FlingFrame.this, myPanel, resourceBundle.getString("settings.title"), JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { transcodingParameterValues = transcodingParameters.getText(); transcodingExtensionValues = transcodingExtensions.getText(); storeProperties(); } } }); settingsButton.setToolTipText(resourceBundle.getString("settings.title")); devicePane.add(settingsButton); listPane.add(devicePane); // TODO volume = new JSlider(JSlider.VERTICAL, 0, 100, 0); volume.setUI(new MySliderUI(volume)); volume.setMajorTickSpacing(25); // volume.setMinorTickSpacing(5); volume.setPaintTicks(true); volume.setEnabled(true); volume.setValue(100); volume.setToolTipText(resourceBundle.getString("volume.title")); volume.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int position = (int) source.getValue(); rampClient.volume(position / 100.0f); } } }); JPanel centerPanel = new JPanel(new BorderLayout()); // centerPanel.add(volume, BorderLayout.WEST); centerPanel.add(DragHereIcon.makeUI(this), BorderLayout.CENTER); listPane.add(centerPanel); scrubber = new JSlider(JSlider.HORIZONTAL, 0, 100, 0); scrubber.addChangeListener(this); scrubber.setMajorTickSpacing(25); scrubber.setMinorTickSpacing(5); scrubber.setPaintTicks(true); scrubber.setEnabled(false); listPane.add(scrubber); // panel of playback buttons JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); label = new JLabel("00:00:00"); buttonPane.add(label); url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/play.png"); icon = new ImageIcon(url, resourceBundle.getString("button.play")); playButton = new JButton(icon); playButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rampClient.play(); } }); buttonPane.add(playButton); url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/pause.png"); icon = new ImageIcon(url, resourceBundle.getString("button.pause")); pauseButton = new JButton(icon); pauseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rampClient.pause(); } }); buttonPane.add(pauseButton); url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/stop.png"); icon = new ImageIcon(url, resourceBundle.getString("button.stop")); stopButton = new JButton(icon); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rampClient.stop(); setDuration(0); scrubber.setValue(0); scrubber.setEnabled(false); } }); buttonPane.add(stopButton); listPane.add(buttonPane); getContentPane().add(listPane); createProgressDialog(); startWebserver(); discoverDevices(); }
From source file:org.apache.jmeter.visualizers.CreateReport.java
public static void teststarted() { JOptionPane.showMessageDialog(null, "test started", "test started", JOptionPane.OK_OPTION); }
From source file:edu.gmu.cs.sim.util.media.chart.ChartGenerator.java
/** Starts a Quicktime movie on the given ChartGenerator. The size of the movie frame will be the size of the chart at the time this method is called. This method ought to be called from the main event loop. Most of the default movie formats provided will result in a gigantic movie, which you can re-encode using something smarter (like the Animation or Sorenson codecs) to put to a reasonable size. On the Mac, Quicktime Pro will do this quite elegantly. */ public void startMovie() { // can't start a movie if we're in an applet if (SimApplet.isApplet()) { Object[] options = { "Oops" }; JOptionPane.showOptionDialog(this, "You cannot create movies from an applet.", "MASON Applet Restriction", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]);//from w w w . j a v a2 s. c om return; } if (movieMaker != null) { return; // already running } movieMaker = new MovieMaker(getFrame()); if (!movieMaker.start(getBufferedImage())) { movieMaker = null; // failed } else { movieButton.setText("Stop Movie"); // emit an image update(FORCE_KEY, true); } }
From source file:ConfigFiles.java
public ConfigFiles(Dimension screensize) { // initializeFileBrowser(); paths = new JPanel(); paths.setBackground(Color.WHITE); //paths.setBorder(BorderFactory.createTitledBorder("Paths")); paths.setLayout(null);/*from w ww .j a va 2s. com*/ paths.setPreferredSize(new Dimension(930, 1144)); paths.setSize(new Dimension(930, 1144)); paths.setMinimumSize(new Dimension(930, 1144)); paths.setMaximumSize(new Dimension(930, 1144)); //paths.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); setLayout(null); ttcpath = new JTextField(); addPanel("TestCase Source Path", "Master directory with the test cases that can" + " be run by the framework", ttcpath, RunnerRepository.TESTSUITEPATH, 10, true, null); tMasterXML = new JTextField(); tUsers = new JTextField(); addPanel("Projects Path", "Location of projects XML files", tUsers, RunnerRepository.REMOTEUSERSDIRECTORY, 83, true, null); tSuites = new JTextField(); addPanel("Predefined Suites Path", "Location of predefined suites", tSuites, RunnerRepository.PREDEFINEDSUITES, 156, true, null); testconfigpath = new JTextField(); addPanel("Test Configuration Path", "Test Configuration path", testconfigpath, RunnerRepository.TESTCONFIGPATH, 303, true, null); tepid = new JTextField(); addPanel("EP name File", "Location of the file that contains" + " the Ep name list", tepid, RunnerRepository.REMOTEEPIDDIR, 595, true, null); tlog = new JTextField(); addPanel("Logs Path", "Location of the directory that stores the most recent log files." + " The files are re-used each Run.", tlog, RunnerRepository.LOGSPATH, 667, true, null); tsecondarylog = new JTextField(); JPanel p = addPanel("Secondary Logs Path", "Location of the directory that archives copies of the most recent log files, with" + " original file names appended with <.epoch time>", tsecondarylog, RunnerRepository.SECONDARYLOGSPATH, 930, true, null); logsenabled.setSelected(Boolean.parseBoolean(RunnerRepository.PATHENABLED)); logsenabled.setBackground(Color.WHITE); p.add(logsenabled); JPanel p7 = new JPanel(); p7.setBackground(Color.WHITE); TitledBorder border7 = BorderFactory.createTitledBorder("Log Files"); border7.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border7.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p7.setBorder(border7); p7.setLayout(new BoxLayout(p7, BoxLayout.Y_AXIS)); p7.setBounds(80, 740, 800, 190); paths.add(p7); JTextArea log2 = new JTextArea("All the log files that will be monitored"); log2.setWrapStyleWord(true); log2.setLineWrap(true); log2.setEditable(false); log2.setCursor(null); log2.setOpaque(false); log2.setFocusable(false); log2.setBorder(null); log2.setFont(new Font("Arial", Font.PLAIN, 12)); log2.setBackground(getBackground()); log2.setMaximumSize(new Dimension(170, 25)); log2.setPreferredSize(new Dimension(170, 25)); JPanel p71 = new JPanel(); p71.setBackground(Color.WHITE); p71.setLayout(new GridLayout()); p71.setMaximumSize(new Dimension(700, 13)); p71.setPreferredSize(new Dimension(700, 13)); p71.add(log2); JPanel p72 = new JPanel(); p72.setBackground(Color.WHITE); p72.setLayout(new BoxLayout(p72, BoxLayout.Y_AXIS)); trunning = new JTextField(); p72.add(addField(trunning, "Running: ", 0)); tdebug = new JTextField(); p72.add(addField(tdebug, "Debug: ", 1)); tsummary = new JTextField(); p72.add(addField(tsummary, "Summary: ", 2)); tinfo = new JTextField(); p72.add(addField(tinfo, "Info: ", 3)); tcli = new JTextField(); p72.add(addField(tcli, "Cli: ", 4)); p7.add(p71); p7.add(p72); libpath = new JTextField(); addPanel("Library path", "Secondary user library path", libpath, RunnerRepository.REMOTELIBRARY, 229, true, null); JPanel p8 = new JPanel(); p8.setBackground(Color.WHITE); TitledBorder border8 = BorderFactory.createTitledBorder("File"); border8.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border8.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p8.setBorder(border8); p8.setLayout(null); p8.setBounds(80, 1076, 800, 50); if (PermissionValidator.canChangeFWM()) { paths.add(p8); } JButton save = new JButton("Save"); save.setToolTipText("Save and automatically load config"); save.setBounds(490, 20, 70, 20); save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { saveXML(false, "fwmconfig"); loadConfig("fwmconfig.xml"); } }); p8.add(save); // if(!PermissionValidator.canChangeFWM()){ // save.setEnabled(false); // } JButton saveas = new JButton("Save as"); saveas.setBounds(570, 20, 90, 20); saveas.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { String filename = CustomDialog.showInputDialog(JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "File Name", "Please enter file name"); if (!filename.equals("NULL")) { saveXML(false, filename); } } }); p8.add(saveas); final JButton loadXML = new JButton("Load Config"); loadXML.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { String[] configs = RunnerRepository .getRemoteFolderContent(RunnerRepository.USERHOME + "/twister/config/"); JComboBox combo = new JComboBox(configs); int resp = (Integer) CustomDialog.showDialog(combo, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "Config", null); final String config; if (resp == JOptionPane.OK_OPTION) config = combo.getSelectedItem().toString(); else config = null; if (config != null) { new Thread() { public void run() { setEnabledTabs(false); JFrame progress = new JFrame(); progress.setAlwaysOnTop(true); progress.setLocation((int) loadXML.getLocationOnScreen().getX(), (int) loadXML.getLocationOnScreen().getY()); progress.setUndecorated(true); JProgressBar bar = new JProgressBar(); bar.setIndeterminate(true); progress.add(bar); progress.pack(); progress.setVisible(true); loadConfig(config); progress.dispose(); setEnabledTabs(true); } }.start(); } } catch (Exception e) { e.printStackTrace(); } } }); loadXML.setBounds(670, 20, 120, 20); p8.add(loadXML); // if(!PermissionValidator.canChangeFWM()){ // loadXML.setEnabled(false); // } tdbfile = new JTextField(); addPanel("Database XML path", "File location for database configuration", tdbfile, RunnerRepository.REMOTEDATABASECONFIGPATH + RunnerRepository.REMOTEDATABASECONFIGFILE, 375, true, null); temailfile = new JTextField(); // emailpanel = (JPanel) addPanel("Email XML path", "File location for email configuration", temailfile, RunnerRepository.REMOTEEMAILCONFIGPATH + RunnerRepository.REMOTEEMAILCONFIGFILE, 448, true, null) .getParent(); //paths.remove(emailpanel); // emailpanel.setBounds(360,440,350,100); // RunnerRepository.window.mainpanel.p4.getEmails().add(emailpanel); tglobalsfile = new JTextField(); addPanel("Globals XML file", "File location for globals parameters", tglobalsfile, RunnerRepository.GLOBALSREMOTEFILE, 521, true, null); tceport = new JTextField(); addPanel("Central Engine Port", "Central Engine port", tceport, RunnerRepository.getCentralEnginePort(), 1003, false, null); // traPort = new JTextField(); // addPanel("Resource Allocator Port","Resource Allocator Port", // traPort,RunnerRepository.getResourceAllocatorPort(),808,false,null); // thttpPort = new JTextField(); // addPanel("HTTP Server Port","HTTP Server Port",thttpPort, // RunnerRepository.getHTTPServerPort(),740,false,null); //paths.add(loadXML); if (!PermissionValidator.canChangeFWM()) { ttcpath.setEnabled(false); tMasterXML.setEnabled(false); tUsers.setEnabled(false); tepid.setEnabled(false); tSuites.setEnabled(false); tlog.setEnabled(false); trunning.setEnabled(false); tdebug.setEnabled(false); tsummary.setEnabled(false); tinfo.setEnabled(false); tcli.setEnabled(false); tdbfile.setEnabled(false); temailfile.setEnabled(false); tceport.setEnabled(false); libpath.setEnabled(false); tsecondarylog.setEnabled(false); testconfigpath.setEnabled(false); tglobalsfile.setEnabled(false); logsenabled.setEnabled(false); } }
From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java
private void handleFirstStart() { if (!ServiceFunctions.getPropertiesFile().exists()) { JOptionPane.showMessageDialog(mainFrame, "Willkommen bei " + APP_NAME, "Willkommen", JOptionPane.INFORMATION_MESSAGE); JPanel panel = new JPanel(new BorderLayout()); panel.add(new JLabel("<html>Wenn Sie " + APP_NAME + " nutzen mchten, mssen Sie die folgende Punkte akzeptieren." + "<ul>" + "<li>This software is under the GNU GENERAL PUBLIC LICENSE Version 3.<br>" + "View https://github.com/kekru/ILIASDownloader2/blob/master/LICENSE for detailed information." + "</li>" + "<li>Dieses Programm wird Ihr Passwort nicht speichern</li>" + "<li>Dieses Programm wird Ihren Loginnamen und Ihr Passwort nur an den von Ihnen angegebenen Server senden</li>" + "<li>Ihr Passwort wird im Arbeitsspeicher dieses Computers <b>nicht</b> verschlsselt gespeichert.<br>Ein Schadprogramm knnte den Arbeitsspeicher auslesen und so an Ihre Logindaten gelangen.<br>Der Autor von " + APP_NAME + " bernimmt keine Verantwortung fr die Sicherheit Ihrer Logindaten</li>" + "<li>Im nchsten Schritt mssen Sie Ihren Ilias Server eingeben. Bitte achten Sie darauf, dass die Adresse mit 'https://' beginnt.<br>Das bewirkt eine gesicherte Verbindung zwischen " + APP_NAME + " und Ihrem Ilias Server</li>" + "<li>Die Nutzung und die Weitergabe von " + APP_NAME + " ist kostenlos.</li>" + "<li>Beim Programmstart wird auf Updates berprft. Dabei wird lediglich der Programmname an den Updateserver gesendet. Ihre Logindaten oder andere persnliche Daten werden nicht bertragen.<br>Wenn Sie die Updatefunktion ausschalten mchten, starten Sie das Programm mit dem Parameter '" + StartGui.NO_UPDATER + "'</li>" + "</ul>" + "</html>"), BorderLayout.NORTH); JButton licenseButton = new JButton("Open GNU GENERAL PUBLIC LICENSE Version 3"); licenseButton.addActionListener(new ActionListener() { @Override// w ww . java 2 s . c o m public void actionPerformed(ActionEvent e) { openWebsiteLicense(); } }); panel.add(licenseButton, BorderLayout.CENTER); JCheckBox checkboxAccept = new JCheckBox( "Ich akzeptiere die hier aufgefhrten Bedingungen/I accept these agreements."); checkboxAccept.setSelected(false); panel.add(checkboxAccept, BorderLayout.SOUTH); if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(mainFrame, panel, "Bedingungen", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE) && checkboxAccept.isSelected()) { chooseServer(); } else { System.exit(0); } } }
From source file:com.smanempat.controller.ControllerClassification.java
public String[] processMining(JTextField textNumberOfK, JTable tablePreview, JLabel labelPesanError, JTable tableResult, JLabel labelSiswaIPA, JLabel labelSiswaIPS, JLabel labelKeterangan, JYearChooser jYearChooser1, JYearChooser jYearChooser2, JTabbedPane jTabbedPane1) { String numberValidate = textNumberOfK.getText(); ModelClassification modelClassification = new ModelClassification(); int rowCountModel = modelClassification.getRowCount(); int rowCountData = tablePreview.getRowCount(); System.out.println("Row Count Data : " + rowCountData); System.out.println("Row Count Model : " + rowCountModel); String[] knnValue = null;/*from ww w .j ava 2 s .c o m*/ /*Validasi Nilai Number of Nearest Neighbor*/ if (Pattern.matches("[0-9]+", numberValidate) == false && numberValidate.length() > 0) { labelPesanError.setText("Number of Nearest Neighbor tidak valid"); JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak valid!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon("src/com/smanempat/image/fail.png")); textNumberOfK.requestFocus(); } else if (numberValidate.isEmpty()) { JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak boleh kosong!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon("src/com/smanempat/image/fail.png")); labelPesanError.setText("Number of Nearest Neighbor tidak boleh kosong"); textNumberOfK.requestFocus(); } else if (Integer.parseInt(numberValidate) >= rowCountModel) { labelPesanError.setText("Number of Nearest Neighbor tidak boleh lebih dari " + rowCountModel + ""); JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak boleh lebih dari " + rowCountModel + " !", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon("src/com/smanempat/image/fail.png")); textNumberOfK.requestFocus(); } else { int confirm = 0; confirm = JOptionPane.showOptionDialog(null, "Yakin ingin memproses data?", "Proses Klasifikasi", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == JOptionPane.OK_OPTION) { int kValue = Integer.parseInt(textNumberOfK.getText()); String[][] modelValue = getModelValue(rowCountModel); double[][] dataValue = getDataValue(rowCountData, tablePreview); knnValue = getKNNValue(rowCountData, rowCountModel, modelValue, dataValue, kValue); showClassificationResult(tableResult, tablePreview, knnValue, rowCountData, labelSiswaIPA, labelSiswaIPS, labelKeterangan, jYearChooser1, jYearChooser2, kValue); jTabbedPane1.setSelectedIndex(1); } } return knnValue; }
From source file:calendarexportplugin.exporter.GoogleExporter.java
/** * Show the Settings Dialog for the exporter * * @param settings Settings//from www .ja va 2 s . c o m * @return true, if ok was pressed * @throws IOException Exception during connection * @throws ServiceException Problems with the google service */ private boolean showCalendarSettings(CalendarExportSettings settings) throws IOException, ServiceException { GoogleSettingsDialog settingsDialog; Window wnd = CalendarExportPlugin.getInstance().getBestParentFrame(); settingsDialog = new GoogleSettingsDialog(wnd, settings, mPassword); return settingsDialog.showDialog() == JOptionPane.OK_OPTION; }
From source file:unikn.dbis.univis.visualization.graph.plaf.VGraphUI.java
public VGraphUI() { VHintButton zoomIn = new VHintButton(VIcons.ZOOM_IN); menu.add(zoomIn);/*from w ww . j a v a 2 s . c o m*/ zoomIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VGraphCell cell = selectedCell; Object o = cell.getUserObject(); if (o != null && o instanceof VChartPanel) { VChartPanel chart = (VChartPanel) o; chart.zoomInBoth(0, 0); graph.repaint(); } } }); VHintButton zoomOut = new VHintButton(VIcons.ZOOM_OUT); menu.add(zoomOut); zoomOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VGraphCell cell = selectedCell; Object o = cell.getUserObject(); if (o != null && o instanceof VChartPanel) { VChartPanel chart = (VChartPanel) o; chart.zoomOutBoth(0, 0); graph.repaint(); } } }); VHintButton settings = new VHintButton(VIcons.APPLICATION_FORM_EDIT); menu.add(settings); settings.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VGraphCell cell = selectedCell; Object o = cell.getUserObject(); if (o != null && o instanceof VChartPanel) { VChartPanel chart = (VChartPanel) o; ChartEditor editor = ChartEditorManager.getChartEditor(chart.getChart()); int result = JOptionPane.showConfirmDialog(graph.getParent(), editor, "Chart_Properties", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { editor.updateChart(chart.getChart()); graph.repaint(); } } } }); VHintButton legend = new VHintButton(VIcons.BRICKS); menu.add(legend); legend.addActionListener(new ActionListener() { /** * Invoked when an action occurs. */ public void actionPerformed(ActionEvent e) { VGraphCell cell = selectedCell; Object o = cell.getUserObject(); if (o != null && o instanceof VChartPanel) { VChartPanel chart = (VChartPanel) o; VLegend legend = new VLegend(chart.getChart()); JPopupMenu menu = new JPopupMenu(); menu.add(legend); menu.show(graph, 0, 0); } } }); }