8
votes

Comment convertir JTextfield en chaîne et chaîne à JTextfield?

Comment convertir jtextfield à chaîne et chaîne sur jtextfield en java?


1 commentaires

embaucher un alchimiste ;-) sérieusement: convert n'est pas ce que vous voulez ...


4 Réponses :


14
votes

Comment convertir jtextfield en chaîne et chaîne à JTextfield en Java P>

Si vous voulez dire comment obtenir et définir la chaîne de JTextfield, vous pouvez utiliser les méthodes suivantes: P>

jTextField.setText(str)  // set string to jtextfield
//or
new JTextField(str)     // set string to jtextfield

0 commentaires

7
votes
// to string
String text = textField.getText();

// to JTextField
textField.setText(text);
You can also create a new text field: new JTextField(text)Note that this is not conversion. You have two objects, where one has a property of the type of the other one, and you just set/get it.Reference: javadocs of JTextField

0 commentaires

4
votes

Le jtextfield offre un gettext () et un settext () méthode - ceux-ci sont pour obtenir et définir le contenu du champ de texte .


0 commentaires

4
votes

jtextfield nous permet de gettext () et settext () Ceux-ci sont utilisés pour obtenir et définir le contenu du champ de texte, pour Exemple. XXX

J'espère que cela aide


0 commentaires