/** Creates new form PanelProjectLocationVisual */ public J2mePolishProjectTemplatePanelVisual(J2mePolishProjectTemplateWizardPanel panel) { initComponents(); this.panel = panel; this.type = type; // Register listener on the textFields to make the automatic updates projectNameTextField.getDocument().addDocumentListener(this); projectLocationTextField.getDocument().addDocumentListener(this); // check for default J2ME Polish installation directory: j2mePolishLocationTextField.setText(PolishSettings.getDefault().getPolishHome()); // this.j2mePolishLocationTextField.setText( getJ2mePolishInstallPath() ); this.j2mePolishLocationTextField.getDocument().addDocumentListener(this); panel.fireChangeEvent(); // Notify that the panel changed }
/** Handles changes in the Project name and project directory, */ private void updateTexts(DocumentEvent e) { Document doc = e.getDocument(); if (doc == projectNameTextField.getDocument() || doc == projectLocationTextField.getDocument()) { // Change in the project name String projectName = projectNameTextField.getText(); String projectFolder = projectLocationTextField.getText(); // if (projectFolder.trim().length() == 0 || projectFolder.equals(oldName)) { createdFolderTextField.setText(projectFolder + File.separatorChar + projectName); // } } panel.fireChangeEvent(); // Notify that the panel changed }
private void browseProjectLocationButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_browseProjectLocationButtonActionPerformed String command = evt.getActionCommand(); if ("BROWSE".equals(command)) { JFileChooser chooser = new JFileChooser(); FileUtil.preventFileChooserSymlinkTraversal(chooser, null); chooser.setDialogTitle("Select Project Location"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); String path = this.projectLocationTextField.getText(); if (path.length() > 0) { File f = new File(path); if (f.exists()) { chooser.setSelectedFile(f); } } if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { File projectDir = chooser.getSelectedFile(); projectLocationTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath()); } panel.fireChangeEvent(); } } // GEN-LAST:event_browseProjectLocationButtonActionPerformed