38 lines
		
	
	
		
			978 B
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			978 B
		
	
	
	
		
			Java
		
	
	
	
	
	
| import javax.swing.*; 
 | |
| import java.awt.*; 
 | |
| 
 | |
| public class Declinaisons extends JComponent {
 | |
| 
 | |
| 	public Declinaisons(String form, String fond) {
 | |
| 		if(inst % 2 == 0) {
 | |
| 			secondPinceau.setColor("")
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
|     protected void paintComponent(Graphics pinceau) {
 | |
|         Graphics secondPinceau = pinceau.create();
 | |
| 
 | |
|         if (this.isOpaque()) {
 | |
| 			secondPinceau.setColor(this.getBackground());
 | |
| 			secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
 | |
| 		}
 | |
|         secondPinceau.setColor(this.getForeground());
 | |
| 
 | |
|         for(int i=0; i<10; i++){
 | |
|         	if(this.num % 2 == 0){
 | |
|         	this.num ++;
 | |
|         	secondPinceau.setColor(Color.MAGENTA);
 | |
|         } else {
 | |
|         	secondPinceau.setColor(Color.CYAN);
 | |
|         }
 | |
|     }
 | |
| 
 | |
| 
 | |
| 
 | |
|         int[] Xpoints = {this.getWidth()/4, this.getWidth()/4*3, this.getWidth()/2};
 | |
|         int[] Ypoints = {this.getHeight()/2, this.getHeight()/4, this.getHeight()/4*3};
 | |
|         secondPinceau.fillPolygon(Xpoints, Ypoints, 3);
 | |
|     }
 | |
| }
 |