Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Cliff Evan

+ Follow
since Oct 06, 2018
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Cliff Evan


For example you are independent developer who created a custom component "BaseComponent" that contains only AnchorPane with an empty css class "external".

I'm another developer who created my custom component "SuperComponent", that contains  2 BaseComponent's "One" , "Two", with classes "background" , and "foreground". A SuperComponent.css style class looks like:

And as you can see , i used a "background" class name, that's very common.

A third employee inserts SuperComponent to his big project. And he has already defined css class

Because SuperComponent has only empty class "background" it applies a red background to it, that wasn't expected to.
So how can i encapsulate SuperComponent .background class of being overriten outside?

I'v tried to add another class for each component "One" and "Two", and make css like :

That not helped. A third employee css

overrides it again.

I'v tried to set a root class of my SuperComponent and make css like:  


Also not helped.

I'v found only 2 ways of doing that, non of them i liked:
1) Rename my background class to  "supercomponent-background", but this is nonsense, because for my point i'm already in supercomponent.css and operating my "unique" .background class
2) Override all properties for .background class. This is also meaningless, because i need to overrite EVERY -fx-property.

Please explain how to properly get out of the situation.

1 year ago
Hello again.

I'm trying to make a swap animation of two cells in ListView<String>. The code looks like:

Everything works, except one thing. If cellMax is out from viewport  of ListView ( you need to scroll listview to see cellMax) then it's not rendered (or visible) when Transition changes cellMax.tranlateY.

I tried to do: cellMax.setVisible(true), cellMax.setOpacity(1) but nothing helped.

Don't know if that can help, but for cellMin in a debug:
LayoutFlag = CLEAN
Visible = BooleanProperty [bean: ListViewSkin$2@4a5c2efb[styleClass=cell indexed-cell list-cell]'book0', name: visible, value: true]

And for a cellMax (that located out of viewport) :
Visible = null

How can i render cellMax, when it appear in viewport by Translating it's Y value? Or may be there is another way to swap two cells with a Transitions?

Big thanks for any help

1 year ago

I created a FXML with fx:root construct and put on it for example ImageView image; The root AnchorPane has 500 x 500 dimension, and that image located in a center 250 x 250 and has width = 50 and height = 50. I can see all bounds and cooridnates in Scene Builder.
Then i need to do some calculation in a constructor based on image Width\Height and X, Y; But all of them are equals to zero.

As i understood all layouts are invalid until my component is placed into some other parent container of stage and after method. But i need to do calculations based just on initial FXML of a component.
I found 2 ways.
The first is to surround them into Platform->runLater():

But i'm sure that this is a wrong approach, because i have to put all initialisation component logic (positioning, transitions and so on) inside that thread.

The second way is to create a method with that calculations and execute it after parent stage initialized    ShellForm.Shell.SOME_INIT_METHOD();

That also seems to be wrong, because i have to control initialization of component inner structure outside that component.

How can i get a correct dimensions of those "child" components in a constructor of my FXML component?
1 year ago

I'm trying to create unique resizable interface on the transparent stage. 4 corner elements are perfoming resizing of the window.
I put them into AcnhorPane and wrote handlers (for test left top and right top):

but when i resize and change stage width the opposite elements are twiching\jiggling. The same behavior you can see in top right corner of Chrome Browser, when you resize it.";" target="_new" rel="nofollow">Here you can see what's happening.
Can you give an advice how to avoid and "fix" that issue?

1 year ago