- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- ソース を表示
- JavaFX/Layout/Accordion へ行く。
- 1 (2018-05-09 (水) 08:19:19)
- 2 (2018-05-09 (水) 09:33:22)
- 3 (2018-05-10 (木) 08:11:53)
- 4 (2018-05-11 (金) 07:55:35)
コンテナ †
- UI部品のレイアウトを整えるベース部分である。
- 行、列、重なりやタイル配置など様々なクラスがある。
- Windowのリサイズで自動的に配置とサイズを変更してくれる機能がある。
テキストフィールドやラベル、ボタンなど、この
Accordion †
Accordionレイアウトを提供する。
タイトルをクリックするとコンテンツが表示されるビューである。
package sample; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Accordion; import javafx.scene.control.TextArea; import javafx.scene.control.TitledPane; import javafx.scene.web.WebView; import javafx.stage.Stage; public class SampleAccordion extends Application { /** * Initialize stage and start scene. * * @param primaryStage * @throws Exception */ @Override public void start(Stage primaryStage) throws Exception { // Create accordion. Accordion acc = new Accordion(); // Create panes. TitledPane pane1 = new TitledPane("pane1", new TextArea("content1")); TitledPane pane2 = new TitledPane("pane2", new TextArea("content2")); TitledPane pane3 = new TitledPane("pane3", new WebView()); // Add panes to the accordion container. acc.getPanes().add(pane1); acc.getPanes().add(pane2); acc.getPanes().add(pane3); // When the stage is shown, make pane1 opened. acc.setExpandedPane(pane1); // Load a webpage when page3 is opened. pane3.setOnMousePressed(event -> { WebView wv = (WebView)pane3.getContent(); if (wv.getEngine().getLocation() == null) { wv.getEngine().load("https://haikikyou.xsrv.jp/pwiki/"); } }); // Create a scene Scene scene = new Scene(acc); primaryStage.setScene(scene); // Show window. primaryStage.show(); } /** * Launch application. * * @param args */ public static void main(String[] args) { launch(args); } }