Created
February 4, 2012 20:43
-
-
Save naokirin/1740042 to your computer and use it in GitHub Desktop.
JavaFXMemo02
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.application.Application; | |
import javafx.stage.Stage; | |
import javafx.scene.Scene; | |
import javafx.scene.control.TextField; | |
import javafx.scene.layout.VBox; | |
import javafx.scene.control.TextArea; | |
import javafx.scene.control.Button; | |
import javafx.scene.layout.HBox; | |
public class JavaFXMemo extends Application { | |
public static void main(String[] args){ | |
Application.launch(JavaFXMemo.class, args); | |
} | |
@Override | |
public void start(Stage stage) { | |
// シーングラフとルートオブジェクトの生成 | |
VBox vbox = new VBox(); | |
Scene scene = new Scene(vbox); | |
// テキストエリア、テキストフィールド、ボタンの設定 | |
TextArea textArea = new TextArea(); | |
TextField commandField = new TextField(); | |
Button commandButton = new Button("Command"); | |
HBox commandArea = new HBox(); | |
// テキストエリアとコマンドフィールドの大きさをSceneの大きさに合わせて変更するようにする | |
textArea.minHeightProperty().bind(scene.heightProperty().subtract(commandArea.heightProperty())); | |
commandField.minWidthProperty().bind(scene.widthProperty().subtract(commandButton.widthProperty())); | |
// それぞれのオブジェクトを追加 | |
commandArea.getChildren().addAll(commandField, commandButton); | |
vbox.getChildren().addAll(textArea, commandArea); | |
// Stageの設定 | |
stage.setScene(scene); | |
stage.setTitle("JavaFXMemo"); | |
stage.setWidth(1024); stage.setHeight(700); | |
stage.show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment