|
What this is
Other links
The source code/* * InputLines.java * * Created on May 16, 2003, 1:59 PM */ package org.netbeans.modules.j2ee.deployment.impl.ui; import org.openide.NotifyDescriptor; import java.awt.BorderLayout; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.border.*; import javax.swing.JPanel; import java.awt.Component; /** * Enhancement from NotifyDescriptor.InputLine (maybe need to move this a general place?) * @author nn136682 */ public class InputLines extends NotifyDescriptor { /** * The texts field used to enter the input. */ protected JTextField[] textFields; /** Construct dialog with the specified title and label text. * @param texts label texts * @param accessibleTexts accessible texts * @param title title of the dialog */ public InputLines( final String[] texts, final String[] accessibleTexts, final String[] toolTips, final String title) { this(texts, accessibleTexts, toolTips, title, OK_CANCEL_OPTION, PLAIN_MESSAGE); } /** Construct dialog with the specified title, label text, option and * message types. * @param texts label texts * @param accessibleTexts accessible texts * @param title title of the dialog * @param optionType option type (ok, cancel, ...) * @param messageType message type (question, ...) */ public InputLines( final String[] texts, final String[] accessibleTexts, final String[] toolTips, final String title, final int optionType, final int messageType) { super(null, title, optionType, messageType, null, null); super.setMessage(createDesign(texts, accessibleTexts, toolTips)); } /** * Get the text which the user typed into the input line. * @return the text entered by the user */ public String getInputText(int i) { return textFields[i].getText(); } /** * Set the text on the input line. * @param i index of the input text to set * @param text the new text */ public void setInputText(int i , final String text) { textFields[i].setText(text); textFields[i].selectAll(); } /** Make a component representing the input line. * @param text a label for the input line * @return the component */ protected Component createDesign( final String[] texts, final String[] accessibleTexts, final String[] toolTips) { textFields = new JTextField[texts.length]; JPanel panel = new JPanel(); //panel.setLayout(new BorderLayout()); //panel.setBorder(new EmptyBorder(11, 12, 1, 11)); panel.setLayout(new java.awt.GridBagLayout()); panel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 153))); panel.getAccessibleContext().setAccessibleDescription(accessibleTexts[0]); for (int i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.