I'd like to disable vertical scrollbar in a tableview to not be shown when there are too many items in it.
If it's posibble than my next question is: can i still scroll this table? For example bind scrolling to two buttons - up and down....
Apparently using css:
.table-view .scroll-bar:vertical > .increment-button,
.table-view .scroll-bar:vertical > .decrement-button {
-fx-background-color: null;
-fx-background-radius: 0;
-fx-background-insets: 0;
-fx-padding: 0;
}
can help a little as the table still shows a scrollbar(though a very small one)
Related
I am building an application using JavaFX and I have a form with JFXTextFields and JFXComboBoxes. I need to round them like round corners as the following picture.
Like this:
I have tried the following CSS code:
.jfx-text-field {
-fx-border-radius: 20px;
-fx-background-radius: 20 20 20 20;
-fx-border-color: #609;
}
But the result is this:
So how to round the text fields and combo boxes using CSS in JavaFX?
The .css-files used by JFoenix can be found at JFoenix-master\jfoenix\src\main\resources\com\jfoenix\assets\css\controls. The .css-file belonging to JFXTextField is jfx-text-field.css and the .css-file belonging to JFXComboBox is jfx-combo-box.css.
The styles defined in these files have to be adapted in a user-defined .css-file according to the requirements, e.g.:
.jfx-text-field,
.jfx-combo-box {
-fx-border-radius: 20px;
-fx-border-color: #CCCCCC;
}
.jfx-text-field {
-fx-padding: 0.333333em 1em 0.333333em 1em;
}
.jfx-combo-box {
-fx-padding: 0em 1em 0em 1em;
}
.jfx-text-field > .input-line,
.jfx-combo-box > .input-line {
-fx-background-color: transparent;
-fx-pref-height: 0px;
-fx-translate-y: 0px;
}
.jfx-text-field > .input-focused-line,
.jfx-combo-box > .input-focused-line {
-fx-background-color: transparent;
-fx-pref-height: 0px;
}
In the first block the border-radius and border-color are defined and in the following two blocks the padding. In the last two blocks the input line is disabled, which is still visible in the originally posted screenshot above. The result is:
The posted style is only an example and has to be adapted / optimized according to your requirements.
I am using Java FXML.
The progress bars look like this:
JavaFX Progress Bar
How do I remove the grey border around, but maintain the background.
To look like this:
Desired Progress Bar
Thanks!
You need to add a stylesheet and do this:
.progress-bar > .bar, .progress-bar > .track {
-fx-background-insets: 0;
}
You can do your own research from CSS Reference and Modena Theme CSS if you have similar problems in the future.
For my case, flat progress bar working with following style sheet
.progress-bar > .bar {
-fx-padding:0;
-fx-background-radius:0;
-fx-background-insets: 0;
-fx-background-color: black;
}
.progress-bar > .track {
-fx-background-color: lightgray, white;
-fx-background-radius:0;
-fx-background-insets: 0, 1;
}
I am using JavaFX with CSS.
And I want to show the border line of the header.
This is the default situation:
tree table view
And the following picture is what I am excepting for:
What I except for
.tree-table-view .column-header,
.tree-table-view .column-header .filler,
.tree-table-view .column-header-background .filler {
-fx-table-cell-border-color: #d9e4f1;
-fx-border-width: 0.1px;
-fx-background-color: #ffffff,-fx-table-cell-border-color;
}
This worked.
I want remove the arrows of a JavaFX Spinner.
I read how to remove the arrows of MenuButton in this link using CSS...but can't figure out how to do in my case .
remove arrows from menubutton
Any idea how ..thanks .
If you want to hide the array shapes you could do the same as the post you mentioned. The CSS properties you are looking for are :
.spinner .increment-arrow-button .increment-arrow {
-fx-padding: 0;
}
.spinner .decrement-arrow-button .decrement-arrow {
-fx-padding: 0;
}
If you don't want to alter their size by changing the padding you could set Shape to something non visible or just change it's background color to -fx-background-color: transparent;
When I upgraded by JavaFX app from JavaFX 2 to JavaFX 8, I noticed that ScrollPanes always showed up as gray rectangles, even with a background color set or the background set to be transparent.
I found the solution in this discussion: https://community.oracle.com/thread/3538169
First I needed this:
.scroll-pane > .viewport {
-fx-background-color: transparent;
}
Then I could set the background color to whatever I like. In this case, I'm making all ScrollPane backgrounds transparent:
.scroll-pane {
-fx-background-color: transparent;
}
Came acroos this just now, it's not working with -fx-background-color, but it is with -fx-background
.scroll-pane {
-fx-background: #FFFFFF;
-fx-border-color: #FFFFFF;
}
To alter borders, you would have to use "fx-background-color" .
To modify the viewport's background color, you should modify the "fx-background" attribute.
I used white for both colors :
scrollPane.setStyle("-fx-background: rgb(255,255,255);\n -fx-background-color: rgb(255,255,255)");
In-source approach:
Once it's added to the scene/stage, you can trigger off the width or height property to get access to the viewport styling.
ScrollPane myPane = new ScrollPane();
myPane.widthProperty().addListener((o) -> {
Node vp = logMessagePane.lookup(".viewport");
vp.setStyle("-fx-background-color:#434547;");
});