1 19 20 package org.netbeans.modules.project.ui.groups; 21 22 import java.io.File ; 23 import org.openide.filesystems.FileObject; 24 import org.openide.filesystems.FileUtil; 25 26 30 public class DirectoryGroupEditPanel extends GroupEditPanel { 31 32 private final DirectoryGroup g; 33 34 public DirectoryGroupEditPanel(DirectoryGroup g) { 35 this.g = g; 36 initComponents(); 37 nameField.setText(g.getName()); 38 FileObject dir = g.getDirectory(); 39 if (dir != null) { 40 File d = FileUtil.toFile(dir); 41 if (d != null) { 42 folderField.setText(d.getAbsolutePath()); 43 } 44 } 45 } 46 47 public void applyChanges() { 48 g.setName(nameField.getText().trim()); 49 } 50 51 56 private void initComponents() { 58 59 nameLabel = new javax.swing.JLabel (); 60 nameField = new javax.swing.JTextField (); 61 folderLabel = new javax.swing.JLabel (); 62 folderField = new javax.swing.JTextField (); 63 64 org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(DirectoryGroupEditPanel.class, "DirectoryGroupEditPanel.nameLabel.text")); 66 org.openide.awt.Mnemonics.setLocalizedText(folderLabel, org.openide.util.NbBundle.getMessage(DirectoryGroupEditPanel.class, "DirectoryGroupEditPanel.folderLabel.text")); 68 folderField.setEditable(false); 69 70 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 71 this.setLayout(layout); 72 layout.setHorizontalGroup( 73 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 74 .add(layout.createSequentialGroup() 75 .addContainerGap() 76 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 77 .add(nameLabel) 78 .add(folderLabel)) 79 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 80 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 81 .add(folderField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE) 82 .add(nameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE)) 83 .addContainerGap()) 84 ); 85 layout.setVerticalGroup( 86 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 87 .add(layout.createSequentialGroup() 88 .addContainerGap() 89 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 90 .add(nameLabel) 91 .add(nameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 92 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 93 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 94 .add(folderLabel) 95 .add(folderField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 96 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 97 ); 98 } 100 private javax.swing.JTextField folderField; 102 private javax.swing.JLabel folderLabel; 103 private javax.swing.JTextField nameField; 104 private javax.swing.JLabel nameLabel; 105 107 } 108 | Popular Tags |