private void initFrame() { this.setLocationRelativeTo(null); try { if (!Files.exists(saveName)) Files.createFile(saveName); laden(saveName); } catch (IOException e) { e.printStackTrace(); } nUebSchr.setSelected(true); if (!quellListModel.isEmpty()) quellJList.setSelectedIndex(0); if (!zielListModel.isEmpty()) zielJList.setSelectedIndex(0); starteLaufwerkspruefung(); }
private void speichern(Path saveName) { Properties prop = new Properties(); if (!quellListModel.isEmpty()) for (int i = 0; i < quellListModel.getSize(); i++) prop.setProperty( String.format("quellMenu%d", i), quellListModel.getElementAt(i).getValueMember().toString()); if (!zielListModel.isEmpty()) for (int i = 0; i < zielListModel.getSize(); i++) prop.setProperty( String.format("zielMenu%d", i), zielListModel.getElementAt(i).getValueMember().toString()); try { FileOutputStream out = new FileOutputStream(saveName.toString()); prop.store(out, null); out.close(); } catch (Exception e) { e.printStackTrace(); } }