CompEvol / BeastFX

GUIs for BEAST using Java FX to make things more pretty.
GNU Lesser General Public License v2.1
4 stars 2 forks source link

Changing the colour of the validation label makes it invisible #70

Closed bjoelle closed 1 year ago

bjoelle commented 1 year ago

So code like this makes the validation label invisible if the validation fails:

    public void validateInput() {
        try {
            augTree.initAndValidate();
            if (m_validateLabel != null) {
                m_validateLabel.setVisible(false);
            }
        } catch (Exception e) {
            Log.err.println("Validation message: " + e.getMessage());
            if (m_validateLabel != null) {
                m_validateLabel.setTooltip("Validation error: " + e.getMessage());
                m_validateLabel.setColor("red"); // commenting this line out solves the problem
                m_validateLabel.setVisible(true);
            }
            notifyValidationListeners(ValidationStatus.IS_INVALID);
        }
        repaint();
    }

As far as I can tell, this comes from the fact that SmallLabel.setColour replaces the style of the label entirely, and so also removes the height and width set when creating the label.

rbouckaert commented 1 year ago

@bjoelle Good catch! Does 31b532b fix the problem?

bjoelle commented 1 year ago

So the label now appears correctly, but it still doesn't change colour - it's orange (which I guess is the default ?) not red

rbouckaert commented 1 year ago

Thanks -- it was indeed the style being completely replaced. Maintaining the bits other than colour fixed it.