Я хочу удалить красную рамку, когда я сфокусировал свою привязную панель. Я пробовал разные вещи, такие как:JavaFX: удалить сфокусированную рамку в панели привязки
#rootPane {
-fx-focus-color: transparent;
-fx-faint-focus-color: transparent;
}
или programmtically rootPane.setStyle ("- Fx-фокус-цвет: прозрачный;");
У меня есть экран входа в систему со следующими FXML:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane fx:id="rootPane" prefHeight="500.0" prefWidth="350" stylesheets="@Login_neu.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.erp.ui.login.LoginController_new">
<children>
<AnchorPane fx:id="ap_title" minHeight="0.0" minWidth="0.0" prefHeight="148.0" prefWidth="350.0">
<children>
<Text id="welcome-text" layoutX="29.0" layoutY="56.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Warehouse MMM Solution" wrappingWidth="270.13671875" />
<Text id="welcome-text2" layoutX="181.0" layoutY="76.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Powered by SAP" wrappingWidth="166.13671875" />
</children>
</AnchorPane>
<AnchorPane fx:id="ap_login" layoutX="-4.0" layoutY="150.0" minHeight="0.0" minWidth="0.0" prefHeight="350.0" prefWidth="350.0">
<children>
<ProgressBar fx:id="progressbar" disable="true" layoutX="75.0" layoutY="312.0" maxHeight="3.0" minHeight="3.0" prefHeight="3.0" prefWidth="200.0" visible="false" />
<Button fx:id="btn_submit" layoutX="249.0" layoutY="268.0" onAction="#handleSubmitAction" text="Sign In" AnchorPane.rightAnchor="46.0">
<opaqueInsets>
<Insets right="20.0" />
</opaqueInsets>
</Button>
<Label fx:id="lbl_username" layoutX="100.0" layoutY="38.0" text="Username:" />
<Label fx:id="lbl_plant" layoutX="100.0" layoutY="178.0" text="Plant:" />
<Label fx:id="lbl_password" layoutX="100.0" layoutY="106.0" text="Password" />
<TextField fx:id="tf_username" layoutX="100.0" layoutY="61.0" />
<PasswordField fx:id="pf_password" layoutX="100.0" layoutY="133.0" text="182832" />
<ComboBox fx:id="cb_plants" disable="true" layoutX="100.0" layoutY="205.0" prefWidth="150.0" />
</children>
</AnchorPane>
</children>
</AnchorPane>
Если я этот трюк
#ap_login {
-fx-focus-color: transparent;
-fx-faint-focus-color: transparent;
}
или
#rootPane {
-fx-focus-color: transparent;
-fx-faint-focus-color: transparent;
}
только кнопка делает силу.
Css файл выглядит следующим образом:
.root {
}
#welcome-text {
-fx-font-size: 20.0px;
-fx-fill: black;
-fx-font-weight: bold;
}
#welcome-text2 {
-fx-font-size: 14.0px;
-fx-fill: black;
-fx-font-weight: bold;
}
#ap_title {
-fx-background-color: #9dd34c;
-fx-focus-color: transparent;
-fx-faint-focus-color: transparent;
}
#ap_login {
-fx-focus-color: transparent;
-fx-faint-focus-color: transparent;
}
По умолчанию «AnchorPane» не имеет границы фокуса (а граница фокуса также не красная от deafult). Отправьте свой файл CSS. – DVarga
Спасибо за ответ. Мой Css выглядит следующим образом: '.root { } # welcome-text { -fx-font-size: 20.0px; -fx-fill: черный; -fx-font-weight: bold; } # welcome-text2 { \t -fx-font-size: 14.0px; \t -fx-fill: black; \t -fx-font-weight: bold; } #ap_title { -fx-background-color: # 9dd34c; \t -fx-focus-color: transparent; \t -fx-faint-focus-color: transparent; } #ap_login { \t -fx-focus-color: transparent; \t -fx-faint-focus-color: transparent; } ' – Texas
@Texas Пожалуйста, отредактируйте ваш вопрос с помощью дополнительного материала. Это невозможно прочитать в комментарии. –