This blue appears around the edges of a window whenever that window has focus, and I want to get rid of it/style it another color.
Doing some research, it seems that the following code is the agreed upon solution for other nodes, but does not appear to work on the window as a whole.
.root{
-fx-focus-color: transparent !important;
-fx-faint-focus-color: transparent !important;
}
Turns out this color is the accent color of Windows 10, and has nothing to do with JavaFX. Oh well, guess it will have to stay.
Related
I'm having a little trouble regarding FX, CSS and the TreeTableView.
I have cells containing blue Hyperlinks. Now if the cell is selected, the background becomes blue and thus the link is practically invisible. I'd now like to change the background color of selected cells using Stylesheets.
For TreeView the following works fine:
.tree-view .tree-cell:selected{
-fx-background-color: green;
}
So analogously I tried:
.tree-table-view .tree-table-cell:selected{
-fx-background-color: green;
}
But this had no effect.
Surprisingly though I was able to change the general background color with this:
.tree-table-view .tree-table-cell{
-fx-background-color: yellow;
}
The cells were now all yellow but this is seems to override the default selection pattern as now even selected rows had a yellow background.
For me it seems as if the state selector does not apply to TreeTableView cells but I have no clue how to achieve this another way.
I also tried this with the Example 15-2 from the JavaFX documentation, getting the same unsatisfying result.
I was not able to find any solution on the web as all questions seem to regard TreeViews or TableViews but not the combined TreeTableView. So any hint or link to the right doc would be very helpful!
Thanks in advance!
P.S:
I am aware that one could cirumvent the problem by changing the color of the Hyperlink but there must be a way to change the cell's color, right?
You can use the .tree-table-row-cell selector with the -fx-background-color property you mentioned:
.tree-table-row-cell:selected {
-fx-background-color: green;
}
and you can also change the border color to better fit to the filling color:
.tree-table-row-cell:selected {
-fx-background-color: green;
-fx-table-cell-border-color: green;
}
You may apply more styles to the underlying table cell by using:
.tree-table-row-cell:selected > .tree-table-cell{
/*enter style rules here*/
}
This question already has an answer here:
Transparent background of a textarea in JavaFX 8
(1 answer)
Closed 5 years ago.
Right now in my CSS style sheet for JavaFX I have something like this. #myText is a tag in my FXML file. So what appears currently is a black textArea with red text, which is fine. I want to make the background of the textArea transparent (by changing the opacity) but keeping the text a solid color. Adding fx-opacity turns the background as well as my text transparent, so how do I get around this?
#myText{
-fx-background-color:black;
-fx-text-fill: red;
}
#myText .content {
-fx-background-color: black;
}
you can use the transparent colour to do that, it is as simple as:
-fx-background-color:transparent;
A useful source to help with more CSS commands is the Oracle JavaFX CSS reference guide
UPDATE
sorry I wasn't aware that you didn't want it fully transparent, in this case you can use:
-fx-background-color: rgba(0,0,0,0.7);
this uses the RGB colour scheme but with the ability to adjust the final value for opacity, being from 0.0 to 1.0, 0.0 obviously being completely transparent and 1.0 being completely shown.
So in my Java Application I have a grid pane with a time table of various names.
To change the color of the one my mouse is hovering over I do this:
.hours_grid_cell_pane:hover{
-fx-background-color: #ffff00;
-fx-border-color: #000000;
}
This is pretty simple. I want to know how I do the same thing to all the cells to the left, right, top, and bottom of the one I'm hovered over. Essentially forming big where my mouse is.
I've tried
.hours_grid_cell_pane:hover:left
and
.hours_grid_cell_pane:left
but that doesn't work. Is there any way to do this?
I was using an image editor last night for a certain picture. I set the text in the picture to #00fffb(cyan), later that day I made a program in JavaFX8 and noticed that a label set to the same color(#00fffb) did not have the same color on screen. I also noticed that the cyan-looking colors looked different in the color chooser than they do on screen. NOTE: The fonts were the same as well. Also, I used a black background to compare the two.
Label CSS:
.controlScreenLabel{
-fx-font-family: Lucida Fax;
-fx-font-size: 23px;
-fx-text-fill: #00fffb;
}
Looks like subpixel rendering.
Zoom in on the [Updates] label and you will see typical rainbow colors produced by that tech.
There is probably a switch to turn it off (though I don't know how it globally).
I think you can use css to manipulate the rendering from stylesheets: see -fx-font-smoothing-type: gray. Of you can set values in code.
You can read up on subpixel rendering on Wikipedia.
Error in your CSS
Your label css is not setting the font correctly, it should quote the font family, for example:
-fx-font-family: 'Lucida Fax';
I'm displaying a dashed border around an input text element with:
border: 1px dashed black;
Can I somehow define an "offset" to tell the browser where to start with the border?
My goal is to define a timer, and alter the offset of the dashed border (using java GWT element.setAttribute()), so that the simulation of a clockwise-moving dashed border results.
Is there any existing offset for borders with css?
There is a somewhat convoluted workaround to achieve a similar effect using an animated .gif as the background of a div, with whatever content you wanted "bordered" placed in a second div nested within the first with a 1px margin.
The animated .gif should be a small square (8px x 8px) with 3px-wide diagonal lines moving across it from left to right (you can adjust the sizes to adjust the width of the lines). When only a pixel's width or height of this image is visible, it appears to be a moving dashed border.
This technique is detailed here by Matthew Taylor at his blog: http://matthewjamestaylor.com/blog/animated-photoshop-selection-on-a-web-page.