private void doPlus(Point p) { JRtaTextField datum = new JRtaTextField("DATUM", true); datum.setText(DatFunk.sHeute()); plusdatum pldat = new plusdatum(this); pldat.pack(); pldat.setLocation(p.x, p.y + 20); pldat.setModal(true); pldat.setVisible(true); // System.out.println(abbruch); if (!abbruch && (returnString != null)) { String retDatum = returnString; // System.out.println("In Elternklasse "+retDatum); Vector vec = combobox1.getDataVector(); vec.add(returnString); Comparator<String> comparator = new Comparator<String>() { @Override public int compare(String o1, String o2) { // TODO Auto-generated method stub String s1 = DatFunk.sDatInSQL((String) o1); String s2 = DatFunk.sDatInSQL((String) o2); return s1.compareTo(s2); } }; Collections.sort(vec, comparator); combobox1.setDataVector((Vector) vec.clone()); combobox1.setSelectedItem(returnString); } }
@Override public void actionPerformed(ActionEvent arg0) { String cmd = arg0.getActionCommand(); if (cmd.equals("connect")) { doHoleTermine(); // doDBFEinlesen(); return; } if (cmd.equals("plus")) { doPlus(((JButton) arg0.getSource()).getLocationOnScreen()); tagelab.setText(Integer.toString(combobox1.getItemCount())); return; } if (cmd.equals("minus")) { doMinus(); tagelab.setText(Integer.toString(combobox1.getItemCount())); return; } if (cmd.equals("sortieren")) { doSortieren(); return; } if (cmd.equals("zeilig")) { doZeilig(combobox2.getSelectedIndex()); return; } if (cmd.equals("drucken")) { doPDFStarten(); return; } if (cmd.equals("schliessen")) { System.exit(0); return; } }
private void doMinus() { if (combobox1.getItemCount() > 0) { int position = combobox1.getSelectedIndex(); Vector vec = combobox1.getDataVector(); vec.remove(position); combobox1.setDataVector(vec); } }
private void doDBFEinlesen() { String datei; String nummer = tf1[0].getText().trim(); if (nummer.equals("")) { JOptionPane.showMessageDialog(null, "Bitte Reha-Nummer eingeben"); return; } datei = ("L:/projekte/rta/dbf/eterm/" + "RH" + nummer + ".dbf").toLowerCase(); File f = new File(datei); if (!f.exists()) { JOptionPane.showMessageDialog(null, "Rehanummer --> RH" + nummer + " <-- existiert nicht"); return; } DBFReader dbfreader; try { dbfreader = new DBFReader(datei); //// System.out.println("Öffne Datei "+datei); String ganzerString = ""; String datum; DateFormat df = DateFormat.getDateInstance(); vec.clear(); combobox1.setDataVector((Vector) vec.clone()); for (int i = 0; dbfreader.hasNextRecord(); i++) { dummyvec.clear(); Object aobj[] = dbfreader.nextRecord(); for (int j = 0; j < aobj.length; j++) { if (j == 0) { try { datum = df.format(aobj[j]); } catch (Exception ex) { datum = DatFunk.sHeute(); } // dummyvec.add(datum); // dummyvec.add(DatFunk.sDatInSQL(datum)); vec.add((String) datum); //// System.out.println("Feld "+j+" "+(aobj[j])); } } //// System.out.print("\n"); } dbfreader.close(); combobox1.setDataVector((Vector<String>) vec.clone()); combobox1.setMaximumRowCount(25); combobox1.validate(); // System.out.println("Vectorlänge = "+vec.size()); } catch (JDBFException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
private void doHoleTermine() { String termine = holeRezFeld("termine", "rez_nr='" + "RH" + tf1[0].getText().trim() + "'"); Vector<String> vec = new Vector<String>(); if (termine.length() > 0) { String[] terms = termine.split("\n"); for (int i = 0; i < terms.length; i++) { String[] tag = terms[i].split("@"); vec.add(tag[0].toString()); } combobox1.setDataVector((Vector<String>) vec.clone()); combobox1.setMaximumRowCount(25); tagelab.setText(Integer.toString(combobox1.getItemCount())); combobox1.validate(); } }
private void doPDFStarten() { String[] werte = { tf1[1].getText().trim().replace(",", "."), tf1[2].getText().trim().replace(",", "."), tf1[3].getText().trim().replace(",", "."), tf1[4].getText().trim().replace(",", "."), tf1[5].getText().trim().replace(",", ".") }; new PDFDummy(combobox1.getDataVector(), werte); }