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 MacroInputPanel extends javax.swing.JPanel { 32 33 34 public MacroInputPanel() { 35 initComponents (); 36 getAccessibleContext().setAccessibleDescription(getBundleString("ACSD_MIP")); macroLabel.setDisplayedMnemonic(getBundleString("MIP_Macro_Mnemonic").charAt(0)); expandLabel.setDisplayedMnemonic(getBundleString("MIP_Expand_Mnemonic").charAt(0)); macroField.getAccessibleContext().setAccessibleDescription(getBundleString("ACSD_MIP_Macro")); expandTextArea.getAccessibleContext().setAccessibleDescription(getBundleString("ACSD_MIP_Expand")); Dimension dim = getPreferredSize(); 42 dim.width = 4*dim.width; 43 dim.height = 4*dim.height; 44 setPreferredSize( dim ); 45 } 46 47 private String getBundleString(String s) { 48 return NbBundle.getMessage(MacroInputPanel.class, s); 49 } 50 51 public void setMacro( String [] macro ) { 52 macroField.setText( macro[0] ); 53 expandTextArea.setText( macro[1] ); 54 } 55 56 public String [] getMacro() { 57 String [] retVal = { macroField.getText(), expandTextArea.getText() }; 58 return retVal; 59 } 60 61 public void requestFocus(){ 62 macroField.requestFocus(); 63 } 64 65 66 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 68 69 macroLabel = new javax.swing.JLabel (); 70 macroField = new javax.swing.JTextField (); 71 expandLabel = new javax.swing.JLabel (); 72 expandScrollPane = new javax.swing.JScrollPane (); 73 expandTextArea = new javax.swing.JTextArea (); 74 75 setLayout(new java.awt.GridBagLayout ()); 76 77 setBorder(new javax.swing.border.EmptyBorder (new java.awt.Insets (12, 12, 11, 11))); 78 macroLabel.setLabelFor(macroField); 79 macroLabel.setText(getBundleString( "MIP_Macro" )); gridBagConstraints = new java.awt.GridBagConstraints (); 81 gridBagConstraints.gridx = 0; 82 gridBagConstraints.gridy = 0; 83 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 84 gridBagConstraints.insets = new java.awt.Insets (0, 0, 5, 12); 85 add(macroLabel, gridBagConstraints); 86 87 gridBagConstraints = new java.awt.GridBagConstraints (); 88 gridBagConstraints.gridx = 1; 89 gridBagConstraints.gridy = 0; 90 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 91 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 92 gridBagConstraints.insets = new java.awt.Insets (0, 0, 5, 0); 93 add(macroField, gridBagConstraints); 94 95 expandLabel.setLabelFor(expandTextArea); 96 expandLabel.setText(getBundleString( "MIP_Expand" )); gridBagConstraints = new java.awt.GridBagConstraints (); 98 gridBagConstraints.gridx = 0; 99 gridBagConstraints.gridy = 1; 100 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 101 gridBagConstraints.insets = new java.awt.Insets (2, 0, 0, 12); 102 add(expandLabel, gridBagConstraints); 103 104 expandScrollPane.setViewportView(expandTextArea); 105 106 gridBagConstraints = new java.awt.GridBagConstraints (); 107 gridBagConstraints.gridx = 1; 108 gridBagConstraints.gridy = 1; 109 gridBagConstraints.gridheight = 2; 110 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 111 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 112 gridBagConstraints.weightx = 1.0; 113 gridBagConstraints.weighty = 1.0; 114 add(expandScrollPane, gridBagConstraints); 115 116 } 118 119 private javax.swing.JTextArea expandTextArea; 121 private javax.swing.JLabel macroLabel; 122 private javax.swing.JTextField macroField; 123 private javax.swing.JScrollPane expandScrollPane; 124 private javax.swing.JLabel expandLabel; 125 127 } 128 | Popular Tags |