2013-08-28 157 views
0

我想按照下面的代碼將圖像添加到javafx2 gridpane,但是我希望此圖像不會在其單元格內受到限制。我希望圖像基本上在細胞外流動。在Javafx gridpane cell外部生長的圖像

 GridPane moon_pane = new GridPane(); 
     moon_pane.setId("prayertime_pane"); 
     moon_pane.setGridLinesVisible(true); 
     moon_pane.setPadding(new Insets(10, 10, 10, 10)); 
     moon_pane.setAlignment(Pos.BASELINE_CENTER); 
     moon_pane.setVgap(10); 
     moon_pane.setHgap(10); 


     Text moon_phase_text = new Text("60% full"); 
     moon_phase_text.setId("prayer-text-english"); 
     moon_pane.setHalignment(moon_phase_text,HPos.LEFT); 
     moon_pane.setValignment(moon_phase_text,VPos.CENTER); 
     moon_pane.setConstraints(moon_phase_text, 0, 0); 
     moon_pane.getChildren().add(moon_phase_text); 

     ImageView Moon_img = new ImageView(new Image(getClass().getResourceAsStream("/Images/Full_Moon.png"))); 
//  moon_pane.setHalignment(Moon_img,HPos.CENTER); 
//  moon_pane.setValignment(Moon_img,VPos.CENTER);  
     Moon_img.setFitWidth(100); 
     Moon_img.setFitHeight(100); 
     moon_pane.add(Moon_img, 1, 0); 

     Text next_moon_text = new Text("13/02"); 
     next_moon_text.setId("prayer-text-english"); 
     moon_pane.setHalignment(next_moon_text,HPos.LEFT); 
     moon_pane.setValignment(next_moon_text,VPos.CENTER); 
     moon_pane.setConstraints(next_moon_text, 2, 0); 
     moon_pane.getChildren().add(next_moon_text); 

回答

0

您可以嘗試增加ImageView節點上的比例。我相信縮放是從佈局/調整大小分開發生的。