1
package whowantstobeamillionairetriviagame;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundImage;
import javafx.scene.layout.BackgroundPosition;
import javafx.scene.layout.BackgroundRepeat;
import javafx.scene.layout.BackgroundSize;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class WhoWantsToBeAMillionaireTriviaGame extends Application
{
@Override
public void start(Stage startingStage) throws Exception
{
Image backgroundColor = new Image("http://www.sonomare.com/darkblue_background_rot_180.jpg");
BackgroundSize backgroundSize = new BackgroundSize(100, 100, true, true, true, false);
BackgroundImage backgroundImage = new BackgroundImage(backgroundColor, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, backgroundSize);
StackPane background = new StackPane();
background.setBackground(new Background(backgroundImage));
Scene menuScene = new Scene(background);
startingStage.setScene(menuScene);
startingStage.setFullScreen(true);
startingStage.show();
}
public static void main(String[] args)
{
launch(args);
}
}
我這麼問是因爲重複使用會造成畫面一遍遍在x和y軸重複因此它可以拉伸圖片適合整個屏幕。不使用重複會在其周圍留下一堆空白空間。 Round,Space和將舞臺設置爲全屏也無濟於事。我能做什麼?
謝謝主席先生,看起來好多了。 – 2015-04-04 20:42:31