本文整理汇总了Java中javax.swing.JTextField.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java JTextField.setEnabled方法的具体用法?Java JTextField.setEnabled怎么用?Java JTextField.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextField
的用法示例。
在下文中一共展示了JTextField.setEnabled方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.swing.JTextField; //导入方法依赖的package包/类
public static void main(String[] args) {
JTextFieldDemo1();
final JFrame f = new JFrame("Welcome To Earth!");
final JTextField name = new JTextField(30);
final JTextField noed = new JTextField("HJW", 10);
final JLabel nameLab = new JLabel("�����û�����:");
final JLabel noedLab = new JLabel("���ɱ༭�ı� ");
noed.setEnabled(false);
name.setColumns(30);
noed.setColumns(30);
f.setLayout(new GridLayout(3, 2));// ���ò��ֹ�����
f.add(nameLab);
f.add(name);
f.add(noedLab);
f.add(noed);
f.setSize(300, 100);
f.setLocation(300, 200);
f.setVisible(true);
}
示例2: enableOrDisableCompareAlgs
import javax.swing.JTextField; //导入方法依赖的package包/类
/** Edited by Abhimanyu Chugh **/
private void enableOrDisableCompareAlgs(boolean enabled) {
compPanel.setEnabled(enabled);
compMultiAlg.setEnabled(enabled);
for (JCheckBox checkBox : algCheckBoxes.values()) {
checkBox.setEnabled(enabled);
}
for (JTextField tolerance : algTolerances.values()) {
tolerance.setEnabled(enabled);
}
for (JLabel algTolLabel : algToleranceLabels.values()) {
algTolLabel.setEnabled(enabled);
}
}
示例3: JTextFieldDemo1
import javax.swing.JTextField; //导入方法依赖的package包/类
public static void JTextFieldDemo1() {
jf = new JFrame("TextField����");
final Container contentPane = jf.getContentPane();
contentPane.setLayout(new BorderLayout());
jp = new JPanel();
jtf1 = new JTextField();
jtf2 = new JTextField(10);
jtf3 = new JTextField("ָ���ı�����");
jtf4 = new JTextField("ָ������+ָ������(ֻ��״̬)", 30);
jtf3.setEnabled(false); // true���Ա༭
jtf4.setFont(new Font("����", Font.BOLD | Font.ITALIC, 16)); // ���壬�Ƿ�Ӵ֡�б�壬�ֺ�
// �����ı���ˮƽ���뷽ʽ
jtf4.setHorizontalAlignment(SwingConstants.CENTER);
jp.add(jtf1);
jp.add(jtf2);
jp.add(jtf3);
jp.add(jtf4);
contentPane.add(jp);
jf.pack();
jf.setLocation(400, 200);
jf.setVisible(true);
jf.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
示例4: luoKomponentit
import javax.swing.JTextField; //导入方法依赖的package包/类
private void luoKomponentit(Container container) {
frame.setLayout(new GridLayout(3, 1));
JTextField tuloskentta = new JTextField("0");
container.add(tuloskentta);
tuloskentta.setEnabled(false);
JTextField syotekentta = new JTextField("");
container.add(syotekentta);
JButton plus = new JButton("+");
JButton miinus = new JButton("-");
JButton nollaa = new JButton("Z");
JButton undo = new JButton("undo");
Tapahtumankuuntelija kasittelija = new Tapahtumankuuntelija(plus, miinus, nollaa, undo, tuloskentta, syotekentta);
plus.addActionListener(kasittelija);
miinus.addActionListener(kasittelija);
nollaa.addActionListener(kasittelija);
undo.addActionListener(kasittelija);
nollaa.setEnabled(false);
undo.setEnabled(false);
JPanel paneli = new JPanel(new GridLayout(1, 4));
paneli.add(plus);
paneli.add(miinus);
paneli.add(nollaa);
paneli.add(undo);
container.add(paneli);
}
示例5: getDisabledFieldBackground
import javax.swing.JTextField; //导入方法依赖的package包/类
static Color getDisabledFieldBackground() {
JTextField disabledField = new JTextField();
disabledField.setEditable(false);
disabledField.setEnabled(false);
return disabledField.getBackground();
}
示例6: initComponents
import javax.swing.JTextField; //导入方法依赖的package包/类
private void initComponents() {
jrbOneShot = new JRadioButton("One Shot");
jrbOneShot.setMnemonic(KeyEvent.VK_O);
jrbOneShot.setActionCommand("One Shot");
jrbOneShot.setSelected(true);
jrbOneShot.addActionListener(this);
jrbMonteCarlo = new JRadioButton("Monte-Carlo");
jrbMonteCarlo.setMnemonic(KeyEvent.VK_M);
jrbMonteCarlo.setActionCommand("Monte-Carlo");
jrbMonteCarlo.addActionListener(this);
buttonGroup = new ButtonGroup();
buttonGroup.add(jrbOneShot); buttonGroup.add(jrbMonteCarlo);
jlTimeUnits = new JLabel("Time units: ");
jlMaxIterations = new JLabel("Max iterations: ");
jlSelectExtensions = new JLabel("Select your report extension(s)");
jcbExtensions = new ArrayList<JCheckBox>(6);
jcbDocx = new JCheckBox("docx"); jcbExtensions.add(jcbDocx);
jcbHtml = new JCheckBox("html"); jcbExtensions.add(jcbHtml);
jcbPdf = new JCheckBox("pdf"); jcbExtensions.add(jcbPdf);
jcbPptx = new JCheckBox("pptx"); jcbExtensions.add(jcbPptx);
jcbOdt = new JCheckBox("odt"); jcbExtensions.add(jcbOdt);
jcbXlsx = new JCheckBox("xlsx"); jcbExtensions.add(jcbXlsx);
jcbPdf.setSelected(true);
for(JCheckBox jcb : jcbExtensions) jcb.setEnabled(false);
this.jlSelectModelingProject = new JLabel("Select your modeling project");
this.jcbModelingProjects = new JComboBox<String>();
// Retrieval of all user workspaces modeling projects
for(String project : WorkspaceManager.getModelingProjects())
this.jcbModelingProjects.addItem(project);
this.jcbModelingProjects.setSelectedIndex(0);
this.jcbModelingProjects.addActionListener(this);
this.jcbModelingProjects.setEnabled(false);
this.jlSelectReportTemplate = new JLabel("Select the report template you want to use");
this.jcbReportTemplates = new JComboBox<String>();
// Retrieval of all report templates of the selected project (the first one by default)
for(String template : WorkspaceManager.getTemplates(this.jcbModelingProjects.getItemAt(0)))
this.jcbReportTemplates.addItem(template);
if(this.jcbReportTemplates.getModel().getSize() == 0)
this.jcbReportTemplates.addItem("No report templates available !");
this.jcbReportTemplates.setSelectedIndex(0);
this.jcbReportTemplates.addActionListener(this);
this.jcbReportTemplates.setEnabled(false);
jtfTimeUnits = new JTextField("1000");
PlainDocument docTimeUnits = (PlainDocument) jtfTimeUnits.getDocument();
docTimeUnits.setDocumentFilter(new IntFilter());
jtfMaxIterations = new JTextField("100");
PlainDocument docMaxIterations = (PlainDocument) jtfMaxIterations.getDocument();
docMaxIterations.setDocumentFilter(new IntFilter());
// "One Shot" simulation selected by default
jtfMaxIterations.setEnabled(false);
jtfTimeUnits.setColumns(5);
jtfMaxIterations.setColumns(5);
jbStart = new JButton("Start");
jbStart.addActionListener(this);
jbStop = new JButton("Stop");
jbStop.addActionListener(this);
jbStop.setEnabled(false);
jpLoader = new PanelLoader("status bar", 100);
}
示例7: initialize
import javax.swing.JTextField; //导入方法依赖的package包/类
/**
* Método responsável por inicializar componentes da tela
*
* @throws ParseException
*/
private void initialize() throws ParseException {
setModal(true);
this.setLocationRelativeTo(null);
setTitle("Abertura de Conta");
setBounds(100, 100, 300, 250);
getContentPane().setLayout(null);
JLabel lblNumero = new JLabel("Numero *:");
lblNumero.setBounds(10, 39, 80, 14);
getContentPane().add(lblNumero);
JLabel lblDataDeAbertura = new JLabel("Abertura:");
lblDataDeAbertura.setBounds(10, 11, 80, 14);
getContentPane().add(lblDataDeAbertura);
JLabel lblSaldoInicial = new JLabel("Saldo Inicial:");
lblSaldoInicial.setBounds(10, 67, 80, 14);
getContentPane().add(lblSaldoInicial);
btnCancelar = new JButton("Cancelar");
btnCancelar.setBounds(175, 166, 99, 35);
getContentPane().add(btnCancelar);
btnSalvar = new JButton("Salvar");
btnSalvar.setBounds(55, 166, 99, 35);
getContentPane().add(btnSalvar);
JSeparator separator = new JSeparator();
separator.setBounds(10, 153, 264, 2);
getContentPane().add(separator);
tfNumero = new JTextField();
tfNumero.setBounds(110, 36, 75, 20);
getContentPane().add(tfNumero);
tfSaldo = new JTextField();
tfSaldo.setBounds(110, 64, 75, 20);
getContentPane().add(tfSaldo);
tfSaldo.setColumns(10);
lblCamposObrigatrios = new JLabel("(*) Campos Obrigatórios");
lblCamposObrigatrios.setHorizontalAlignment(SwingConstants.RIGHT);
lblCamposObrigatrios.setFont(new Font("Tahoma", Font.PLAIN, 11));
lblCamposObrigatrios.setBounds(138, 120, 136, 24);
getContentPane().add(lblCamposObrigatrios);
txDtAbertura = new JTextField();
txDtAbertura.setBounds(110, 9, 170, 19);
txDtAbertura.setEnabled(false);
Date date = new Date();
txDtAbertura.setText(UtilData.formataData(date));
getContentPane().add(txDtAbertura);
txDtAbertura.setColumns(10);
}
示例8: setupGUI
import javax.swing.JTextField; //导入方法依赖的package包/类
private void setupGUI()
{
JNameValuePanel panel1 = new JNameValuePanel();
name = new I18nTextField(BundleCache.getLanguages());
description = new I18nTextArea(BundleCache.getLanguages());
owner = new SingleUserSelector(clientService.getService(RemoteUserService.class));
// http://jira.pearsoncmg.com/jira/browse/EQ-1224
code = new JSmartTextField(100);
startDate = new DateSelector();
endDate = new DateSelector();
students = new JSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1));
citations = new JComboBox(courseInfoService.getAllCitations().toArray());
courseType = new JComboBox(CourseInfo.COURSE_TYPES.toArray());
departmentName = new JTextField();
archived = new JCheckBox();
panel1.addTextAndComponent(getKey("courses.detailstab.name"), name); //$NON-NLS-1$
panel1.addTextAndComponent(getKey("detailstab.desc"), description); //$NON-NLS-1$
panel1.addTextAndComponent(getKey("detailstab.department"), departmentName); //$NON-NLS-1$
panel1.addTextAndComponent(getKey("courses.detailstab.owner"), owner); //$NON-NLS-1$
panel1.addTextAndComponent(getKey("detailstab.code"), code); //$NON-NLS-1$
panel1.addTextAndComponent(getKey("detailstab.startdate"), startDate); //$NON-NLS-1$
panel1.addTextAndComponent(getKey("detailstab.enddate"), endDate); //$NON-NLS-1$
panel1.addTextAndComponent(getKey("detailstab.students"), students); //$NON-NLS-1$
panel1.addTextAndComponent(getKey("detailstab.citation"), citations); //$NON-NLS-1$
panel1.addTextAndComponent(getKey("detailstab.coursetype"), courseType); //$NON-NLS-1$
panel1.addTextAndComponent(getKey("detailstab.archived"), archived); //$NON-NLS-1$
// Make sure things are readonly.
if( state.isReadonly() )
{
name.setEnabled(false);
description.setEnabled(false);
owner.setEnabled(false);
code.setEnabled(false);
startDate.setEnabled(false);
endDate.setEnabled(false);
students.setEnabled(false);
departmentName.setEnabled(false);
courseType.setEditable(false);
}
final int[] rows = {TableLayout.FILL,};
final int[] cols = {TableLayout.DOUBLE_FILL, TableLayout.FILL,};
setLayout(new TableLayout(rows, cols));
add(panel1.getComponent(), new Rectangle(0, 0, 1, 1));
}
示例9: setFieldsEnabledTrue
import javax.swing.JTextField; //导入方法依赖的package包/类
/**
* Sets JTextField enabled true and Text null
*
* @param jTextField
*/
private void setFieldsEnabledTrue(JTextField jTextField) {
jTextField.setEnabled(true);
jTextField.setText(null);
}