public void actionPerformed(ActionEvent e) { JButton b = (JButton) e.getSource(); if (b == bu) { j14 = new JLabel("NEW IMAGE"); j14.setBounds(840, 200, 300, 300); q.add(j14); JFileChooser filechooser = new JFileChooser(); int result = filechooser.showOpenDialog(this); f = filechooser.getSelectedFile(); try { String dir1 = f.getAbsolutePath(); // setText(dir); str = dir1; // ResizeImage.resize(dir); f = new File(dir1); } catch (Exception e1) { } repaint(); // b=(JButton)e.getSource(); } if (b == ba) { try { read(); patient.add(tadd.getText(), tsym.getText(), f, str); JOptionPane.showMessageDialog(null, "Patient ID: " + patient.pid + " Record Added"); } catch (Exception e4) { System.out.println("" + e4); } } if (b == bm) { try { setVisible(false); } catch (Exception e4) { System.out.println("" + e4); } } }
String[] getContactList() { java.util.List cl = new java.util.LinkedList(); StringTokenizer st = new StringTokenizer(contactList.getText()); StringBuffer sb = new StringBuffer(); StringBuffer dbg = new StringBuffer("test applet contactlist: "); while (st.hasMoreTokens()) { String loginId = st.nextToken().trim(); if (loginId.length() == 0) continue; dbg.append("'" + loginId + "' "); cl.add(loginId); sb.append(loginId).append('\n'); } CAT.info(dbg.toString()); contactList.setText(sb.toString()); return (String[]) cl.toArray(new String[cl.size()]); }
public void save(File f) { Properties save = new Properties(); OutputStream output = null; try { save.setProperty("provider", selectProviderCb.getValue()); save.setProperty("grain", selectGrainCb.getValue()); save.setProperty("weight", weightTf.getText()); save.setProperty("info", infoTa.getText()); for (Entry<String, TextField> entry : propertiesTf.entrySet()) { TextField tf = entry.getValue(); String propertyName = entry.getKey(); save.setProperty(propertyName, tf.getText()); if (tf.isDisable()) { save.setProperty(propertyName + "_ENABLED", "OFF"); } else { save.setProperty(propertyName + "_ENABLED", "ON"); } } output = new FileOutputStream(f); save.store(output, null); mainStage.setTitle(f.getName()); } catch (Exception ex) { infoTa.setText("Не могу сохранить в файл"); } finally { if (output != null) { try { output.close(); } catch (IOException e) { e.printStackTrace(); } } } }
// -------------------------------------------------- public void send() { os.println(commandArea.getText()); }
public void read() { try { // patient.dt=""+tdt.getText(); patient.pid = Integer.parseInt(tpid.getText()); patient.pfnm = tpfnm.getText(); patient.pmnm = tpmnm.getText(); patient.plnm = tplnm.getText(); patient.gen = cbg.getSelectedCheckbox().getLabel(); try { patient.age = Integer.parseInt(tage.getText()); tage.setText("" + patient.age); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Invalid age inputed."); patient.age = Integer.parseInt(JOptionPane.showInputDialog("Please enter valid age:")); tage.setText("" + patient.age); } try { int wet = Integer.parseInt(twt.getText()); twt.setText("" + wet); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Invalid weight inputed."); int wet = Integer.parseInt(JOptionPane.showInputDialog("Please enter valid weight:")); twt.setText("" + wet); } patient.wt = twt.getText(); patient.addr = tadd.getText(); this.ad = tadd.getText(); System.out.println(tadd.getText()); while (true) { patient.cno = tcno.getText(); if (patient.cno.length() == 10) break; else { JOptionPane.showMessageDialog(null, "Invalid Phone No."); patient.cno = JOptionPane.showInputDialog("Please enter valid 10-digit Phone No.:"); tcno.setText(patient.cno); } } patient.dnm = tdnm.getText(); patient.sym = tsym.getText(); System.out.println(tsym.getText()); patient.dig = tdig.getText(); try { patient.fee = Integer.parseInt(tfee.getText()); tfee.setText("" + patient.fee); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Invalid Fee inputed."); patient.fee = Integer.parseInt(JOptionPane.showInputDialog("Please enter valid Fee:")); tfee.setText("" + patient.fee); } patient.bg = tbg.getText(); patient.path = str; } catch (Exception e) { } }
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); }