How to make a moving dashed border with CSS? - java

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.

Related

JavaFX CSS Remove blue border from window

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.

JavaFx CSS style: Change left and right of selected

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?

Custom TableCell Border

If you look in modena.css you can see how the border of the default TableCell is specified:
.table-cell {
...
-fx-border-color: transparent -fx-table-cell-border-color transparent transparent;
...
}
As you can see the border is transparent apart from the right side that has the color specified by -fx-table-cell-border-color.
I would like the border on the right side to have two different colours. -fx-table-cell-border-color for all the pixels apart from the very bottom pixel that I would like to be red.
Is there anyway to specify that a border side is made up of more than one colour?
What about this:
.table-cell {
-fx-border-color: transparent
linear-gradient(to bottom, -fx-table-cell-border-color 95%,
red 95%)
transparent
transparent;
}
Note the 95%, depending on the height of the rows you can increase it to 95%+.
I've included this (scaled) pic of two tables, one with regular css (left), one with this css (right). The red pixel is just at the corner.

Color Mismatch In JavaFX8 Labels

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';

Java draw line with border

I'm developing a JApplet in which the user can draw some lines over an image.
Lines can be red or green, but I need to highlight them because I don't know the background color.
So I thought that I can draw a white "border" to the line, and I tried to do this creating other two white lines to the left and to the rigth of the original one. But the result is poor.
Is there a better way to accomplish this goal?
As mentioned by #Jesper, draw the line first using a thicker Stroke (as seen in this answer).
The black outline on the letters has width 2.
g.setStroke(new BasicStroke(2f));

Categories