cs_ralebole
Messages postés
208
Date d'inscription
mardi 29 novembre 2005
Statut
Membre
Dernière intervention
5 janvier 2023
1
7 sept. 2006 à 21:23
Quand j'execute mon projet avec "Jcreator Le" il fonctionne correctement mais quand je veux l'executer a partir de ma page web message d'erreur "Applet Montest notinited"
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.net.URL;
import java.util.StringTokenizer;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class Montest extends JApplet implements ActionListener{
private static final long serialVersionUID = 1837289100466272306L;
private JLabel lependu = new JLabel();
private JButton button1 = new JButton();
private JButton buttona = new JButton();
private JButton buttonb = new JButton();
private JButton buttonc = new JButton();
private JButton buttond = new JButton();
private JButton buttone = new JButton();
private JButton buttonf = new JButton();
private JButton buttong = new JButton();
private JButton buttonh = new JButton();
private JButton buttoni = new JButton();
private JButton buttonj = new JButton();
private JButton buttonk = new JButton();
private JButton buttonl = new JButton();
private JButton buttonm = new JButton();
private JButton buttonn= new JButton();
private JButton buttono = new JButton();
private JButton buttonp = new JButton();
private JButton buttonq = new JButton();
private JButton buttonr = new JButton();
private JButton buttons = new JButton();
private JButton buttont = new JButton();
private JButton buttonu = new JButton();
private JButton buttonv = new JButton();
private JButton buttonw = new JButton();
private JButton buttonx = new JButton();
private JButton buttony = new JButton();
private JButton buttonz = new JButton();
private JLabel l1 = new JLabel();
private JLabel l2 = new JLabel();
private JLabel l3 = new JLabel();
private JLabel l4 = new JLabel();
private JLabel l5 = new JLabel();
private JLabel l6 = new JLabel();
private JLabel l7 = new JLabel();
private JLabel l8 = new JLabel();
private JLabel l9 = new JLabel();
private JLabel l10 = new JLabel();
public void init() {
lependu.setIcon(new ImageIcon("data/fbleu.gif"));
l1.setIcon(new ImageIcon("data/vide.gif"));
l2.setIcon(new ImageIcon("data/vide.gif"));
l3.setIcon(new ImageIcon("data/vide.gif"));
l4.setIcon(new ImageIcon("data/vide.gif"));
l5.setIcon(new ImageIcon("data/vide.gif"));
l6.setIcon(new ImageIcon("data/vide.gif"));
l7.setIcon(new ImageIcon("data/vide.gif"));
l8.setIcon(new ImageIcon("data/vide.gif"));
l9.setIcon(new ImageIcon("data/vide.gif"));
l10.setIcon(new ImageIcon("data/vide.gif"));
initButton(button1, "data/tirb.gif", this);
initButton(buttona, "data/ca.gif", this);
initButton(buttonb, "data/cb.gif", this);
initButton(buttonc, "data/cc.gif", this);
initButton(buttond, "data/cd.gif", this);
initButton(buttone, "data/ce.gif", this);
initButton(buttonf, "data/cd.gif", this);
initButton(buttong, "data/cg.gif", this);
initButton(buttonh, "data/ch.gif", this);
initButton(buttoni, "data/ci.gif", this);
initButton(buttonj, "data/cj.gif", this);
initButton(buttonk, "data/ck.gif", this);
initButton(buttonl, "data/cl.gif", this);
initButton(buttonm, "data/cm.gif", this);
initButton(buttonn, "data/cn.gif", this);
initButton(buttono, "data/co.gif", this);
initButton(buttonp, "data/cp.gif", this);
initButton(buttonq, "data/cq.gif", this);
initButton(buttonr, "data/cr.gif", this);
initButton(buttons, "data/cs.gif", this);
initButton(buttont, "data/ct.gif", this);
initButton(buttonu, "data/cu.gif", this);
initButton(buttonv, "data/cv.gif", this);
initButton(buttonw, "data/cw.gif", this);
initButton(buttonx, "data/cx.gif", this);
initButton(buttony, "data/cy.gif", this);
initButton(buttonz, "data/cz.gif", this);
setLayout(null);
lependu.setBounds(5, 5, 320, 220);
l1.setBounds(5, 232, 48, 64);
l2.setBounds(55, 232, 48, 64);
l3.setBounds(105, 232, 48, 64);
l4.setBounds(155, 232, 48, 64);
l5.setBounds(205, 232, 48, 64);
l6.setBounds(255, 232, 48, 64);
l7.setBounds(305, 232, 48, 64);
l8.setBounds(355, 232, 48, 64);
l9.setBounds(405, 232, 48, 64);
l10.setBounds(455, 232, 48, 64);
button1.setBounds(167, 390, 176, 24);
buttona.setBounds(5, 310, 32, 32);
buttonb.setBounds(44, 310, 32, 32);
buttonc.setBounds(83, 310, 32, 32);
buttond.setBounds(122, 310, 32, 32);
buttone.setBounds(161, 310, 32, 32);
buttonf.setBounds(200, 310, 32, 32);
buttong.setBounds(239, 310, 32, 32);
buttonh.setBounds(278, 310, 32, 32);
buttoni.setBounds(317, 310, 32, 32);
buttonj.setBounds(356, 310, 32, 32);
buttonk.setBounds(395, 310, 32, 32);
buttonl.setBounds(434, 310, 32, 32);
buttonm.setBounds(473, 310, 32, 32);
buttonn.setBounds(5, 350, 32, 32);
buttono.setBounds(44, 350, 32, 32);
buttonp.setBounds(83, 350, 32, 32);
buttonq.setBounds(122, 350, 32, 32);
buttonr.setBounds(161, 350, 32, 32);
buttons.setBounds(200, 350, 32, 32);
buttont.setBounds(239, 350, 32, 32);
buttonu.setBounds(278, 350, 32, 32);
buttonv.setBounds(317, 350, 32, 32);
buttonw.setBounds(356, 350, 32, 32);
buttonx.setBounds(395, 350, 32, 32);
buttony.setBounds(434, 350, 32, 32);
buttonz.setBounds(473, 350, 32, 32);
add(button1);
add(l1);
add(l2);
add(l3);
add(l4);
add(l5);
add(l6);
add(l7);
add(l8);
add(l9);
add(l10);
add(lependu);
add(button1);
add(buttona);
add(buttonb);
add(buttonc);
add(buttond);
add(buttone);
add(buttonf);
add(buttong);
add(buttonh);
add(buttoni);
add(buttonj);
add(buttonk);
add(buttonl);
add(buttonm);
add(buttonn);
add(buttono);
add(buttonp);
add(buttonq);
add(buttonr);
add(buttons);
add(buttont);
add(buttonu);
add(buttonv);
add(buttonw);
add(buttonx);
add(buttony);
add(buttonz);
}
private void initButton(JButton bt, String image, ActionListener action){
bt.setIcon(new ImageIcon(image));
bt.setFocusPainted(false);
bt.setMargin(null);
bt.setBorder(BorderFactory.createEmptyBorder());
bt.setContentAreaFilled(false);
bt.addActionListener(action);
}
public void actionPerformed(ActionEvent e)
{
//quand on a cliqué sur un bouton ici
Object source=e.getSource();
if(source==button1)
{initButton(buttona, "ba.gif", this);}
if(source==buttona)
{initButton(buttona, "ca.gif", this);}
}
}