1 19 20 package org.netbeans.modules.web.project.ui; 21 22 26 public class ServletUriPanel extends javax.swing.JPanel { 27 28 29 public ServletUriPanel(String [] urlPatterns, String selectedItem, boolean fromRunMenu ) { 30 initComponents(); 31 if (fromRunMenu) { 32 jLabel2.setText(org.openide.util.NbBundle.getMessage(ServletUriPanel.class, "DESC_setServletURI")); 33 } 34 if (selectedItem!=null) { 35 jComboBox1.addItem(selectedItem); 36 } 37 for (int i=0;i<urlPatterns.length;i++) { 38 if (!urlPatterns[i].equals(selectedItem)) 39 jComboBox1.addItem(urlPatterns[i]); 40 } 41 if (selectedItem!=null) { 42 ((javax.swing.JTextField )jComboBox1.getEditor().getEditorComponent()).setText(selectedItem); 43 } 44 } 45 46 public String getServletUri() { 47 String servletUri = (String )jComboBox1.getSelectedItem(); 48 49 if (servletUri != null && servletUri.length() > 0 && servletUri.charAt(0) != '/') 50 servletUri = "/" + servletUri; 51 52 return servletUri; 53 } 54 55 60 private void initComponents() { 62 java.awt.GridBagConstraints gridBagConstraints; 63 64 jComboBox1 = new javax.swing.JComboBox (); 65 jLabel1 = new javax.swing.JLabel (); 66 jLabel2 = new javax.swing.JLabel (); 67 68 setLayout(new java.awt.GridBagLayout ()); 69 70 getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ServletUriPanel.class, "A11Y_desc_setServletURI")); 71 jComboBox1.setEditable(true); 72 gridBagConstraints = new java.awt.GridBagConstraints (); 73 gridBagConstraints.gridx = 0; 74 gridBagConstraints.gridy = 1; 75 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 76 gridBagConstraints.weightx = 1.0; 77 gridBagConstraints.insets = new java.awt.Insets (6, 12, 0, 12); 78 add(jComboBox1, gridBagConstraints); 79 80 jLabel1.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ServletUriPanel.class, "LBL_setServletURI_mnem").charAt(0)); 81 jLabel1.setLabelFor(jComboBox1); 82 jLabel1.setText(org.openide.util.NbBundle.getMessage(ServletUriPanel.class, "LBL_setServletURI")); 83 gridBagConstraints = new java.awt.GridBagConstraints (); 84 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 85 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 86 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 12); 87 add(jLabel1, gridBagConstraints); 88 89 gridBagConstraints = new java.awt.GridBagConstraints (); 90 gridBagConstraints.gridy = 2; 91 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 92 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 93 gridBagConstraints.insets = new java.awt.Insets (12, 12, 12, 12); 94 add(jLabel2, gridBagConstraints); 95 96 } 98 99 private javax.swing.JComboBox jComboBox1; 101 private javax.swing.JLabel jLabel1; 102 private javax.swing.JLabel jLabel2; 103 105 } 106 | Popular Tags |