private void buildExternalsPanel() { FormBuilder builder = FormBuilder.create().layout(new FormLayout("fill:pref:grow", "p")); int row = 1; for (ExternalFileEntry efe : externals) { builder.add(efe.getPanel()).xy(1, row); builder.appendRows("2dlu, p"); row += 2; } builder.add(Box.createVerticalGlue()).xy(1, row); builder.appendRows("2dlu, p, 2dlu, p"); builder.add(addExtPan).xy(1, row + 2); builder.add(Box.createVerticalGlue()).xy(1, row + 2); // builder.getPanel().setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.green)); // externalFilesPanel.setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.red)); JScrollPane pane = new JScrollPane(builder.getPanel()); pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); externalFilesPanel.setMinimumSize(new Dimension(400, 400)); externalFilesPanel.setPreferredSize(new Dimension(400, 400)); externalFilesPanel.removeAll(); externalFilesPanel.add(pane, BorderLayout.CENTER); externalFilesPanel.revalidate(); externalFilesPanel.repaint(); }
private void storeSettings() throws FileNotFoundException { File f = null; if (newFile.isSelected()) { if (!newNameTf.getText().isEmpty()) { f = new File(newNameTf.getText()); } // else { // return; // Nothing to do. // } } else { f = new File(personalFile.getText()); } if (f != null) { if (!f.exists()) { throw new FileNotFoundException(f.getAbsolutePath()); } try (FileWriter fw = new FileWriter(f, false)) { for (JournalEntry entry : tableModel.getJournals()) { fw.write(entry.name); fw.write(" = "); fw.write(entry.abbreviation); fw.write(Globals.NEWLINE); } } catch (IOException e) { LOGGER.warn("Problem writing abbreviation file", e); } String filename = f.getPath(); if ("".equals(filename)) { filename = null; } Globals.prefs.put(JabRefPreferences.PERSONAL_JOURNAL_LIST, filename); } // Store the list of external files set up: List<String> extFiles = new ArrayList<>(); for (ExternalFileEntry efe : externals) { if (!"".equals(efe.getValue())) { extFiles.add(efe.getValue()); } } Globals.prefs.putStringList(JabRefPreferences.EXTERNAL_JOURNAL_LISTS, extFiles); Abbreviations.initializeJournalNames(Globals.prefs); // Update the autocompleter for the "journal" field in all base panels, // so added journal names are available: for (int i = 0; i < frame.getBasePanelCount(); i++) { frame.getBasePanelAt(i).getAutoCompleters().addJournalListToAutoCompleter(); } }