Javafx code vereenvoudigen

Status
Niet open voor verdere reacties.

Lordll

Gebruiker
Lid geworden
27 jan 2009
Berichten
72
Hey mensen ik heb een code voor informatica gemaakt, die werkt prima maar ik moet het nu ook nog vereenvoudigen :shocked: dat is opzich niet zo'n ramp maar nu heb ik geen idee hoe ik dit moet doen met bijvoorbeeld alle rechthoeken en cirkels die ik heb gebruik in mijn code.
Hopelijk kan een van jullie mij helpen met een voorbeeld

Code:
Stage {
	title : "Stoplichten"
	scene: Scene {
		width: 500
		height: 500
		content: [ 
			
			Rectangle {
				x: -1,
				y: -1,
				width: 175,
				height: 175,
				fill: Color.rgb(00,255,00)
			} 
			Rectangle {
				x: 325,
				y: 325,
				width: 175,
				height: 175,
				fill: Color.rgb(00,255,00)
			} 
			Rectangle {
				x: -1,
				y: 325,
				width: 175,
				height: 175,
				fill: Color.rgb(00,255,00)
			}
			Rectangle {
				x: 325,
				y: -1,
				width: 175,
				height: 175,
				fill: Color.rgb(00,255,00)
			} 
			Rectangle {
				x: 174,
				y: -1,
				width: 151,
				height: 500,
				fill: Color.rgb(00,00,00)
			} 
			Rectangle {
				x: -1,
				y: 174,
				width: 500,
				height: 151,
				fill: Color.rgb(00,00,00)
			} 
			Rectangle {
				x: 247,
				y: -1,
				width: 6,
				height: 175,
				fill: Color.rgb(255,255,255)
			}
			Rectangle {
				x: 247,
				y: 325,
				width: 6,
				height: 175,
				fill: Color.rgb(255,255,255)
			}
			Rectangle {
				x: -1,
				y: 247,
				width: 175,
				height: 6,
				fill: Color.rgb(255,255,255)
			}
			Rectangle {
				x: 325,
				y: 247,
				width: 175,
				height: 6,
				fill: Color.rgb(255,255,255)
			}
			Circle {
   				centerX: 150,
   				centerY: 150,
   				radius: 14,
				fill: bind rood1
   			} 
   			Circle {
   				centerX: 150,
   				centerY: 110,
   				radius: 14,
   				fill: bind zwart2
   			}
   			Circle {
   				centerX: 150,
   				centerY: 70,
   				radius: 14,
   				fill: bind zwart1
   			}					   				
			Circle {
  				centerX: 350,
  				centerY: 350,
  				radius: 14,
  				fill: bind rood1
  			}
			Circle { 
  				centerX: 350,
  				centerY: 390,
  				radius: 14,
  				fill: bind zwart2
			}
  			Circle { 
  				centerX: 350,
  				centerY: 430,
  				radius: 14, 
  				fill: bind zwart1
  			} 	
			Circle {
  				centerX: 150,
  				centerY: 350,
  				radius: 14, 
  				fill: bind rood2
			}
			Circle {
  				centerX: 110,
  				centerY: 350,
  				radius: 14, 
  				fill: bind zwart4
			}
			Circle {
  				centerX: 70,
  				centerY: 350,
  				radius: 14, 
  				fill: bind zwart3 
			} 									
			Circle {
				centerX: 350,
				centerY: 150, 
				radius: 14,
				fill: bind rood2 
		   	}											
			Circle {
				centerX: 390,
				centerY: 150,
				radius: 14,
				fill: bind zwart4 
			}
			Circle {
		   		centerX: 430, 
		   		centerY: 150,
		   		radius: 14,
		   		fill: bind zwart3
			}		
			ImageView {
				image: image     
				x: bind motor1X 							                 											                  
				y: bind motor1Y
				fitWidth: 45
				preserveRatio: true
				smooth: true
			}								
			ImageView {
				image: image     
				y: bind motor2Y 							                 											                  
				x: bind motor2X
				rotate: bind motor2R
				fitWidth: 45
				preserveRatio: true
				smooth: true																																																																																										
			}													   										
		]
		}
}

Er is nog meer maar dat hoeft niet meer vereenvoudigd te worden.
Mvg Lordll

EDIT: ben eruit gekomen
 
Laatst bewerkt:
hoe het je dit opgelost ?
Ik moet ook 8 rectangles vereenvoudigen
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan