0
그래서 테스트 목적으로 현재 하나의 스타일 만있는 스타일 시트가 있습니다.응용 프로그램을 실행할 때 javafx 장면 빌더에 적용되는 스타일 시트
CSS 코드 :
.minimizeBtn{
-fx-background-color: rgba(0,0,0,1);
}
버튼의 ID를 설정. 이것은 무대의 컨트롤러에 있습니다. fxml에서
public void initialize(URL url, ResourceBundle rb) {
handler = new DbHandlers();
minimizeBtn1.setId("minimizeBtn");
내 버튼 :
<Button fx:id="minimizeBtn1" layoutX="520.0" mnemonicParsing="false"
prefHeight="25.0" prefWidth="12.0" styleClass="minimizeBtn" text="Button" />
<Button layoutX="548.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="12.0" styleClass="maximizeBtn" text="Button" />
<Button layoutX="574.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="12.0" styleClass="closeBtn" text="Button" />
내 fxml 파일의 나머지 :
<AnchorPane prefHeight="450.0" prefWidth="600.0" style="-fx-background-color: #2A7FFF;" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="bownhrmain1.pages.LoginScreenController">
<children>
<AnchorPane prefHeight="450.0" prefWidth="600.0" style="-fx-background-color: #2A7FFF;">
<children>
<Label layoutX="335.0" layoutY="144.0" text="Inventory Systems" textFill="WHITE">
<font>
<Font size="8.0" />
</font>
</Label>
<ImageView fitHeight="150.0" fitWidth="200.0" layoutX="200.0" layoutY="65.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../images/benx_logo.png" />
</image>
</ImageView>
<Hyperlink layoutX="250.0" layoutY="368.0" text="Forgot Password?" textFill="WHITE" underline="true" />
<JFXButton fx:id="loginBtn" buttonType="RAISED" layoutX="190.0" layoutY="302.0" prefHeight="51.0" prefWidth="221.0" ripplerFill="#2980b9" style="-fx-background-color: #1E5D87;" text="Login" textFill="WHITE" />
<JFXPasswordField fx:id="passwordField" focusColor="#1e5d87" labelFloat="true" layoutX="190.0" layoutY="237.0" prefHeight="34.0" prefWidth="221.0" promptText="Password..." unFocusColor="WHITE" />
<JFXTextField id="text-field" fx:id="usernameField" focusColor="#1e5d87" labelFloat="true" layoutX="190.0" layoutY="176.0" prefHeight="32.0" prefWidth="221.0" promptText="Username/Email..." unFocusColor="WHITE" />
<ImageView fitHeight="20.0" fitWidth="19.0" layoutX="522.0" layoutY="5.0" pickOnBounds="true">
<image>
<Image url="@../images/minimize.png" />
</image>
</ImageView>
<ImageView fitHeight="11.0" fitWidth="12.0" layoutX="554.0" layoutY="9.0" pickOnBounds="true">
<image>
<Image url="@../images/expand-button.png" />
</image>
</ImageView>
<ImageView fitHeight="11.0" fitWidth="11.0" layoutX="581.0" layoutY="9.0" pickOnBounds="true">
<image>
<Image url="@../images/closeWindow.png" />
</image>
</ImageView>
<Button fx:id="minimizeBtn1" layoutX="520.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="12.0" styleClass="minimizeBtn" text="Button" />
<Button layoutX="548.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="12.0" styleClass="maximizeBtn" text="Button" />
<Button layoutX="574.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="12.0" styleClass="closeBtn" text="Button" />
</children>
</AnchorPane>
</children>
</AnchorPane>
내가 모두 설정을 시도하기 때문에 내가 버튼에 styleclass을 가지고있는 이유는 클래스 이름과 ID를 통해 css.