débutant en java j'essaie de trouver l'erreur de code qui fait que le textField ne s'affiche pas. Merci d'avance à celui qui trouvera la solution.
import java.awt.Color;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Swing_3 {
public static fenetre f = null;
public static JTextField txtf = null;
public static void main(String[] args) {
f = new fenetre();
txtf = new JTextField("",20);
txtf.setLocation(8, 8);
JPanel panel = new JPanel();
panel.setLayout(null);
panel.add(txtf);
f.add(panel);
f.setVisible(true);
}
}
Partager