37 /** 38 * A view that supports the <ISINDEX< tag. This is implemented 39 * as a JPanel that contains 40 * 41 * @author Sunita Mani 42 */ 43 44 class IsindexView extends ComponentView implements ActionListener { 45 46 JTextField textField; 47 48 /** 49 * Creates an IsindexView 50 */ 51 public IsindexView(Element elem) { 52 super(elem); 53 } 54 55 /** 56 * Creates the components necessary to implement 57 * this view. The component returned is a <code>JPanel</code>, 58 * that contains the PROMPT to the left and <code>JTextField</code> 59 * to the right. 60 */ 61 public Component createComponent() { 62 AttributeSet attr = getElement().getAttributes(); 63 64 JPanel panel = new JPanel(new BorderLayout()); 65 panel.setBackground(null); 66 67 String prompt = (String)attr.getAttribute(HTML.Attribute.PROMPT); 68 if (prompt == null) { 69 prompt = UIManager.getString("IsindexView.prompt"); 70 } 71 JLabel label = new JLabel(prompt); 72 73 textField = new JTextField(); 74 textField.addActionListener(this); 75 panel.add(label, BorderLayout.WEST); 76 panel.add(textField, BorderLayout.CENTER); 77 panel.setAlignmentY(1.0f); 78 panel.setOpaque(false); | 37 /** 38 * A view that supports the <ISINDEX< tag. This is implemented 39 * as a JPanel that contains 40 * 41 * @author Sunita Mani 42 */ 43 44 class IsindexView extends ComponentView implements ActionListener { 45 46 JTextField textField; 47 48 /** 49 * Creates an IsindexView 50 */ 51 public IsindexView(Element elem) { 52 super(elem); 53 } 54 55 /** 56 * Creates the components necessary to implement 57 * this view. The component returned is a {@code JPanel}, 58 * that contains the PROMPT to the left and {@code JTextField} 59 * to the right. 60 */ 61 public Component createComponent() { 62 AttributeSet attr = getElement().getAttributes(); 63 64 JPanel panel = new JPanel(new BorderLayout()); 65 panel.setBackground(null); 66 67 String prompt = (String)attr.getAttribute(HTML.Attribute.PROMPT); 68 if (prompt == null) { 69 prompt = UIManager.getString("IsindexView.prompt"); 70 } 71 JLabel label = new JLabel(prompt); 72 73 textField = new JTextField(); 74 textField.addActionListener(this); 75 panel.add(label, BorderLayout.WEST); 76 panel.add(textField, BorderLayout.CENTER); 77 panel.setAlignmentY(1.0f); 78 panel.setOpaque(false); |