javafx-css

Place an object inside an SVG in javafx

隐身守侯 提交于 2021-02-17 07:15:06
问题 I am making Risk in java with javaFX. I have the map displayed in an fxml file, with every country having an SVGPath. I want to know how can I put a circle with a number inside it, in the centre of the SVG. I am hoping I can do this in the CSS but so far I cant get it working. My SVGPaths look like this: <SVGPath id="Egypt" styleClass="grey-country, africa, country" content="M484 328c8,2 15,10 23,9 0,-4 0,-4 1,-7 12,-3 24,4 35,8 5,0 9,0 14,0 1,5 3,10 4,15 -2,0 -4,-1 -6,-1 2,9 5,17 7,26 -3,1

Where can I find a complete official reference on JavaFX CSS?

血红的双手。 提交于 2021-01-28 04:05:54
问题 When I want to change the background colour of my TextArea in JavaFX (with CSS), many people recommend "-fx-control-inner-background" . But when I look up the Oracle's CSS reference there's no such a thing as "-fx-control-inner-background" ! In fact nowhere, in the Internet I could find a reference on that and yet it works ! My question is where do these people discover this information? Why, for example, isn't -fx-background-color working instead? 回答1: Note that -fx-control-inner-background

How can I change the color of a JFXSlider's thumb according to the color of the slider at the current position of the thumb on the slider?

跟風遠走 提交于 2020-12-30 02:21:42
问题 I'm using a JFXSlider in JavaFX and I've used a linear gradient for the color of the JFXSlider 's track (with CSS). However, I'd also like to change the color of the thumb to that of the slider for that position. I've used the following CSS for the slider's linear gradient and for getting rid of the default green color of the JFXSlider : .jfx-slider .track { -fx-pref-height: 10; -fx-background-color: linear-gradient(to right,red,orange); } .jfx-slider .colored-track { -fx-background-color:

JavaFX TextFlow set default text color

[亡魂溺海] 提交于 2020-01-25 07:59:43
问题 As the title, it's possible to to apply a default color to all text of a TextFlow component? TextFlow textFlow = new TextFlow(); textFlow.setId("supertextflow"); // Somewhere else in the code textFlow.getChildren() .add(new Text("Dynamic added text! OMG!")); I tryed different solution but none of them works #supertextflow { -fx-text-fill: red; } #supertextflow * .text{ -fx-fill: red; } #supertextflow > * > .text { -fx-fill: red; } I know that Text is another component, but why i can't style

JavaFx how to align only one column-header in tableview?

馋奶兔 提交于 2020-01-02 05:31:08
问题 How to align title of only one column in tableview? The following css aligns all column-header but I want to align just one column: .table-view .column-header .label{ -fx-alignment:CENTER } 回答1: You can do that now with recent versions of JavaFX. Java 1.7 This worked for me with Java: 1.7.0_45 / JavaFX: 2.2.45-b18). It should be a recent version because it requires RT-14909 The column-header will automatically get the same "Id" as the TableColumn! Therefore your TableColumn(s) need an (CSS-)

JavaFX-CSS: How to “move” style of parent to a child?

假如想象 提交于 2020-01-01 16:46:26
问题 The trigger for this was a quick experiment to solve TreeItem selection width: the requirement is to highlight only the text, not the whole tree cell. Nothing easier than that (said Frederik :) implement a custom TreeCell with a Label as graphic (and configure the label with the item as needed) remove the selection style (mostly the highlight background from the cell add the highlight style to the label Something like (a runnable example using this is at the end): public static class

JavaFX-CSS: How to “move” style of parent to a child?

扶醉桌前 提交于 2020-01-01 16:46:22
问题 The trigger for this was a quick experiment to solve TreeItem selection width: the requirement is to highlight only the text, not the whole tree cell. Nothing easier than that (said Frederik :) implement a custom TreeCell with a Label as graphic (and configure the label with the item as needed) remove the selection style (mostly the highlight background from the cell add the highlight style to the label Something like (a runnable example using this is at the end): public static class

Is it possible to set a JavaFX static property in CSS?

夙愿已清 提交于 2019-12-31 01:50:25
问题 Sample FXML with the BorderPanel.alignment "static property": <BorderPane> <top> <Label text="My Label" BorderPanel.alignment="CENTER"/> </top> </BorderPane> The CSS-supported version: <BorderPane stylesheets="Style.css"> <top> <Label text="My Label" styleClass="labelClass"/> </top> </BorderPane> Style.css would be: .labelClass { -fx-borderpanel-alignement: center } 回答1: For JavaFX versions 2.0 to 2.2 => no you cannot set the static layout properties via css. You can create a feature request

How to set style for first level child in treetableview

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 03:37:18
问题 I want to set the top border just for all the first child so that for one child the data looks in one row. but I'm unable to set the id for those rows. I tried the following code but it didn't help. final PseudoClass firstRowClass = PseudoClass.getPseudoClass("first-child"); devWorkTabBenchtable.setRowFactory(new Callback<TreeTableView<DevWorkTabBench>, TreeTableRow<DevWorkTabBench>>() { @Override public TreeTableRow<DevWorkTabBench> call(TreeTableView<DevWorkTabBench> param) { TreeTableRow

Remove arrow on JavaFX menuButton

亡梦爱人 提交于 2019-12-22 05:39:09
问题 Hi JavaFX Stylesheet expert, How do I remove the default arrow on JavaFX menuButton. I have figured how to change the color and make in unvisible with .menu-button { -fx-mark-color: transparent; } or .menu-button .arrow { -fx-background-color: transparent; } but, I don't want the gap because of the unvisible arrow. Thanks for your advice. Best Regards, Ivan 回答1: If we look into the source code of MenuButtonSkinBase , the sub structure of MenuButton seems to be MenuButton |——— label