1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
   | public void actionPerformed(ActionEvent ev) {
 
 
		index = action.ComboSource.getSelectedIndex();
		Object sourceEv = ev.getSource() ; 
 
		for (int i = 1 ; i<=3 ; i++){if (sourceEv == action.ComboSource && index==i) action.csm[i-1].setVisible(true); }
 
// en choisissant dans le menu déroulant , j'ai une Frame qui apparait , j'ajoute l'objet . 
// en suite j'affiche les objet ajoutés dans une autre frame que j'ai présenté dans mon 
// premier post .
 
		if (sourceEv == action.csm[0].jpfSM.btnFrame[0]&& index ==1)
		{	
			try {
			x = Double.valueOf(action.csm[0].jpfSM.getLblTxt()[0].getText())/FactConversion;
			y = Double.valueOf(action.csm[0].jpfSM.getLblTxt()[1].getText())/FactConversion;
			DED =  Double.valueOf(action.csm[0].jpfSM.getLblTxt()[3].getText());
 
			tsf	= new TableSourceFrame();
 
			ObjetSource = new ObjetSource(DED,x,y);
			tsf.modelSource.addSource(ObjetSource);
			int xSource=(int) ObjetSource.setX(x); 
			int ySource=(int) ObjetSource.setY(y);
		    ObjetSource.setBounds(xSource, ySource, 40, 50);
		//	action.imagePanel.lblMap.setBounds(0, 0,action.imagePanel.lblMap.getWidth() ,action.imagePanel.lblMap.getHeight() );
			action.imagePanel.lblMap.add(ObjetSource);
			action.imagePanel.lblMap.repaint();
 
 
			}
			catch (Exception e)
			{
				JOptionPane.showMessageDialog(null, "Veuillez renseigner les coordoonees  " , "Erreur", JOptionPane.ERROR_MESSAGE);
 
			}
 
		}
 
		if(sourceEv == action.csm[0].jpfSM.CheckBox)
		{
			status = action.csm[0].jpfSM.CheckBox.isSelected();
			setStatus(status);
		}
 
		if(sourceEv == action.jpfI.btnFrame[1])
		{	
			df =  new DecimalFormat("0");
 
			String nomIntervenant  = action.jpfI.getLblTxt()[0].getText();
			double seuil =0.00 ;
 
			x =(int)(x/0.26) ;
			y =(int)(y/0.26);
			try {
				seuil  = Double.parseDouble(action.jpfI.getLblTxt()[1].getText());
				if(seuil!=0.00 && nomIntervenant.isEmpty()== false)
				{	action.jpfI.btnFrame[0].setEnabled(true);
				   	action.jpfI.btnFrame[3].setEnabled(true);
					ObjetIntervenant =	new ObjetIntervenant(nomIntervenant,seuil,0.00,Color.green);
					action.tableRecap.setDefaultRenderer(Color.class, new ColorCellRenderer());
					x=ObjetIntervenant.setX(0); 
					y=ObjetIntervenant.setY(0);
					action.model.addInter(ObjetIntervenant);
					action.imagePanel.addObjet(ObjetIntervenant,x,y);
 
					for (int i = 0 ; i<2 ; i++) {
						action.jpfI.getLblTxt()[i].setText("");
						action.jpfI.getLblTxt()[1].setText("0.00");
 
					}
				}
				else 
				{
					JOptionPane.showMessageDialog(null, "Veuillez saisir les informations manquantes " , "Erreur", JOptionPane.ERROR_MESSAGE);
				}
			} catch (Exception e )
			{
				JOptionPane.showMessageDialog(null, "Le seuil n'est pas correct !  " , "Erreur", JOptionPane.ERROR_MESSAGE);
 
			}
 
		} | 
Partager