public void generateThisWeek(int monDate, int month, int year) throws SQLException { cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month - 1); cal.set(Calendar.DAY_OF_MONTH, monDate); cal.getTime(); cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek()); cal.getTime(); Eier = frame.getKalenderEier(); String tider = ""; if (Eier != null) { Listavtaler = db.avtalerPersonErMed2(Eier); String[] delt = Listavtaler.split("-"); for (String verdi : delt) { if (verdi != "") { int avID = Integer.parseInt(verdi); Avtale avtalen = db.getBestemtAvtale(avID); tider += avtalen.getStartTid() + "-" + avID + "#"; } } } wkdPanel.setDate(getDate(cal)); cal.add(Calendar.DATE, 1); wkdPanel.leggeTilAvtale(Eier, tider); wkdPanel2.setDate(getDate(cal)); cal.add(Calendar.DATE, 1); wkdPanel2.leggeTilAvtale(Eier, tider); wkdPanel3.setDate(getDate(cal)); cal.add(Calendar.DATE, 1); wkdPanel3.leggeTilAvtale(Eier, tider); wkdPanel4.setDate(getDate(cal)); cal.add(Calendar.DATE, 1); wkdPanel4.leggeTilAvtale(Eier, tider); wkdPanel5.setDate(getDate(cal)); cal.add(Calendar.DATE, 1); wkdPanel5.leggeTilAvtale(Eier, tider); wkdPanel6.setDate(getDate(cal)); cal.add(Calendar.DATE, 1); wkdPanel6.leggeTilAvtale(Eier, tider); wkdPanel7.setDate(getDate(cal)); wkdPanel7.leggeTilAvtale(Eier, tider); }
public void setKalender() { if (kalendere.getSelectedItem() != frame.getKalenderEier()) { kalendere.setSelectedItem(frame.getKalenderEier()); } kalendere.updateUI(); }