So when I make a ControlsFX titled border surrounding whatever I get this weird glitch:
See the white area around the 'hi'? That isn't suppose to be there. The weird thing is if I add the same border (new instance) to another Tab
, then it becomes normal:
Here is the code to generate the border:
Node calculateBorderd2 = Borders.wrap(new TextField()).etchedBorder().title("hi").buildAll();
bottomBorderPane.setRight(calculateBordered2);
This is reproducible only in my program. I tried to create mcve, but as said, I was unable to reproduce it. Adding the second border 100% fixes the issue (not a sometimes thing).
I am pretty sure this is a bug either in JavaFX or ControlsFX. I looked through all my code and couldn't find anything that could remotely relate to this (but obviously there is). I am using half and half FXML.
I looked into the decompiled Borders
class and found that the background is generated as transparent, and something else if scene is not equal to null:
private void updateTitleLabelFill() {
Scene s = n.getScene();
if(s == null) {
BackgroundFill fill = new BackgroundFill(Color.TRANSPARENT, (CornerRadii)null, (Insets)null);
this.titleLabel.setBackground(new Background(new BackgroundFill[]{fill}));
} else {
this.updateTitleLabelFillFromScene(s);
s.fillProperty().addListener(new WeakInvalidalionListener(this.updateTitleListener));
}
}
private void updateTitleLabelFillFromScene(Scene s) {
s.snapshot(new Callback() {
public Void call(SnapshotResult result) {
WritableImage image = result.getImage();
PixelReader reader = image.getPixelReader();
int start = (int)titleLabel.getLocalToSceneTransform().getTx();
int finish = (int)((double)start + titleLabel.getWidth());
int startY = (int)titleLabel.getLocalToSceneTransform().getTy();
int finishY = (int)((double)startY + titleLabel.getHeight());
HashMap map = new HashMap();
Color color;
for(int max = startY; max < finishY; ++max) {
for(int column = start; column < finish; ++column) {
try {
color = reader.getColor(column, max);
if(map.containsKey(color)) {
map.put(color, Integer.valueOf(((Integer)map.get(color)).intValue() + 1));
} else {
map.put(color, Integer.valueOf(1));
}
} catch (Exception var14) {
;
}
}
}
double var15 = 0.0D;
color = null;
Iterator fill = map.keySet().iterator();
while(fill.hasNext()) {
Color colorTemp = (Color)fill.next();
if((double)((Integer)map.get(colorTemp)).intValue() > var15) {
color = colorTemp;
var15 = (double)((Integer)map.get(colorTemp)).intValue();
}
}
BackgroundFill var16 = new BackgroundFill(color, (CornerRadii)null, (Insets)null);
titleLabel.setBackground(new Background(new BackgroundFill[]{var16}));
return null;
}
}, (WritableImage)null);
}
Has anyone encountered this issue before? If you want to see my whole code (tens of classes), I could add you to my BitBucket repo to view it all.