1 19 20 package org.netbeans.modules.editor.options; 21 22 import java.awt.Dimension ; 23 import org.openide.util.NbBundle; 24 25 30 31 public class AbbrevInputPanel extends javax.swing.JPanel { 32 33 34 public AbbrevInputPanel() { 35 initComponents (); 36 37 getAccessibleContext().setAccessibleDescription(getBundleString("ACSD_AIP")); abbrevLabel.setDisplayedMnemonic(getBundleString("AIP_Abbrev_Mnemonic").charAt (0)); expandLabel.setDisplayedMnemonic(getBundleString("AIP_Expand_Mnemonic").charAt (0)); abbrevField.getAccessibleContext().setAccessibleDescription(getBundleString("ACSD_AIP_Abbrev")); expandTextArea.getAccessibleContext().setAccessibleDescription(getBundleString("ACSD_AIP_Expand")); 43 Dimension dim = getPreferredSize(); 44 dim.width = 4*dim.width; 45 dim.height = 4*dim.height; 46 setPreferredSize( dim ); 47 } 48 49 private String getBundleString(String s) { 50 return NbBundle.getMessage(AbbrevInputPanel.class, s); 51 } 52 53 public void requestFocus(){ 54 abbrevField.requestFocus(); 55 } 56 57 public void setAbbrev( String [] abbrev ) { 58 abbrevField.setText( abbrev[0] ); 59 expandTextArea.setText( abbrev[1] ); 60 } 61 62 public String [] getAbbrev() { 63 String [] retVal = { abbrevField.getText(), expandTextArea.getText() }; 64 return retVal; 65 } 66 67 68 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 70 71 abbrevLabel = new javax.swing.JLabel (); 72 abbrevField = new javax.swing.JTextField (); 73 expandLabel = new javax.swing.JLabel (); 74 expandScrollPane = new javax.swing.JScrollPane (); 75 expandTextArea = new javax.swing.JTextArea (); 76 77 setLayout(new java.awt.GridBagLayout ()); 78 79 setBorder(new javax.swing.border.EmptyBorder (new java.awt.Insets (12, 12, 11, 11))); 80 abbrevLabel.setLabelFor(abbrevField); 81 abbrevLabel.setText(getBundleString( "AIP_Abbrev" )); gridBagConstraints = new java.awt.GridBagConstraints (); 83 gridBagConstraints.gridx = 0; 84 gridBagConstraints.gridy = 0; 85 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 86 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 12); 87 add(abbrevLabel, gridBagConstraints); 88 89 gridBagConstraints = new java.awt.GridBagConstraints (); 90 gridBagConstraints.gridx = 1; 91 gridBagConstraints.gridy = 0; 92 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 93 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 94 add(abbrevField, gridBagConstraints); 95 96 expandLabel.setLabelFor(expandTextArea); 97 expandLabel.setText(getBundleString( "AIP_Expand" )); gridBagConstraints = new java.awt.GridBagConstraints (); 99 gridBagConstraints.gridx = 0; 100 gridBagConstraints.gridy = 1; 101 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 102 gridBagConstraints.insets = new java.awt.Insets (14, 0, 0, 12); 103 add(expandLabel, gridBagConstraints); 104 105 expandScrollPane.setViewportView(expandTextArea); 106 107 gridBagConstraints = new java.awt.GridBagConstraints (); 108 gridBagConstraints.gridx = 1; 109 gridBagConstraints.gridy = 1; 110 gridBagConstraints.gridheight = 2; 111 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 112 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 113 gridBagConstraints.weightx = 1.0; 114 gridBagConstraints.weighty = 1.0; 115 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 0); 116 add(expandScrollPane, gridBagConstraints); 117 118 } 120 121 private javax.swing.JTextArea expandTextArea; 123 private javax.swing.JLabel abbrevLabel; 124 private javax.swing.JTextField abbrevField; 125 private javax.swing.JScrollPane expandScrollPane; 126 private javax.swing.JLabel expandLabel; 127 129 } 130 | Popular Tags |