Probleme fenetre java

Fermé
djoufouf Messages postés 9 Date d'inscription mercredi 5 décembre 2012 Statut Membre Dernière intervention 4 mai 2013 - 19 avril 2013 à 19:02
KX Messages postés 16760 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 12 février 2025 - 20 avril 2013 à 07:52
bonjour j ai un probleme ma fenetre ne s ouvre pas ! voici mon script

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fenetre;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
*
* @author Weymeels
*/
public class Fenetre extends JFrame implements ActionListener
{
private String mot;
private JButton affiche, efface;
private JLabel affichage;
private JPanel pano;

//consturcteur de la classe

public Fenetre()
{
setSize(300, 100);
setTitle ("boutons");
setDefaultCloseOperation(EXIT_ON_CLOSE);

pano = new JPanel (new BorderLayout(40, 50));
affiche = new JButton("affiché");
efface = new JButton ("effacé");
affiche.addActionListener(this);
efface.addActionListener(this);

affichage = new JLabel ();
pano.add(efface, BorderLayout.EAST);
pano.add(affiche, BorderLayout.WEST);

add(pano);
setvisible(true);





/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}



@Override
public void actionPerformed(ActionEvent ae) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

private void setvisible(boolean b) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}

et voici ce qu il me disent



run:
BUILD SUCCESSFUL (total time: 0 seconds)



je comprend pas aidé svp
A voir également:

1 réponse

KX Messages postés 16760 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 12 février 2025 3 020
20 avril 2013 à 07:52
public static void main(String[] args) {
// TODO code application logic here
}

Il faut mettre quelque chose dans ton main, sinon ton programme ne fait rien !

private void setvisible(boolean b) { 
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
}

Quelle idée saugrenue de vouloir générer une exception sur un setvisible !

Tout cela sent NetBeans à plein nez ! Avant d'utiliser des outils trop compliqués pour toi, apprends à programmer manuellement...
0