私はjavafxで小さなアプリケーションを作成しています。私は背景色を設定したいので、FXMLコードは以下の通りです。背景色を設定する方法
<?xml version="1.0" encoding="utf-8"?>
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="javafxapplication1.FXMLhomepageController">
<children>
<Label fx:id="lb1" layoutX="139.0" prefHeight="109.0" prefWidth="343.0" text="home page" textAlignment="JUSTIFY" textFill="#355680">
<font>
<Font size="68.0" />
</font>
</Label>
</children>
</AnchorPane>
回答:
回答№1は2次に例を示します。
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: blue;" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" />
使用している場合 Scene Builder
このセクションをどのように使用するかを学ぶ必要があります Properties
:
また、 CSS
これを達成するためのスタイルシート。