List of usage examples for javax.swing JFileChooser setDialogTitle
@BeanProperty(preferred = true, description = "The title of the JFileChooser dialog window.") public void setDialogTitle(String dialogTitle)
JFileChooser
window's title bar. From source file:bio.gcat.gui.BDATool.java
public boolean saveFileAs() { JFileChooser chooser = new FileNameExtensionFileChooser(false, BDA_EXTENSION_FILTER); chooser.setDialogTitle("Save As"); if (chooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) return saveFile(chooser.getSelectedFile()); else//w w w .ja v a 2 s. c o m return false; }
From source file:com.jvms.i18neditor.editor.Editor.java
public void showCreateProjectDialog(ResourceType type) { JFileChooser fc = new JFileChooser(); fc.setDialogTitle(MessageBundle.get("dialogs.project.new.title")); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int result = fc.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { createProject(Paths.get(fc.getSelectedFile().getPath()), type); } else {/*from ww w . ja v a2s . co m*/ updateHistory(); updateUI(); } }
From source file:com.jvms.i18neditor.editor.Editor.java
public void showImportProjectDialog() { String path = null;//from w ww . j a va 2s . c om if (project != null) { path = project.getPath().toString(); } JFileChooser fc = new JFileChooser(path); fc.setDialogTitle(MessageBundle.get("dialogs.project.import.title")); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int result = fc.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { importProject(Paths.get(fc.getSelectedFile().getPath()), true); } }
From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java
/** * Das exportverzeichis auswhlen Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui * /*w w w .j ava 2 s . c o m*/ * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 28.08.2012 */ private void chooseExportDir() { JFileChooser fileChooser; int retVal; // // Einen Dateiauswahldialog Creieren // fileChooser = new JFileChooser(); fileChooser.setLocale(Locale.getDefault()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setDialogTitle(fileChooserExportDirTitle); fileChooser.setDialogType(JFileChooser.CUSTOM_DIALOG); fileChooser.setApproveButtonToolTipText(approveDirButtonTooltip); // das existierende Verzeichnis voreinstellen fileChooser.setSelectedFile(SpxPcloggerProgramConfig.exportDir); retVal = fileChooser.showDialog(this, approveDirButtonText); // Mal sehen, was der User gewollt hat if (retVal == JFileChooser.APPROVE_OPTION) { // Ja, ich wollte das so exportDirTextField.setText(fileChooser.getSelectedFile().getAbsolutePath()); wasChangedParameter = true; } }
From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java
/** * Verzeichnis fr die Daten auswhlen Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui * /* www . j a v a 2 s . c om*/ * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 03.08.2012 */ private void chooseDataDir() { JFileChooser fileChooser; int retVal; // // Einen Dateiauswahldialog Creieren // fileChooser = new JFileChooser(); fileChooser.setLocale(Locale.getDefault()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setDialogTitle(fileChooserDirTitle); fileChooser.setDialogType(JFileChooser.CUSTOM_DIALOG); fileChooser.setApproveButtonToolTipText(approveDirButtonTooltip); // das existierende Logfile voreinstellen fileChooser.setSelectedFile(SpxPcloggerProgramConfig.databaseDir); retVal = fileChooser.showDialog(this, approveDirButtonText); // Mal sehen, was der User gewollt hat if (retVal == JFileChooser.APPROVE_OPTION) { // Ja, ich wollte das so databaseDirTextField.setText(fileChooser.getSelectedFile().getAbsolutePath()); wasChangedParameter = true; } }
From source file:org.owasp.webscarab.plugin.sessionid.swing.SessionIDPanel.java
private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed if (_key == null) { JOptionPane.showMessageDialog(null, "Please select the Session ID to export, using the drop down list", "Error", JOptionPane.ERROR_MESSAGE); return;// w w w. j a v a 2 s . co m } JFileChooser jfc = new JFileChooser(Preferences.getPreference("WebScarab.DefaultDirectory")); jfc.setDialogTitle("Select a directory to write the sessionids into"); int returnVal = jfc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { final File file = jfc.getSelectedFile(); try { _sa.exportIDSToCSV(_key, file); } catch (IOException ioe) { JOptionPane.showMessageDialog(null, new String[] { "Error exporting session identifiers", ioe.getMessage() }, "Error", JOptionPane.ERROR_MESSAGE); } } File dir = jfc.getCurrentDirectory(); if (dir != null) Preferences.setPreference("WebScarab.DefaultDirectory", dir.getAbsolutePath()); }
From source file:com.igormaznitsa.sciareto.ui.MainFrame.java
@Nullable @Override/* ww w .j a v a 2s.com*/ public File createMindMapFile(@Nullable final File folder) { final JFileChooser chooser = new JFileChooser(folder); chooser.setDialogTitle("Create new Mind Map"); chooser.setFileFilter(MMDEditor.MMD_FILE_FILTER); chooser.setMultiSelectionEnabled(false); chooser.setApproveButtonText("Create"); File result = null; if (chooser.showSaveDialog(Main.getApplicationFrame()) == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (!file.getName().endsWith(".mmd")) { file = new File(file.getAbsolutePath() + ".mmd"); } if (file.exists()) { DialogProviderManager.getInstance().getDialogProvider() .msgError("File '" + file + "' already exists!"); } else { try { final MindMap mindMap = new MindMap(null, true); final String text = mindMap.write(new StringWriter()).toString(); SystemUtils.saveUTFText(file, text); result = file; } catch (IOException ex) { DialogProviderManager.getInstance().getDialogProvider() .msgError("Can't save mind map into file '" + file.getName() + "'"); } } } return result; }
From source file:com.gnadenheimer.mg.frames.admin.FrameConfigAdmin.java
private void cmdDatadirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdDatadirActionPerformed try {/*from www . j av a2 s .c o m*/ JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle("Eligir ubicacin de la base de datos."); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { txtDatadir.setText(chooser.getSelectedFile().getPath()); } } catch (Exception ex) { JOptionPane.showMessageDialog(null, Thread.currentThread().getStackTrace()[1].getMethodName() + " - " + ex.getMessage()); LOGGER.error(Thread.currentThread().getStackTrace()[1].getMethodName(), ex); } }
From source file:Display.java
@SuppressWarnings("unchecked") Display() {//w ww . j a v a2 s . c om super(Reference.NAME); cardLayout = new CardLayout(); panel.setLayout(cardLayout); final int java7Update = Utils.Validators.java7Update.check(); final int java8Update = Utils.Validators.java8Update.check(); try { URL host = new URL(Reference.PROTOCOL, Reference.SOURCE_HOST, Reference.PORT, Reference.JSON_ARRAY); JSONParser parser = new JSONParser(); Object json = parser.parse(new URLReader(host)); final JSONArray array = (JSONArray) json; JSONObject nameObject1 = (JSONObject) array.get(0); XPackInstaller.selected_url = nameObject1.get("url").toString(); XPackInstaller.javaVersion = Integer.parseInt(nameObject1.get("version").toString()); XPackInstaller.profile = nameObject1.get("profile").toString(); XPackInstaller.canAcceptOptional = Boolean .parseBoolean(nameObject1.get("canAcceptOptional").toString()); if (!XPackInstaller.canAcceptOptional) { checkOptifine.setEnabled(false); checkOptifine.setSelected(false); zainstalujMoCreaturesCheckBox.setEnabled(false); zainstalujMoCreaturesCheckBox.setSelected(false); optionalText.setEnabled(false); } else { checkOptifine.setEnabled(true); zainstalujMoCreaturesCheckBox.setEnabled(true); optionalText.setEnabled(true); } for (Object anArray : array) { comboBox1.addItem(new JSONObject((JSONObject) anArray).get("name")); } comboBox1.addActionListener(e -> { int i = 0; while (true) { JSONObject nameObject = (JSONObject) array.get(i); String name1 = nameObject.get("name").toString(); if (name1 == comboBox1.getSelectedItem()) { XPackInstaller.canAcceptOptional = Boolean .parseBoolean(nameObject.get("canAcceptOptional").toString()); XPackInstaller.selected_url = nameObject.get("url").toString(); XPackInstaller.javaVersion = Integer.parseInt(nameObject.get("version").toString()); XPackInstaller.profile = nameObject.get("profile").toString(); if (!XPackInstaller.canAcceptOptional) { checkOptifine.setEnabled(false); checkOptifine.setSelected(false); zainstalujMoCreaturesCheckBox.setEnabled(false); zainstalujMoCreaturesCheckBox.setSelected(false); optionalText.setEnabled(false); } else { checkOptifine.setEnabled(true); zainstalujMoCreaturesCheckBox.setEnabled(true); optionalText.setEnabled(true); } break; } i++; } int javaStatus; if (XPackInstaller.javaVersion == 8) { javaStatus = java8Update; } else { javaStatus = java7Update; } if (javaStatus == 0) { javaversion.setText("TAK"); javaversion.setForeground(Reference.COLOR_DARK_GREEN); } else if (javaStatus == 1) { javaversion.setText("NIE"); javaversion.setForeground(Reference.COLOR_DARK_ORANGE); } else if (javaStatus == 2) { if (XPackInstaller.javaVersion == 8) { javaversion.setText("Nie posiadasz JRE8 w wersji 25 lub nowszej!"); } else { javaversion.setText("Nie posiadasz najnowszej wersji JRE7!"); } javaversion.setForeground(Color.RED); } if (osarch.getText().equals("TAK") && Ram.getText().equals("TAK") && javaarch.getText().equals("TAK") && (javaversion.getText().equals("TAK") || javaversion.getText().equals("NIE"))) { XPackInstaller.canGoForward = true; button2.setText("Dalej"); } else { XPackInstaller.canGoForward = false; button2.setText("Anuluj"); } }); } catch (FileNotFoundException | ParseException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); JOptionPane.showMessageDialog(panel, "Brak poczenia z Internetem!", "Bd", JOptionPane.ERROR_MESSAGE); System.exit(0); } pobierzOryginalnyLauncherMCCheckBox.addActionListener(e -> { if (pobierzOryginalnyLauncherMCCheckBox.isSelected()) { PathLauncherLabel.setEnabled(true); textField1.setEnabled(true); button3.setEnabled(true); XPackInstaller.installLauncher = true; labelLauncher.setEnabled(true); progressBar3.setEnabled(true); } else { PathLauncherLabel.setEnabled(false); textField1.setEnabled(false); button3.setEnabled(false); XPackInstaller.installLauncher = false; labelLauncher.setEnabled(false); progressBar3.setEnabled(false); } }); button3.addActionListener(e -> { JFileChooser chooser = new JFileChooser(System.getProperty("user.home")); chooser.setApproveButtonText("Wybierz"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setMultiSelectionEnabled(false); chooser.setDialogTitle("Wybierz ciek"); int returnValue = chooser.showOpenDialog(getContentPane()); if (returnValue == JFileChooser.APPROVE_OPTION) { try { XPackInstaller.launcher_path = chooser.getSelectedFile().getCanonicalPath(); } catch (IOException x) { x.printStackTrace(); } textField1.setText(XPackInstaller.launcher_path); } }); slider1.setMaximum(Utils.Utils.humanReadableRAM() - 2); slider1.addChangeListener(e -> XPackInstaller.allocatedRAM = slider1.getValue()); button1.addActionListener(e -> { if (pobierzOryginalnyLauncherMCCheckBox.isSelected()) { File launcher = new File(XPackInstaller.launcher_path + File.separator + "Minecraft.exe"); if (textField1.getText().equals("")) { JOptionPane.showMessageDialog(panel, "Nie wybrae cieki instalacji Launcher'a!", "Bd", JOptionPane.ERROR_MESSAGE); } else if (launcher.exists()) { JOptionPane.showMessageDialog(panel, "W podanym katalogu istanieje ju plik o nazwie 'Minecraft.exe'!", "Bad", JOptionPane.ERROR_MESSAGE); } else { cardLayout.next(panel); } } else { cardLayout.next(panel); if (osarch.getText().equals("NIE") && Ram.getText().equals("TAK") && javaarch.getText().equals("NIE") && (javaversion.getText().equals("TAK") || javaversion.getText().equals("NIE"))) { XPackInstaller.canGoForward = false; button2.setText("Anuluj"); JOptionPane.showMessageDialog(gui, "Prosimy sprawdzi\u0107 czy na komputerze nie ma zainstalowanych dw\u00f3ch \u015brodowisk Java: w wersji 32-bitowej i 64-bitowej.\nJe\u015bli zainstalowane s\u0105 obie wersje prosimy o odinstalowanie wersji 32-bitowej. To rozwi\u0105\u017ce problem.", "B\u0142\u0105d konfiguracji Javy", JOptionPane.ERROR_MESSAGE); } } }); if (Utils.Validators.systemArchitecture.check()) { osarch.setText("TAK"); osarch.setForeground(Reference.COLOR_DARK_GREEN); } else { osarch.setText("NIE"); osarch.setForeground(Color.RED); } if (Utils.Validators.ramAmount.check()) { Ram.setText("TAK"); Ram.setForeground(Reference.COLOR_DARK_GREEN); } else { Ram.setText("NIE"); Ram.setForeground(Color.RED); } if (Utils.Validators.javaArchitecture.check()) { javaarch.setText("TAK"); javaarch.setForeground(Reference.COLOR_DARK_GREEN); } else { javaarch.setText("NIE"); javaarch.setForeground(Color.RED); } int javaStatus; if (XPackInstaller.javaVersion == 8) { javaStatus = java8Update; } else { javaStatus = java7Update; } if (javaStatus == 0) { javaversion.setText("TAK"); javaversion.setForeground(Reference.COLOR_DARK_GREEN); } else if (javaStatus == 1) { javaversion.setText("NIE"); javaversion.setForeground(Reference.COLOR_DARK_ORANGE); } else if (javaStatus == 2) { javaversion.setText("Nie posiadasz najnowszej wersji JRE!"); javaversion.setForeground(Color.RED); } if (osarch.getText().equals("TAK") && Ram.getText().equals("TAK") && javaarch.getText().equals("TAK") && (javaversion.getText().equals("TAK") || javaversion.getText().equals("NIE"))) { XPackInstaller.canGoForward = true; button2.setText("Dalej"); } else { XPackInstaller.canGoForward = false; button2.setText("Anuluj"); } button2.addActionListener(e -> { if (XPackInstaller.canGoForward) { cardLayout.next(panel); } else { System.exit(1); } }); wsteczButton.addActionListener(e -> cardLayout.previous(panel)); try { editorPane1.setPage("http://xpack.pl/licencja.html"); } catch (IOException e) { e.printStackTrace(); JOptionPane.showMessageDialog(panel, "Brak poczenia z Internetem!", "Bd", JOptionPane.ERROR_MESSAGE); System.exit(0); } licenseC.addActionListener(e -> { if (licenseC.isSelected()) { dalejButton.setEnabled(true); } else { dalejButton.setEnabled(false); } }); try { File mainDir = new File(System.getenv("appdata") + File.separator + "XPackInstaller"); if (mainDir.exists()) { FileUtils.deleteDirectory(mainDir); if (!mainDir.mkdir()) { JOptionPane.showMessageDialog(gui, "Nie udao si utworzy katalogu, prosimy sprbowa ponownie!", "Bd", JOptionPane.ERROR_MESSAGE); System.out.println("Nie udao si utworzy katalogu!"); System.exit(1); } } else { if (!mainDir.mkdir()) { JOptionPane.showMessageDialog(gui, "Nie udao si utworzy katalogu, prosimy sprbowa ponownie!", "Bd", JOptionPane.ERROR_MESSAGE); System.out.println("Nie udao si utworzy katalogu!"); System.exit(1); } } File optionalDir = new File(mainDir.getAbsolutePath() + File.separator + "OptionalMods"); if (!optionalDir.mkdir()) { JOptionPane.showMessageDialog(gui, "Nie udao si utworzy katalogu, prosimy sprbowa ponownie!", "Bd", JOptionPane.ERROR_MESSAGE); System.out.println("Nie udao si utworzy katalogu!"); System.exit(1); } dalejButton.addActionListener(e -> { cardLayout.next(panel); try { progressBar1.setValue(0); if (checkOptifine.isSelected() && zainstalujMoCreaturesCheckBox.isSelected()) { DownloadTask task2 = new DownloadTask(gui, "mod", Reference.downloadOptifine, optionalDir.getAbsolutePath()); task2.addPropertyChangeListener(evt -> { if (evt.getPropertyName().equals("progress")) { labelmodpack.setText("Pobieranie Optifine HD w toku..."); if (task2.isDone()) { task3(); } optifineProgress = (Integer) evt.getNewValue(); progressBar1.setValue(optifineProgress); } }); task2.execute(); } else if (checkOptifine.isSelected()) { DownloadTask task2 = new DownloadTask(gui, "mod", Reference.downloadOptifine, optionalDir.getAbsolutePath()); task2.addPropertyChangeListener(evt -> { if (evt.getPropertyName().equals("progress")) { labelmodpack.setText("Pobieranie Optifine HD w toku..."); if (task2.isDone()) { task(); } optifineProgress = (Integer) evt.getNewValue(); progressBar1.setValue(optifineProgress); } }); task2.execute(); } else if (zainstalujMoCreaturesCheckBox.isSelected()) { task3(); } else { task(); } } catch (Exception exx) { exx.printStackTrace(); } }); } catch (IOException e) { e.printStackTrace(); } final JScrollBar bar = scrollPane1.getVerticalScrollBar(); bar.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { int extent = bar.getModel().getExtent(); int total = extent + bar.getValue(); int max = bar.getMaximum(); if (total == max) { licenseC.setEnabled(true); } } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { int extent = bar.getModel().getExtent(); int total = extent + bar.getValue(); int max = bar.getMaximum(); if (total == max) { licenseC.setEnabled(true); } } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } }); bar.addMouseWheelListener(e -> { int extent = bar.getModel().getExtent(); int total = extent + bar.getValue(); int max = bar.getMaximum(); if (total == max) { licenseC.setEnabled(true); } }); scrollPane1.setWheelScrollingEnabled(true); scrollPane1.addMouseWheelListener(e -> { int extent = bar.getModel().getExtent(); int total = extent + bar.getValue(); int max = bar.getMaximum(); if (total == max) { licenseC.setEnabled(true); } }); panel.add(panel3); panel.add(panel1); panel.add(panel2); panel.add(panel4); add(panel); }
From source file:cl.uai.webcursos.emarking.desktop.OptionsDialog.java
/** * Create the dialog.//from www .j a v a 2 s . co m */ public OptionsDialog(Moodle _moodle) { addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { cancelled = true; } }); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setIconImage(Toolkit.getDefaultToolkit().getImage(OptionsDialog.class .getResource("/cl/uai/webcursos/emarking/desktop/resources/glyphicons_439_wrench.png"))); setTitle(EmarkingDesktop.lang.getString("emarkingoptions")); setModal(true); setBounds(100, 100, 707, 444); this.moodle = _moodle; this.moodle.loadProperties(); getContentPane().setLayout(new BorderLayout()); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { okButton = new JButton(EmarkingDesktop.lang.getString("ok")); okButton.setEnabled(false); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS); if (!validator.isValid(moodleurl.getText())) { throw new Exception(EmarkingDesktop.lang.getString("invalidmoodleurl") + " " + moodleurl.getText()); } File f = new File(filename.getText()); if (!f.exists() || f.isDirectory() || (!f.getPath().endsWith(".pdf") && !f.getPath().endsWith(".zip"))) { throw new Exception(EmarkingDesktop.lang.getString("invalidpdffile") + " " + filename.getText()); } if (omrtemplate.getText().trim().length() > 0) { File omrf = new File(omrtemplate.getText()); if (!omrf.exists() || omrf.isDirectory() || (!omrf.getPath().endsWith(".xtmpl"))) { throw new Exception(EmarkingDesktop.lang.getString("invalidomrfile") + " " + omrtemplate.getText()); } } moodle.setLastfile(filename.getText()); moodle.getQrExtractor().setDoubleside(chckbxDoubleSide.isSelected()); moodle.setMaxthreads(Integer.parseInt(getMaxThreads().getSelectedItem().toString())); moodle.setResolution(Integer.parseInt(getResolution().getSelectedItem().toString())); moodle.setMaxzipsize(getMaxZipSize().getSelectedItem().toString()); moodle.setOMRTemplate(omrtemplate.getText()); moodle.setThreshold(Integer.parseInt(spinnerOMRthreshold.getValue().toString())); moodle.setDensity(Integer.parseInt(spinnerOMRdensity.getValue().toString())); moodle.setShapeSize(Integer.parseInt(spinnerOMRshapeSize.getValue().toString())); moodle.setAnonymousPercentage( Integer.parseInt(spinnerAnonymousPercentage.getValue().toString())); moodle.setAnonymousPercentageCustomPage( Integer.parseInt(spinnerAnonymousPercentageCustomPage.getValue().toString())); moodle.setFakeStudents(chckbxMarkersTraining.isSelected()); moodle.saveProperties(); cancelled = false; setVisible(false); } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(panel, EmarkingDesktop.lang.getString("invaliddatainform")); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton(EmarkingDesktop.lang.getString("cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelled = true; setVisible(false); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); getContentPane().add(tabbedPane, BorderLayout.CENTER); panel = new JPanel(); tabbedPane.addTab(EmarkingDesktop.lang.getString("general"), null, panel, null); panel.setLayout(null); JPanel panel_2 = new JPanel(); panel_2.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_2.setBounds(10, 11, 665, 131); panel.add(panel_2); panel_2.setLayout(null); JLabel lblPassword = new JLabel(EmarkingDesktop.lang.getString("password")); lblPassword.setBounds(10, 99, 109, 14); panel_2.add(lblPassword); lblPassword.setHorizontalAlignment(SwingConstants.RIGHT); password = new JPasswordField(); password.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { testConnection(); } }); password.setBounds(129, 96, 329, 20); panel_2.add(password); this.password.setText(this.moodle.getPassword()); btnTestConnection = new JButton(EmarkingDesktop.lang.getString("connect")); btnTestConnection.setEnabled(false); btnTestConnection.setBounds(468, 93, 172, 27); panel_2.add(btnTestConnection); username = new JTextField(); username.setBounds(129, 65, 329, 20); panel_2.add(username); username.setColumns(10); this.username.setText(this.moodle.getUsername()); moodleurl = new JTextField(); moodleurl.setBounds(129, 34, 329, 20); panel_2.add(moodleurl); moodleurl.setColumns(10); moodleurl.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { warn(); } @Override public void insertUpdate(DocumentEvent e) { warn(); } @Override public void changedUpdate(DocumentEvent e) { warn(); } private void warn() { UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS); if (!validator.isValid(moodleurl.getText()) || !moodleurl.getText().endsWith("/")) { moodleurl.setForeground(Color.RED); btnTestConnection.setEnabled(false); } else { moodleurl.setForeground(Color.BLACK); btnTestConnection.setEnabled(true); } } }); // Initializing values from moodle configuration this.moodleurl.setText(this.moodle.getUrl()); JLabel lblMoodleUrl = new JLabel(EmarkingDesktop.lang.getString("moodleurl")); lblMoodleUrl.setBounds(10, 37, 109, 14); panel_2.add(lblMoodleUrl); lblMoodleUrl.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblUsername = new JLabel(EmarkingDesktop.lang.getString("username")); lblUsername.setBounds(10, 68, 109, 14); panel_2.add(lblUsername); lblUsername.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblMoodleSettings = new JLabel(EmarkingDesktop.lang.getString("moodlesettings")); lblMoodleSettings.setBounds(10, 11, 230, 14); panel_2.add(lblMoodleSettings); btnTestConnection.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { testConnection(); } }); JPanel panel_3 = new JPanel(); panel_3.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_3.setBounds(10, 159, 666, 174); panel.add(panel_3); panel_3.setLayout(null); JLabel lblPdfFile = new JLabel(EmarkingDesktop.lang.getString("pdffile")); lblPdfFile.setBounds(0, 39, 119, 14); panel_3.add(lblPdfFile); lblPdfFile.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblScanned = new JLabel(EmarkingDesktop.lang.getString("scanned")); lblScanned.setBounds(0, 64, 119, 14); panel_3.add(lblScanned); lblScanned.setHorizontalAlignment(SwingConstants.RIGHT); chckbxDoubleSide = new JCheckBox(EmarkingDesktop.lang.getString("doubleside")); chckbxDoubleSide.setEnabled(false); chckbxDoubleSide.setBounds(125, 60, 333, 23); panel_3.add(chckbxDoubleSide); chckbxDoubleSide.setToolTipText(EmarkingDesktop.lang.getString("doublesidetooltip")); this.chckbxDoubleSide.setSelected(this.moodle.getQrExtractor().isDoubleside()); filename = new JTextField(); filename.setEnabled(false); filename.setBounds(129, 36, 329, 20); panel_3.add(filename); filename.setColumns(10); filename.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { warn(); } @Override public void insertUpdate(DocumentEvent e) { warn(); } @Override public void changedUpdate(DocumentEvent e) { warn(); } private void warn() { validateFileForProcessing(!btnTestConnection.isEnabled()); } }); this.filename.setText(this.moodle.getLastfile()); btnOpenPdfFile = new JButton(EmarkingDesktop.lang.getString("openfile")); btnOpenPdfFile.setEnabled(false); btnOpenPdfFile.setBounds(468, 33, 172, 27); panel_3.add(btnOpenPdfFile); JLabel lblPdfFileSettings = new JLabel(EmarkingDesktop.lang.getString("filesettings")); lblPdfFileSettings.setBounds(10, 11, 230, 14); panel_3.add(lblPdfFileSettings); JLabel lblOMRtemplate = new JLabel(EmarkingDesktop.lang.getString("omrfile")); lblOMRtemplate.setHorizontalAlignment(SwingConstants.RIGHT); lblOMRtemplate.setBounds(0, 142, 119, 14); panel_3.add(lblOMRtemplate); omrtemplate = new JTextField(); omrtemplate.setEnabled(false); omrtemplate.setText((String) null); omrtemplate.setColumns(10); omrtemplate.setBounds(129, 139, 329, 20); panel_3.add(omrtemplate); omrtemplate.setText(this.moodle.getOMRTemplate()); btnOpenOMRTemplate = new JButton(EmarkingDesktop.lang.getString("openomrfile")); btnOpenOMRTemplate.setEnabled(false); btnOpenOMRTemplate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle(EmarkingDesktop.lang.getString("openfiletitle")); chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "*.xtmpl"; } @Override public boolean accept(File arg0) { if (arg0.getName().endsWith(".xtmpl") || arg0.isDirectory()) return true; return false; } }); int retval = chooser.showOpenDialog(panel); if (retval == JFileChooser.APPROVE_OPTION) { omrtemplate.setText(chooser.getSelectedFile().getAbsolutePath()); } else { return; } } }); btnOpenOMRTemplate.setBounds(468, 136, 172, 27); panel_3.add(btnOpenOMRTemplate); lblMarkersTraining = new JLabel((String) EmarkingDesktop.lang.getString("markerstraining")); lblMarkersTraining.setHorizontalAlignment(SwingConstants.RIGHT); lblMarkersTraining.setBounds(0, 89, 119, 14); panel_3.add(lblMarkersTraining); chckbxMarkersTraining = new JCheckBox(EmarkingDesktop.lang.getString("markerstrainingfakestudents")); chckbxMarkersTraining.setBounds(125, 87, 333, 23); panel_3.add(chckbxMarkersTraining); btnOpenPdfFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okButton.setEnabled(false); JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle(EmarkingDesktop.lang.getString("openfiletitle")); chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "*.pdf, *.zip"; } @Override public boolean accept(File arg0) { if (arg0.getName().endsWith(".zip") || arg0.getName().endsWith(".pdf") || arg0.isDirectory()) return true; return false; } }); int retval = chooser.showOpenDialog(panel); if (retval == JFileChooser.APPROVE_OPTION) { filename.setText(chooser.getSelectedFile().getAbsolutePath()); okButton.setEnabled(true); } else { return; } } }); JPanel panel_1 = new JPanel(); tabbedPane.addTab(EmarkingDesktop.lang.getString("advanced"), null, panel_1, null); panel_1.setLayout(null); JPanel panel_4 = new JPanel(); panel_4.setLayout(null); panel_4.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_4.setBounds(10, 11, 665, 131); panel_1.add(panel_4); JLabel lblAdvancedOptions = new JLabel(EmarkingDesktop.lang.getString("advancedoptions")); lblAdvancedOptions.setBounds(10, 11, 233, 14); panel_4.add(lblAdvancedOptions); JLabel lblThreads = new JLabel(EmarkingDesktop.lang.getString("maxthreads")); lblThreads.setBounds(10, 38, 130, 14); panel_4.add(lblThreads); lblThreads.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblSomething = new JLabel(EmarkingDesktop.lang.getString("separatezipfiles")); lblSomething.setBounds(10, 73, 130, 14); panel_4.add(lblSomething); lblSomething.setHorizontalAlignment(SwingConstants.RIGHT); JLabel label = new JLabel(EmarkingDesktop.lang.getString("resolution")); label.setBounds(10, 105, 130, 14); panel_4.add(label); label.setHorizontalAlignment(SwingConstants.RIGHT); resolution = new JComboBox<Integer>(); resolution.setBounds(150, 99, 169, 27); panel_4.add(resolution); resolution.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 75, 100, 150, 300, 400, 500, 600 })); resolution.setSelectedIndex(2); this.resolution.setSelectedItem(this.moodle.getQrExtractor().getResolution()); maxZipSize = new JComboBox<String>(); maxZipSize.setBounds(150, 67, 169, 27); panel_4.add(maxZipSize); maxZipSize.setModel(new DefaultComboBoxModel<String>(new String[] { "<dynamic>", "2Mb", "4Mb", "8Mb", "16Mb", "32Mb", "64Mb", "128Mb", "256Mb", "512Mb", "1024Mb" })); maxZipSize.setSelectedIndex(6); this.maxZipSize.setSelectedItem(this.moodle.getMaxZipSizeString()); maxThreads = new JComboBox<Integer>(); maxThreads.setBounds(150, 32, 169, 27); panel_4.add(maxThreads); maxThreads.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 2, 4, 8, 16 })); maxThreads.setSelectedIndex(1); this.maxThreads.setSelectedItem(this.moodle.getQrExtractor().getMaxThreads()); JPanel panel_5 = new JPanel(); panel_5.setLayout(null); panel_5.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_5.setBounds(10, 153, 665, 131); panel_1.add(panel_5); JLabel lblOMRoptions = new JLabel(EmarkingDesktop.lang.getString("omroptions")); lblOMRoptions.setBounds(10, 11, 233, 14); panel_5.add(lblOMRoptions); JLabel lblOMRthreshold = new JLabel(EmarkingDesktop.lang.getString("omrthreshold")); lblOMRthreshold.setHorizontalAlignment(SwingConstants.RIGHT); lblOMRthreshold.setBounds(10, 32, 130, 14); panel_5.add(lblOMRthreshold); JLabel lblShapeSize = new JLabel(EmarkingDesktop.lang.getString("omrshapesize")); lblShapeSize.setHorizontalAlignment(SwingConstants.RIGHT); lblShapeSize.setBounds(10, 99, 130, 14); panel_5.add(lblShapeSize); JLabel lblDensity = new JLabel(EmarkingDesktop.lang.getString("omrdensity")); lblDensity.setHorizontalAlignment(SwingConstants.RIGHT); lblDensity.setBounds(10, 70, 130, 14); panel_5.add(lblDensity); spinnerOMRthreshold = new JSpinner(); spinnerOMRthreshold.setBounds(150, 32, 169, 20); panel_5.add(spinnerOMRthreshold); spinnerOMRthreshold.setValue(this.moodle.getOMRthreshold()); spinnerOMRdensity = new JSpinner(); spinnerOMRdensity.setBounds(150, 67, 169, 20); panel_5.add(spinnerOMRdensity); spinnerOMRdensity.setValue(this.moodle.getOMRdensity()); spinnerOMRshapeSize = new JSpinner(); spinnerOMRshapeSize.setBounds(150, 99, 169, 20); panel_5.add(spinnerOMRshapeSize); spinnerOMRshapeSize.setValue(this.moodle.getOMRshapeSize()); JLabel lblAnonymousPercentage = new JLabel( "<html>" + EmarkingDesktop.lang.getString("anonymouspercentage") + "</html>"); lblAnonymousPercentage.setHorizontalAlignment(SwingConstants.RIGHT); lblAnonymousPercentage.setBounds(329, 32, 130, 27); panel_5.add(lblAnonymousPercentage); spinnerAnonymousPercentage = new JSpinner(); spinnerAnonymousPercentage.setBounds(469, 32, 169, 20); panel_5.add(spinnerAnonymousPercentage); spinnerAnonymousPercentage.setValue(this.moodle.getAnonymousPercentage()); JLabel lblAnonymousPercentageCustomPage = new JLabel( "<html>" + EmarkingDesktop.lang.getString("anonymouspercentagecustompage") + "</html>"); lblAnonymousPercentageCustomPage.setHorizontalAlignment(SwingConstants.RIGHT); lblAnonymousPercentageCustomPage.setBounds(329, 70, 130, 27); panel_5.add(lblAnonymousPercentageCustomPage); spinnerAnonymousPercentageCustomPage = new JSpinner(); spinnerAnonymousPercentageCustomPage.setBounds(469, 70, 169, 20); panel_5.add(spinnerAnonymousPercentageCustomPage); spinnerAnonymousPercentageCustomPage.setValue(this.moodle.getAnonymousPercentageCustomPage()); JLabel lblCustomPage = new JLabel( "<html>" + EmarkingDesktop.lang.getString("anonymouscustompage") + "</html>"); lblCustomPage.setHorizontalAlignment(SwingConstants.RIGHT); lblCustomPage.setBounds(329, 99, 130, 27); panel_5.add(lblCustomPage); spinnerCustomPage = new JSpinner(); spinnerCustomPage.setBounds(469, 99, 169, 20); panel_5.add(spinnerCustomPage); spinnerCustomPage.setValue(this.moodle.getAnonymousCustomPage()); }