List of usage examples for javax.swing JOptionPane QUESTION_MESSAGE
int QUESTION_MESSAGE
To view the source code for javax.swing JOptionPane QUESTION_MESSAGE.
Click Source Link
From source file:com.openbravo.pos.sales.JRetailPanelTicket.java
private void printTicketGeneric(String sresourcename, RetailTicketInfo ticket, Object ticketext) { java.util.List<TicketLineConstructor> allLines = null; java.util.List<TicketLineConstructor> startallLines = new ArrayList<TicketLineConstructor>(); int count = 0; com.openbravo.pos.printer.printer.ImageBillPrinter printer = new ImageBillPrinter(); if (sresourcename.equals("Printer.Bill")) { allLines = getAllLines(ticket, ticketext); } else if (sresourcename.equals("Printer.NonChargableBill")) { allLines = getNonChargeableLines(ticket, ticketext); }/*from w w w . ja v a2 s.c o m*/ int divideLines = allLines.size() / 48; int remainder = allLines.size() % 48; int value = 48; int k = 0; if (divideLines > 0) { for (int i = 0; i < divideLines; i++) { for (int j = k; j < value; j++) { startallLines.add(new TicketLineConstructor(allLines.get(j).getLine())); } try { printer.print(startallLines); } catch (PrinterException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } if (allLines.size() > 48) { try { Thread.sleep(5000); } catch (InterruptedException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } int res = JOptionPane.showConfirmDialog(this, AppLocal.getIntString("message.wannaPrintcontinue"), AppLocal.getIntString("message.title"), JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE); if (res == JOptionPane.OK_OPTION) { k = value; value = value + 48; startallLines = new ArrayList<TicketLineConstructor>(); startallLines.clear(); } else { break; } } } } if (remainder > 0) { startallLines = new ArrayList<TicketLineConstructor>(); startallLines.clear(); for (int m = k; m < k + remainder; m++) { startallLines.add(new TicketLineConstructor(allLines.get(m).getLine())); } try { printer.print(startallLines); } catch (PrinterException ex) { Logger.getLogger(JRetailPanelTicket.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:com.xilinx.ultrascale.gui.MainScreen_video.java
private void windowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_windowClosing // TODO add your handling code here: //powerTimer.cancel(); Object[] options1 = { "No", "Yes" }; int s = JOptionPane.showOptionDialog(null, "This will uninstall Device Drivers. Are you sure?", " ", JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null); if (s == 1) { loadDelay = 0;/*from ww w . j a va 2 s . c om*/ timer.cancel(); if (testStarted) { testStarted = false; jbuttonEngStart.setText("Start"); int size = Integer.parseInt(sizeTextField.getText()); di.stopTest(0, testMode, size); } if (ethTestStarted0) { ethTestStarted0 = false; jbuttonEngStart1.setText("Start"); int size = Integer.parseInt(sizeTextField1.getText()); di.stopTest(0, eth0TestMode, size); } if (ethTestStarted1) { ethTestStarted1 = false; jbuttonEngStart2.setText("Start"); int size = Integer.parseInt(sizeTextField2.getText()); di.stopTest(0, eth1TestMode, size); } System.gc(); di.flush(); lp.uninstallDrivers(this); showDialog("Removing Device Drivers...Please wait..."); } // lp.showLP(); if (txMediaPlayer != null) { // Cleanly dispose of the media player instance and any associated native resources txMediaPlayer.release(); // Cleanly dispose of the media player factory and any associated native resources //txMediaPlayerFactory.release(); rxMediaPlayer.release(); // Cleanly dispose of the media player factory and any associated native resources //rxMediaPlayerFactory.release(); videoFrame.dispose(); frame1.dispose(); frame2.dispose(); } }
From source file:com.xilinx.ultrascale.gui.MainScreen.java
private void windowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_windowClosing // TODO add your handling code here: //powerTimer.cancel(); Object[] options1 = { "No", "Yes" }; int s = JOptionPane.showOptionDialog(null, "This will uninstall Device Drivers. Are you sure?", " ", JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null); if (s == 1) { timer.cancel();//w ww .j ava2s . c o m if (testStarted) { testStarted = false; jbuttonEngStart.setText("Start"); int size = Integer.parseInt(sizeTextField.getText()); di.stopTest(0, testMode, size); } if (ethTestStarted0) { ethTestStarted0 = false; jbuttonEngStart1.setText("Start"); int size = Integer.parseInt(sizeTextField1.getText()); di.stopTest(0, eth0TestMode, size); } if (ethTestStarted1) { ethTestStarted1 = false; jbuttonEngStart2.setText("Start"); int size = Integer.parseInt(sizeTextField2.getText()); int distatus = di.stopTest1(1, eth1TestMode, size); //System.out.println("distatus after stop " + distatus); } System.gc(); di.flush(); lp.uninstallDrivers(this); showDialog("Removing Device Drivers...Please wait..."); } // lp.showLP(); }
From source file:lu.fisch.unimozer.Diagram.java
public void reloadExistingSavedFiles(File dir) { if (!dir.exists()) return;//from w w w .j a va 2 s.c o m // get all files File[] files = dir.listFiles(); for (int f = 0; f < files.length; f++) { if (files[f].isDirectory()) { reloadExistingSavedFiles(files[f]); } else { if (files[f].getAbsolutePath().toLowerCase().endsWith(".java")) { try { MyClass nClass = new MyClass(files[f].getAbsolutePath(), Unimozer.FILE_ENCODING); /*Console.disconnectAll(); System.out.println(nClass.getContent().getText()); Console.connectAll();*/ MyClass eClass = classes.get(nClass.getFullName()); if (eClass != null) if (!eClass.isChanged()) { if (!eClass.getContent().getText().equals(nClass.getContent().getText()) && eClass.getLastModified() < nClass.getLastModified()) { diagram.loadClassFromString(eClass, nClass.getContent().getText()); diagram.cleanAll(); eClass.setChanged(false); repaint(); if (eClass == mouseClass) updateEditor(); } } else { if (!eClass.getContent().getText().equals(nClass.getContent().getText()) && eClass.getLastModified() < nClass.getLastModified()) { // the class changed! // ask the user to reload it ... int answer = JOptionPane.showConfirmDialog(this.frame, "The class " + eClass.getFullName() + " has been changed.\nReload it from the disk?", "File changed", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (answer == JOptionPane.YES_OPTION) { diagram.loadClassFromString(eClass, nClass.getContent().getText()); diagram.cleanAll(); //eClass.setContent(nClass.getContent().copy()); eClass.setChanged(false); repaint(); if (eClass == mouseClass) updateEditor(); } else { eClass.setLastModified(nClass.getLastModified()); } } } } catch (Exception ex) { //MyError.display(ex); ex.printStackTrace(); } } } } }
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Loads the assertions from a URL (e.g. across the network) *///from w ww. j a va2 s . c o m private void openOntologyUrl() { String urlString = null; URL url = null; do { try { urlString = JOptionPane.showInputDialog(this, "Input the URL for the remote ontology file to load.", "Input Ontology File URL", JOptionPane.QUESTION_MESSAGE); if (urlString != null) { urlString = urlString.trim(); if (urlString.length() > 0) { url = new URL(urlString); } } } catch (Throwable throwable) { LOGGER.error("Unable to open the URL", throwable); JOptionPane.showMessageDialog(this, "Incorrect format for a URL, cannot be parsed\n" + urlString + "\n\n" + throwable.getMessage(), "Incorrect URL Format", JOptionPane.ERROR_MESSAGE); url = null; } } while (url == null && urlString != null && urlString.length() > 0); if (url != null) { setupToLoadOntologyFile(new FileSource(url)); } }
From source file:com.xilinx.ultrascale.gui.MainScreen.java
private void videoplayButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_videoplayButtonActionPerformed // TODO add your handling code here: if (videoplayButton.getText().equalsIgnoreCase("Start")) { if (screenMode == 2 && ddrledState == 0) {// check for gencheck with card ddr. JOptionPane.showMessageDialog(this, "DDR4 not calibrated. Could not start the test."); return; }//from w w w . j a v a 2 s .c om // conditional check for min and max if (pathFied.getText().length() == 0) { Object[] options1 = { "Ok" }; int s = JOptionPane.showOptionDialog(null, "Please choose Video file path", " ", JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null); return; } if (Integer.parseInt(mincoeff.getValue().toString()) > Integer .parseInt(maxcoeff.getValue().toString())) { Object[] options1 = { "Ok" }; int s = JOptionPane.showOptionDialog(null, "Min Threshold should always be less than Max Threshold", " ", JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null); return; } messageLog2.append(">> Test Started\n"); videoPauseButton.setEnabled(true); videoPauseButton.setText("Pause"); videoplayButton.setText("Stop"); pathFied.setEnabled(false); browseButton.setEnabled(false); // mincoeff.setEnabled(false); // maxcoeff.setEnabled(false); // invertcheckbox.setEnabled(false); testStarted = true; di.startVideoTest(0, 7, Integer.parseInt(mincoeff.getValue().toString()), Integer.parseInt(maxcoeff.getValue().toString()), invertcheckbox.isSelected() ? 1 : 0, 7680); BGWorker worker = new BGWorker("./util/run_all_vlc.sh" + " start " + pathFied.getText()); worker.execute(); try { Thread.sleep(500); } catch (InterruptedException ex) { Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex); } } else { testStarted = false; videoplayButton.setText("Start"); videoPauseButton.setEnabled(false); BGWorker worker = new BGWorker("./kill_vlc.sh"); worker.execute(); pathFied.setEnabled(true); browseButton.setEnabled(true); // mincoeff.setEnabled(true); // maxcoeff.setEnabled(true); // invertcheckbox.setEnabled(true); di.stopVideoTest(0, 7, 7680); axiTxTextField4.setText("0.000"); axiRxTextField4.setText("0.000"); // ddrRxTextField.setText("0.000"); // ddrTxTextField.setText("0.000"); pcieTxTextField4.setText("0.000"); pcieRxTextField4.setText("0.000"); messageLog2.append(">> Test Stopped\n"); try { Thread.sleep(15000); } catch (InterruptedException ex) { Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:base.BasePlayer.FileRead.java
void readBED(File[] files) { try {//from w w w .j a va 2 s . c o m File bedfile; Main.drawCanvas.loading("Loading tracks"); int addedfiles = 0; for (int i = 0; i < files.length; i++) { bedfile = files[i]; if (!isTrackFile(bedfile)) { continue; } if (!checkIndex(files[i])) { if (files[i].getName().endsWith(".tsv.gz") || files[i].getName().endsWith(".tsv.bgz")) { Main.showError("No index file for the TSV file. Use Tools -> BED converter.", "Error"); continue; } if (JOptionPane.showConfirmDialog(Main.drawScroll, "No index file found. Do you want to create one?", "Indexing?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { Main.drawCanvas.loadingtext = "Indexing " + files[i].getName(); if (files[i].getName().endsWith(".gz")) { MethodLibrary.createBEDIndex(files[i]); } else { MethodLibrary.createBEDIndex2(files[i]); } } } if (!checkIndex(files[i])) { Main.showError("Could not open file. Is the file sorted?", "Note"); continue; } BedTrack addTrack = new BedTrack(bedfile, Main.bedCanvas.bedTrack.size()); if (bedfile.getName().endsWith("tsv.gz") || bedfile.getName().endsWith("tsv.bgz")) { addTrack.getZerobased().setSelected(false); addTrack.iszerobased = 1; addTrack.getSelector().frame.setVisible(true); } Main.bedCanvas.bedTrack.add(addTrack); Main.bedCanvas.trackDivider.add(0.0); addTrack.minvalue = 0; if (bedfile.length() / 1048576 < Settings.settings.get("bigFile")) { addTrack.small = true; Main.bedCanvas.getBEDfeatures(addTrack, 1, Main.drawCanvas.splits.get(0).chromEnd); } if (bedfile.getName().toLowerCase().endsWith(".bedgraph") || bedfile.getName().toLowerCase().endsWith(".bedgraph.gz")) { Main.bedCanvas.pressGraph(addTrack); addTrack.getSelectorButton().setVisible(true); } else if (bedfile.getName().toLowerCase().endsWith("bigwig") || bedfile.getName().toLowerCase().endsWith("bw")) { addTrack.bigWig = true; addTrack.small = true; Main.bedCanvas.pressGraph(addTrack); addTrack.getSelectorButton().setVisible(false); Main.bedCanvas.getBEDfeatures(addTrack, (int) Main.drawCanvas.splits.get(0).start, (int) Main.drawCanvas.splits.get(0).end); } else { setBedTrack(addTrack); } addedfiles++; setTable(addTrack); } Main.drawCanvas.ready("Loading tracks"); if (Main.bedCanvas.bedTrack.size() == 0) { return; } if (!Main.trackPane.isVisible()) { Main.trackPane.setVisible(true); Main.varpane.setDividerSize(3); if (addedfiles < 5) { Main.varpane.setResizeWeight(addedfiles * 0.1); Main.trackPane.setDividerLocation(addedfiles * 0.1); Main.varpane.setDividerLocation(addedfiles * 0.1); } else { Main.varpane.setResizeWeight(0.8); Main.trackPane.setDividerLocation(0.8); /*Main.bedCanvas.setPreferredSize(new Dimension(Main.drawWidth, Main.bedCanvas.bedTrack.size()*30 )); Main.bedCanvas.bufImage = MethodLibrary.toCompatibleImage(new BufferedImage((int)Main.screenSize.getWidth(), (int)Main.bedCanvas.bedTrack.size()*30, BufferedImage.TYPE_INT_ARGB)); Main.bedCanvas.buf = (Graphics2D)Main.bedCanvas.bufImage.getGraphics(); Main.bedCanvas.nodeImage = MethodLibrary.toCompatibleImage(new BufferedImage((int)Main.screenSize.getWidth(), (int)Main.bedCanvas.bedTrack.size()*30, BufferedImage.TYPE_INT_ARGB)); Main.bedCanvas.nodebuf = (Graphics2D)Main.bedCanvas.nodeImage.getGraphics(); */ Main.varpane.setDividerLocation(0.8); } Main.trackPane.revalidate(); Main.varpane.revalidate(); } else { Main.trackPane.setDividerLocation(Main.trackPane.getDividerLocation() + 70); Main.varpane.setDividerLocation(Main.varpane.getDividerLocation() + 70); Main.varpane.revalidate(); Main.trackPane.revalidate(); if (Main.controlScroll.isVisible()) { Main.trackPane.setDividerSize(3); } } Main.bedScroll.setVisible(true); Main.bedCanvas.setVisible(true); for (int i = 0; i < Main.bedCanvas.trackDivider.size(); i++) { Main.bedCanvas.trackDivider.set(i, ((i + 1) * (Main.varpane.getDividerLocation() / (double) Main.bedCanvas.trackDivider.size()))); } Main.trackPane.setDividerLocation((int) ((Main.bedCanvas.trackDivider.size()) * (Main.varpane.getDividerLocation() / (double) Main.bedCanvas.trackDivider.size()))); } catch (Exception e) { e.printStackTrace(); ErrorLog.addError(e.getStackTrace()); } }
From source file:lu.fisch.unimozer.Diagram.java
public void run() { try {/*from w w w . java2 s . co m*/ // compile all //doCompilationOnly(null); //frame.setCompilationErrors(new Vector<CompilationError>()); if (compile()) { Vector<String> mains = getMains(); String runnable = null; if (mains.size() == 0) { JOptionPane.showMessageDialog(frame, "Sorry, but your project does not contain any runnable public class ...", "Error", JOptionPane.ERROR_MESSAGE, Unimozer.IMG_ERROR); } else { if (mains.size() == 1) { runnable = mains.get(0); } else { String[] classNames = new String[mains.size()]; for (int c = 0; c < mains.size(); c++) classNames[c] = mains.get(c); runnable = (String) JOptionPane.showInputDialog(frame, "Unimozer detected more than one runnable class.\n" + "Please select which one you want to run.", "Run", JOptionPane.QUESTION_MESSAGE, Unimozer.IMG_QUESTION, classNames, ""); } // we know now what to run MyClass runnClass = classes.get(runnable); // set full signature String fullSign = "void main(String[] args)"; if (runnClass.hasMain2()) fullSign = "void main(String args[])"; // get signature String sign = runnClass.getSignatureByFullSignature(fullSign); String complete = runnClass.getCompleteSignatureBySignature(sign); if ((runnClass.hasMain2()) && (sign.equals("void main(String)"))) { sign = "void main(String[])"; } //System.out.println("Calling method (full): "+fullSign); //System.out.println("Calling method : "+sign); // find method Class c = Runtime5.getInstance().load(runnClass.getFullName()); Method m[] = c.getMethods(); for (int i = 0; i < m.length; i++) { String full = ""; full += m[i].getReturnType().getSimpleName(); full += " "; full += m[i].getName(); full += "("; Class<?>[] tvm = m[i].getParameterTypes(); LinkedHashMap<String, String> genericInputs = new LinkedHashMap<String, String>(); for (int t = 0; t < tvm.length; t++) { String sn = tvm[t].toString(); genericInputs.put("param" + t, sn); sn = sn.substring(sn.lastIndexOf('.') + 1, sn.length()); if (sn.startsWith("class")) sn = sn.substring(5).trim(); // array is shown as ";" ??? if (sn.endsWith(";")) { sn = sn.substring(0, sn.length() - 1) + "[]"; } full += sn + ", "; } if (tvm.length > 0) full = full.substring(0, full.length() - 2); full += ")"; //if((full.equals(sign) || full.equals(fullSign))) // System.out.println("Found: "+full); if ((full.equals(sign) || full.equals(fullSign))) { LinkedHashMap<String, String> inputs = runnClass.getInputsBySignature(sign); //System.out.println(inputs); //System.out.println(genericInputs); if (inputs.size() != genericInputs.size()) { inputs = genericInputs; } MethodInputs mi = null; boolean go = true; if (inputs.size() > 0) { mi = new MethodInputs(frame, inputs, full, runnClass.getJavaDocBySignature(sign)); go = mi.OK; } if (go == true) { try { String method = runnClass.getFullName() + "." + m[i].getName() + "("; if (inputs.size() > 0) { Object[] keys = inputs.keySet().toArray(); //int cc = 0; for (int in = 0; in < keys.length; in++) { String name = (String) keys[in]; String val = mi.getValueFor(name); if (val.equals("")) val = "null"; else if (!val.startsWith("new String[]")) { String[] pieces = val.split("\\s+"); String inp = ""; for (int iin = 0; iin < pieces.length; iin++) { if (inp.equals("")) inp = pieces[iin]; else inp += "\",\"" + pieces[iin].replace("\"", "\\\""); } val = "new String[] {\"" + inp + "\"}"; } method += val + ","; } method = method.substring(0, method.length() - 1); } method += ")"; // Invoke method in a new thread final String myMeth = method; Console.disconnectAll(); System.out.println("Running now: " + myMeth); Console.connectAll(); Runnable r = new Runnable() { public void run() { Console.cls(); try { //Console.disconnectAll(); //System.out.println(myMeth); Object retobj = Runtime5.getInstance().executeMethod(myMeth); if (retobj != null) JOptionPane.showMessageDialog(frame, retobj.toString(), "Result", JOptionPane.INFORMATION_MESSAGE, Unimozer.IMG_INFO); } catch (EvalError ex) { JOptionPane.showMessageDialog(frame, ex.toString(), "Execution error", JOptionPane.ERROR_MESSAGE, Unimozer.IMG_ERROR); MyError.display(ex); } } }; Thread t = new Thread(r); t.start(); //System.out.println(method); //Object retobj = Runtime5.getInstance().executeMethod(method); //if(retobj!=null) JOptionPane.showMessageDialog(frame, retobj.toString(), "Result", JOptionPane.INFORMATION_MESSAGE,Unimozer.IMG_INFO); } catch (Throwable ex) { JOptionPane.showMessageDialog(frame, ex.toString(), "Execution error", JOptionPane.ERROR_MESSAGE, Unimozer.IMG_ERROR); MyError.display(ex); } } } } } } } catch (ClassNotFoundException ex) { JOptionPane.showMessageDialog(frame, "There was an error while running your project ...", "Error :: ClassNotFoundException", JOptionPane.ERROR_MESSAGE, Unimozer.IMG_ERROR); } }
From source file:com.xilinx.ultrascale.gui.MainScreen_video.java
private void videoplayButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_videoplayButtonActionPerformed // TODO add your handling code here: if (videoplayButton.getText().equalsIgnoreCase("Start")) { if (screenMode == 2 && ddrledState == 0) {// check for gencheck with card ddr. JOptionPane.showMessageDialog(this, "DDR4 not calibrated. Could not start the test."); return; }// w ww . ja va 2 s .co m // conditional check for min and max if (pathFied.getText().length() == 0) { Object[] options1 = { "Ok" }; int s = JOptionPane.showOptionDialog(null, "Please choose Video file path", " ", JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null); return; } if (Integer.parseInt(mincoeff.getValue().toString()) > Integer .parseInt(maxcoeff.getValue().toString())) { Object[] options1 = { "Ok" }; int s = JOptionPane.showOptionDialog(null, "Min Threshold should always be less than Max Threshold", " ", JOptionPane.CLOSED_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null); return; } // showing the videos panel //videoFrame.setLocationRelativeTo(this); videoFrame.setVisible(true); frame1.setVisible(true); frame2.setVisible(true); rxMediaPlayer.getMediaPlayer().playMedia("v4l2:///dev/video0"); di.startVideoTest(0, 7, Integer.parseInt(mincoeff.getValue().toString()), Integer.parseInt(maxcoeff.getValue().toString()), invertcheckbox.isSelected() ? 1 : 0, 7680); Timer timers = new java.util.Timer(); timers.schedule(new TimerTask() { @Override public void run() { txMediaPlayer.getMediaPlayer().playMedia(pathFied.getText()); txMediaPlayer.getMediaPlayer().setRepeat(true); } }, 2000); // txMediaPlayer.setRate((float) 16.0); messageLog2.append(">> Test Started\n"); videoPauseButton.setEnabled(true); videoPauseButton.setText("Pause"); videoplayButton.setText("Stop"); pathFied.setEnabled(false); browseButton.setEnabled(false); // mincoeff.setEnabled(false); // maxcoeff.setEnabled(false); // invertcheckbox.setEnabled(false); testStarted = true; //BGWorker worker1 = new BGWorker("./run_receive_vlc.sh"); //worker1.execute(); // pworker = new ProcessWorker("./run_receive_vlc.sh"); // pworker.execute(); // try { // Thread.sleep(500); // } catch (InterruptedException ex) { // Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex); // } // worker = new BGWorker("./util/run_vlc.sh" + " start " + pathFied.getText()); // worker.execute(); // try { // Thread.sleep(500); // } catch (InterruptedException ex) { // Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex); // } } else { testStarted = false; videoplayButton.setText("Wait"); videoPauseButton.setEnabled(false); di.stopVideoTest(0, 7, 7680); // if (worker1 != null){ // worker1.cancel(true); // worker1 = null; // } // // if(worker != null){ // worker.cancel(true); // worker = null; // } // BGWorker worker1 = new BGWorker("./util/run_vlc.sh exit"); // worker1.execute(); //pworker.p.destroy(); txMediaPlayer.getMediaPlayer().stop(); rxMediaPlayer.getMediaPlayer().stop(); videoFrame.setVisible(false); frame1.setVisible(false); frame2.setVisible(false); pathFied.setEnabled(true); browseButton.setEnabled(true); // mincoeff.setEnabled(true); // maxcoeff.setEnabled(true); // invertcheckbox.setEnabled(true); axiTxTextField4.setText("0.000"); axiRxTextField4.setText("0.000"); // ddrRxTextField.setText("0.000"); // ddrTxTextField.setText("0.000"); pcieTxTextField4.setText("0.000"); pcieRxTextField4.setText("0.000"); messageLog2.append(">> Test Stopped\n"); // try { // Thread.sleep(15000); // } catch (InterruptedException ex) { // Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex); // } // disable button until the vlc rec window close. videoplayButton.setEnabled(false); Timer timers = new java.util.Timer(); timers.schedule(new TimerTask() { @Override public void run() { enablePlayButton(); } }, 3000); } }
From source file:lu.fisch.unimozer.Diagram.java
public void runFast() { //System.out.println("TZ: runFast"); try {//from www . ja v a2 s .c o m // compile all //doCompilationOnly(null); //frame.setCompilationErrors(new Vector<CompilationError>()); //Console.disconnectAll(); //Console.disconnectErr(); if (compile()) { Vector<String> mains = getMains(); String runnable = null; if (mains.size() == 0) { JOptionPane.showMessageDialog(frame, "Sorry, but your project does not contain any runnable public class ...", "Error", JOptionPane.ERROR_MESSAGE, Unimozer.IMG_ERROR); } else { if (mains.size() == 1) { runnable = mains.get(0); } else { String[] classNames = new String[mains.size()]; for (int c = 0; c < mains.size(); c++) classNames[c] = mains.get(c); runnable = (String) JOptionPane.showInputDialog(frame, "Unimozer detected more than one runnable class.\n" + "Please select which one you want to run.", "Run", JOptionPane.QUESTION_MESSAGE, Unimozer.IMG_QUESTION, classNames, ""); } // we know now what to run MyClass runnClass = classes.get(runnable); // set full signature String fullSign = "void main(String[] args)"; if (runnClass.hasMain2()) fullSign = "void main(String args[])"; // get signature String sign = runnClass.getSignatureByFullSignature(fullSign); String complete = runnClass.getCompleteSignatureBySignature(sign); if ((runnClass.hasMain2()) && (sign.equals("void main(String)"))) { sign = "void main(String[])"; } //System.out.println("Calling method (full): "+fullSign); //System.out.println("Calling method : "+sign); // find method System.out.println("TZ: compile"); Class c = Runtime5.getInstance().load(runnClass.getFullName()); Method m[] = c.getMethods(); for (int i = 0; i < m.length; i++) { String full = ""; full += m[i].getReturnType().getSimpleName(); full += " "; full += m[i].getName(); full += "("; Class<?>[] tvm = m[i].getParameterTypes(); LinkedHashMap<String, String> genericInputs = new LinkedHashMap<String, String>(); for (int t = 0; t < tvm.length; t++) { String sn = tvm[t].toString(); genericInputs.put("param" + t, sn); sn = sn.substring(sn.lastIndexOf('.') + 1, sn.length()); if (sn.startsWith("class")) sn = sn.substring(5).trim(); // array is shown as ";" ??? if (sn.endsWith(";")) { sn = sn.substring(0, sn.length() - 1) + "[]"; } full += sn + ", "; } if (tvm.length > 0) full = full.substring(0, full.length() - 2); full += ")"; //if((full.equals(sign) || full.equals(fullSign))) // System.out.println("Found: "+full); if ((full.equals(sign) || full.equals(fullSign))) { try { String method = runnClass.getFullName() + "." + m[i].getName() + "(null)"; // Invoke method in a new thread final String myMeth = method; //System.out.println("Running now: "+myMeth); Runnable r = new Runnable() { public void run() { Console.cls(); try { Console.disconnectAll(); System.out.println("Running now: " + myMeth); System.out.println(Runtime5.getInstance().toString()); Console.connectAll(); Object retobj = Runtime5.getInstance().executeMethod(myMeth); if (retobj != null) JOptionPane.showMessageDialog(frame, retobj.toString(), "Result", JOptionPane.INFORMATION_MESSAGE, Unimozer.IMG_INFO); } catch (EvalError ex) { JOptionPane.showMessageDialog(frame, ex.toString(), "Execution error", JOptionPane.ERROR_MESSAGE, Unimozer.IMG_ERROR); MyError.display(ex); } } }; Thread t = new Thread(r); t.start(); //System.out.println(method); //Object retobj = Runtime5.getInstance().executeMethod(method); //if(retobj!=null) JOptionPane.showMessageDialog(frame, retobj.toString(), "Result", JOptionPane.INFORMATION_MESSAGE,Unimozer.IMG_INFO); } catch (Throwable ex) { JOptionPane.showMessageDialog(frame, ex.toString(), "Execution error", JOptionPane.ERROR_MESSAGE, Unimozer.IMG_ERROR); MyError.display(ex); } } } } } } catch (ClassNotFoundException ex) { JOptionPane.showMessageDialog(frame, "There was an error while running your project ...", "Error :: ClassNotFoundException", JOptionPane.ERROR_MESSAGE, Unimozer.IMG_ERROR); } }