/** * Creates a new connection to the specified host of specified type. <br> * <br> * type: Type of connection to create <br> * destination: Host to connect to (in "host:port" or "host" syntax) */ public Connection(java.net.InetAddress host, int port, PluginContext ctx) throws MessagingNetworkException, java.io.IOException { if (TRAKTOR_USED) { if (traktorConnectionDown) throw new IOException("network is down"); traktor = new Frame("" + host + ":" + port + " - Traktor"); final Checkbox c = new Checkbox("break this & ALL future connections"); c.setState(traktorConnectionDown); c.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { traktorConnectionDown = c.getState(); try { if (traktorConnectionDown) closeSocket(); } catch (Exception ex) { } } }); traktor.add(c); traktor.setSize(100, 50); traktor.setLocation(230, 450); traktor.setVisible(true); } else { traktor = null; } }
/*.................................................................................................................*/ public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equalsIgnoreCase("setToDefaults")) { setDefaultTNTCommandsSearchOptions(); searchField.setText(searchArguments); bootstrapSearchField.setText(bootstrapSearchArguments); harvestOnlyStrictConsensusBox.setState(harvestOnlyStrictConsensus); resamplingAllConsensusTreesBox.setState(!resamplingAllConsensusTrees); bootStrapRepsField.setValue(bootstrapreps); } else if (e.getActionCommand().equalsIgnoreCase("setToDefaultsOtherOptions")) { setDefaultTNTCommandsOtherOptions(); otherOptionsField.setText(otherOptions); convertGapsBox.setState(convertGapsToMissing); } else if (e.getActionCommand().equalsIgnoreCase("browseSearchScript") && searchScriptPathField != null) { MesquiteString directoryName = new MesquiteString(); MesquiteString fileName = new MesquiteString(); String path = MesquiteFile.openFileDialog("Choose Search Script File", directoryName, fileName); if (StringUtil.notEmpty(path)) searchScriptPathField.setText(path); } else if (e.getActionCommand().equalsIgnoreCase("browseBootSearchScript") && bootSearchScriptPathField != null) { MesquiteString directoryName = new MesquiteString(); MesquiteString fileName = new MesquiteString(); String path = MesquiteFile.openFileDialog( "Choose Resampling Search Script File", directoryName, fileName); if (StringUtil.notEmpty(path)) bootSearchScriptPathField.setText(path); } }
public void itemStateChanged(ItemEvent E) { // The 'log chat' checkbox if (E.getSource() == logChat) { server.logChats = logChat.getState(); // Loop through all of the chat rooms, and set the logging // state to be the same as the value of the checkbox for (int count = 0; count < server.chatRooms.size(); count++) { babylonChatRoom tmp = (babylonChatRoom) server.chatRooms.elementAt(count); try { tmp.setLogging(server.logChats); } catch (IOException e) { server.serverOutput( server.strings.get(thisClass, "togglelogerror") + " " + tmp.name + "\n"); } } } // The user list if (E.getSource() == userList) { // If anything is selected, enable the 'disconnect user' // button, otherwise disable it synchronized (userList) { disconnect.setEnabled(userList.getSelectedItem() != null); } } }
/** * Diff�rentes actions men�es suivant le choix de l'utilisateur * * @param e evenement d�clench� par le clic sur ok ou annuler */ public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == ok) { if (plus.getState() == true) { sign = 1; } else { sign = 0; } threshold = tf.getText(); try { thresholdVal = Integer.parseInt(threshold); if (thresholdVal < 0) { JOptionPane.showMessageDialog( this.mf, "Threshold must be a positive integer", "Error", JOptionPane.WARNING_MESSAGE); this.setVisible(true); } else { gz.draw(); gz.creatTrans(thresholdVal, sign); auto.modif(true); this.dispose(); } } catch (NumberFormatException ex) { JOptionPane.showMessageDialog( this.mf, "Threshold must be a positive integer.", "Error", JOptionPane.WARNING_MESSAGE); this.setVisible(true); } } else if (source == cancel) { gz.draw(); bar.displayInfo(mf.frameName); bar.can = true; this.dispose(); } gz.menu.majMenus(); }
public babylonServerWindow(babylonServer parent, String Name) { super(Name); server = parent; myLayout = new GridBagLayout(); setLayout(myLayout); p = new Panel(); p.setLayout(myLayout); listening = new Label(server.strings.get(thisClass, "listenport") + " " + server.port); p.add( listening, new babylonConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); logChat = new Checkbox(server.strings.get(thisClass, "logchats"), server.logChats); logChat.addItemListener(this); p.add( logChat, new babylonConstraints( 1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); userList = new List(4, false); userList.addItemListener(this); p.add( userList, new babylonConstraints( 0, 1, 1, 5, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); userAdmin = new Button(server.strings.get(thisClass, "usermanagement")); userAdmin.addActionListener(this); p.add( userAdmin, new babylonConstraints( 1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); console = new Button(server.strings.get(thisClass, "adminclient")); console.addActionListener(this); p.add( console, new babylonConstraints( 1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); disconnect = new Button(server.strings.get(thisClass, "disconnectuser")); disconnect.setEnabled(false); disconnect.addActionListener(this); p.add( disconnect, new babylonConstraints( 1, 3, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); disconnectAll = new Button(server.strings.get(thisClass, "disconnectall")); disconnectAll.setEnabled(false); disconnectAll.addActionListener(this); p.add( disconnectAll, new babylonConstraints( 1, 4, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); shutdown = new Button(server.strings.get(thisClass, "shutdown")); shutdown.addActionListener(this); p.add( shutdown, new babylonConstraints( 1, 5, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); stats = new TextField( server.strings.get(thisClass, "connectionscurrent") + " 0 " + server.strings.get(thisClass, "connectionspeak") + " 0 " + server.strings.get(thisClass, "connectionstotal") + " 0", 40); stats.setEditable(false); p.add( stats, new babylonConstraints( 0, 7, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); logWindow = new TextArea( server.strings.get(thisClass, "activitylog") + "\n", 10, 40, TextArea.SCROLLBARS_VERTICAL_ONLY); logWindow.setEditable(false); p.add( logWindow, new babylonConstraints( 0, 8, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); canvas = new babylonPictureCanvas(this); p.add( canvas, new babylonConstraints( 0, 9, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); add( p, new babylonConstraints( 0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); try { URL url = new URL("file", "localhost", "babylonPic.jpg"); Image image = getToolkit().getImage(url); canvas.setimage(image); } catch (Exception e) { System.out.println(e); } try { URL iconUrl = new URL("file", "localhost", "babylonIcon.jpg"); ImageIcon icon = new ImageIcon(iconUrl); this.setIconImage(icon.getImage()); } catch (Exception e) { /* Not important */ } addWindowListener(this); setSize(600, 600); pack(); }
public void focusLost(FocusEvent e) { int id = 0; boolean res = false; JTextField t = (JTextField) e.getSource(); if (t == tpid) { try { id = Integer.parseInt(tpid.getText()); res = patient.psearch(id); } catch (Exception e1) { } if (res) { int no, ag = 0, fee = 0; String pfn = "", bg = "", pmn = "", dt1 = "", pln = "", add = "", sym = "", dn = "", dig = "", cn = "", gender = "", wgt = ""; try { dt1 = patient.rs.getString(1); no = patient.rs.getInt(2); pfn = patient.rs.getString(3); pmn = patient.rs.getString(4); pln = patient.rs.getString(5); gender = patient.rs.getString(6); ag = patient.rs.getInt(7); wgt = patient.rs.getString(8); add = patient.rs.getString(9); cn = patient.rs.getString(10); dn = patient.rs.getString(11); sym = patient.rs.getString(12); dig = patient.rs.getString(13); fee = patient.rs.getInt(14); bg = patient.rs.getString(15); dir = patient.rs.getString(17); s = dir; repaint(); j13 = new JLabel("OLD IMAGE"); j13.setBounds(840, 5, 300, 300); JLabel j12 = new JLabel("OLD PHOTO") { public void paint(Graphics g) { ImageIcon ic = new ImageIcon(s); Image img = ic.getImage(); g.drawImage(img, 0, 0, 150, 150, this); } }; // q.flushAll() /*ImageIcon ic=new ImageIcon(dir); JLabel j12=new JLabel("",ic,JLabel.CENTER);*/ j12.setBounds(670, 70, 300, 300); // image.setBounds(700,300,100,100); q.add(j12); q.add(j13); repaint(); System.out.println("8743t32874" + dir); } catch (Exception e2) { } if (gender.equals("Male")) cm.setState(true); else cf.setState(true); tdt.setText(dt1); tpfnm.setText(pfn); tpmnm.setText(pmn); tplnm.setText(pln); tage.setText("" + ag); tfee.setText("" + fee); tadd.setText(add); tdig.setText(dig); tdnm.setText(dn); tsym.setText(sym); tcno.setText(cn); twt.setText(wgt); tbg.setText(bg); // cm.setState(set1State()); // cf.setSelectedCheckbox(gender); ba.setEnabled(false); bm.setEnabled(true); bd.setEnabled(true); } else { if (id == 0) { bl.setEnabled(true); ba.setEnabled(false); } else ba.setEnabled(true); bm.setEnabled(false); bd.setEnabled(false); } } }
public patientAdd(String s) { super(s); image = new JLabel() { public void paint(Graphics g) { ImageIcon ic = new ImageIcon(str); Image img = ic.getImage(); g.drawImage(img, 0, 0, 150, 150, this); } }; image.setBounds(670, 270, 300, 300); bu = new JButton("UPLOAD"); bu.setBounds(700, 230, 100, 20); bu.addActionListener(this); // q.add(bu); ldt = new JLabel("Date"); lpid = new JLabel("Patient ID"); lpnm = new JLabel("Patient Name"); lgen = new JLabel("Gender"); lbg = new JLabel("Blood Group"); lage = new JLabel("Age"); lwt = new JLabel("Weight Kg"); ladd = new JLabel("Address"); lcno = new JLabel("Cont. no."); ldnm = new JLabel("Doctor Name Dr."); lsym = new JLabel("Symptoms"); ldig = new JLabel("Diagnosis"); lfee = new JLabel("Fee Rs."); cbg = new CheckboxGroup(); cm = new Checkbox("Male", cbg, false); cm.addItemListener(this); cf = new Checkbox("Female", cbg, false); cf.setState(true); cf.addItemListener(this); tdt = new JTextField(15); tpid = new JTextField(6); tpid.addFocusListener(this); tpfnm = new JTextField("first"); tpmnm = new JTextField("middle"); tplnm = new JTextField("last"); tage = new JTextField(4); tage.addFocusListener(this); tbg = new JTextField(6); twt = new JTextField(5); tadd = new TextArea(patient.addr); tcno = new JTextField(20); tdnm = new JTextField(20); tsym = new TextArea(); tdig = new JTextField(20); tfee = new JTextField(6); tfee.addFocusListener(this); ba = new JButton("ADD"); ba.addActionListener(this); bm = new JButton("CANCEL"); bm.addActionListener(this); bd = new JButton("DELETE"); bd.addActionListener(this); bl = new JButton("DISPLAY"); bl.addActionListener(this); bs = new JButton("SEARCH"); bs.addActionListener(this); JPanel p = new JPanel(); p.add(ba); p.add(bm); // p.add(bd); // p.add(bl); // p.add(bs); add(p, BorderLayout.SOUTH); q = new JPanel(); q.setLayout(null); ldt.setBounds(1015, 20, 60, 20); q.add(ldt); tdt.setBounds(1060, 20, 170, 20); q.add(tdt); lpid.setBounds(70, 60, 80, 20); q.add(lpid); tpid.setBounds(200, 60, 60, 20); q.add(tpid); lpnm.setBounds(70, 100, 80, 20); q.add(lpnm); tpfnm.setBounds(200, 100, 100, 20); q.add(tpfnm); tpmnm.setBounds(320, 100, 100, 20); q.add(tpmnm); tplnm.setBounds(440, 100, 100, 20); q.add(tplnm); lgen.setBounds(70, 140, 60, 20); q.add(lgen); lbg.setBounds(370, 140, 80, 20); q.add(lbg); tbg.setBounds(470, 140, 60, 20); q.add(tbg); cm.setBounds(200, 140, 60, 20); cf.setBounds(280, 140, 60, 20); lage.setBounds(70, 180, 40, 20); q.add(lage); tage.setBounds(200, 180, 50, 20); q.add(tage); lwt.setBounds(370, 180, 200, 20); q.add(lwt); twt.setBounds(470, 180, 60, 20); q.add(twt); ladd.setBounds(70, 220, 60, 20); q.add(ladd); tadd.setBounds(200, 220, 350, 50); q.add(tadd); lcno.setBounds(70, 310, 60, 20); q.add(lcno); tcno.setBounds(200, 310, 120, 20); q.add(tcno); ldnm.setBounds(70, 350, 200, 20); q.add(ldnm); tdnm.setBounds(200, 350, 150, 20); q.add(tdnm); lsym.setBounds(70, 390, 100, 20); q.add(lsym); tsym.setBounds(200, 390, 300, 70); q.add(tsym); ldig.setBounds(70, 480, 60, 20); q.add(ldig); tdig.setBounds(200, 480, 100, 20); q.add(tdig); lfee.setBounds(70, 520, 200, 20); q.add(lfee); tfee.setBounds(200, 520, 40, 20); q.add(tfee); q.add(cm); q.add(cf); q.add(image); q.add(bu); add(q, BorderLayout.CENTER); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { try { patient.con.close(); System.exit(0); } catch (Exception e8) { } } }); System.out.println(tadd.getText()); setSize(1330, 740); setVisible(true); }
public boolean queryOptions() { if (!okToInteractWithUser( CAN_PROCEED_ANYWAY, "Querying Options")) // Debugg.println needs to check that options set well enough to // proceed anyway return true; boolean closeWizard = false; if ((MesquiteTrunk.isMacOSXBeforeSnowLeopard()) && MesquiteDialog.currentWizard == null) { CommandRecord cRec = null; cRec = MesquiteThread.getCurrentCommandRecordDefIfNull(null); if (cRec != null) { cRec.requestEstablishWizard(true); closeWizard = true; } } MesquiteInteger buttonPressed = new MesquiteInteger(1); queryOptionsDialog = new ExtensibleDialog( containerOfModule(), "TNT Options & Locations", buttonPressed); // MesquiteTrunk.mesquiteTrunk.containerOfModule() // queryOptionsDialog.addLabel("TNT - Options and Locations"); String helpString = "This module will prepare a matrix for TNT, and ask TNT do to an analysis. A command-line version of TNT must be installed. " + "You can ask it to do a bootstrap analysis or not. " + "Mesquite will read in the trees found by TNT. "; queryOptionsDialog.appendToHelpString(helpString); queryOptionsDialog.setHelpURL(zephyrRunnerEmployer.getProgramURL()); MesquiteTabbedPanel tabbedPanel = queryOptionsDialog.addMesquiteTabbedPanel(); tabbedPanel.addPanel("TNT Program Details", true); externalProcRunner.addItemsToDialogPanel(queryOptionsDialog); Checkbox parallelCheckBox = queryOptionsDialog.addCheckBox("use PVM for parallel processing", parallel); parallelCheckBox.addItemListener(this); IntegerField slavesField = queryOptionsDialog.addIntegerField( "Number of Slaves", numSlaves, 4, 0, MesquiteInteger.infinite); IntegerField maxRamField = queryOptionsDialog.addIntegerField("mxram value", mxram, 4, 0, MesquiteInteger.infinite); tabbedPanel.addPanel("Search Options", true); Choice searchStyleChoice = null; if (bootstrapAllowed) searchStyleChoice = queryOptionsDialog.addPopUpMenu( "Type of search/resampling:", new String[] { "Regular Search", "Bootstrap", "Jackknife", "Symmetric Resampled", "Poisson Bootstrap" }, searchStyle); queryOptionsDialog.addLabel("Regular Search Commands"); searchField = queryOptionsDialog.addTextAreaSmallFont(searchArguments, 7, 80); searchScriptPathField = queryOptionsDialog.addTextField( "Path to TNT run file containing search commands", searchScriptPath, 40); Button browseSearchScriptPathButton = queryOptionsDialog.addAListenedButton("Browse...", null, this); browseSearchScriptPathButton.setActionCommand("browseSearchScript"); harvestOnlyStrictConsensusBox = queryOptionsDialog.addCheckBox("only acquire strict consensus", harvestOnlyStrictConsensus); queryOptionsDialog.addHorizontalLine(1); // Checkbox doBootstrapBox = queryOptionsDialog.addCheckBox("do bootstrapping", doBootstrap); if (bootstrapAllowed) { bootStrapRepsField = queryOptionsDialog.addIntegerField( "Resampling Replicates", bootstrapreps, 8, 0, MesquiteInteger.infinite); queryOptionsDialog.addLabel("Resampling Search Commands"); bootstrapSearchField = queryOptionsDialog.addTextAreaSmallFont(bootstrapSearchArguments, 7, 80); bootSearchScriptPathField = queryOptionsDialog.addTextField( "Path to TNT run file containing search commands for resampled", bootSearchScriptPath, 30); Button browseBootSearchScriptPathButton = queryOptionsDialog.addAListenedButton("Browse...", null, this); browseSearchScriptPathButton.setActionCommand("browseBootSearchScript"); resamplingAllConsensusTreesBox = queryOptionsDialog.addCheckBox( "allow TNT to calculate consensus tree", !resamplingAllConsensusTrees); } adjustDialogText(); queryOptionsDialog.addHorizontalLine(1); queryOptionsDialog.addNewDialogPanel(); useDefaultsButton = queryOptionsDialog.addAListenedButton("Set to Defaults", null, this); useDefaultsButton.setActionCommand("setToDefaults"); tabbedPanel.addPanel("Other Options", true); convertGapsBox = queryOptionsDialog.addCheckBox( "convert gaps to missing (to avoid gap=extra state)", convertGapsToMissing); queryOptionsDialog.addHorizontalLine(1); queryOptionsDialog.addLabel("Post-Search TNT Commands"); otherOptionsField = queryOptionsDialog.addTextAreaSmallFont(otherOptions, 7, 80); queryOptionsDialog.addHorizontalLine(1); queryOptionsDialog.addNewDialogPanel(); useDefaultsOtherOptionsButton = queryOptionsDialog.addAListenedButton("Set to Defaults", null, this); useDefaultsOtherOptionsButton.setActionCommand("setToDefaultsOtherOptions"); tabbedPanel.cleanup(); queryOptionsDialog.nullifyAddPanel(); queryOptionsDialog.completeAndShowDialog("Search", "Cancel", null, null); if (buttonPressed.getValue() == 0) { boolean infererOK = (treeInferer == null || treeInferer.optionsChosen()); if (externalProcRunner.optionsChosen() && infererOK) { if (bootstrapAllowed) { bootstrapreps = bootStrapRepsField.getValue(); bootstrapSearchArguments = bootstrapSearchField.getText(); bootSearchScriptPath = bootSearchScriptPathField.getText(); harvestOnlyStrictConsensus = harvestOnlyStrictConsensusBox.getState(); resamplingAllConsensusTrees = !resamplingAllConsensusTreesBox.getState(); searchStyle = searchStyleChoice.getSelectedIndex(); } numSlaves = slavesField.getValue(); otherOptions = otherOptionsField.getText(); convertGapsToMissing = convertGapsBox.getState(); parallel = parallelCheckBox.getState(); // doBootstrap = doBootstrapBox.getState(); searchArguments = searchField.getText(); searchScriptPath = searchScriptPathField.getText(); mxram = maxRamField.getValue(); storeRunnerPreferences(); } } queryOptionsDialog.dispose(); if (closeWizard) MesquiteDialog.closeWizard(); return (buttonPressed.getValue() == 0); }