Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,40 @@ public void dispose() {
* *
* ********************************************************************** */

private BooleanProperty autoHeightProp = new SimpleBooleanProperty();

public BooleanProperty autoHeightProperty() {
return autoHeightProp;
}
public void setAutoHeight( boolean value ) {
autoHeightProp.set( value );
}
public boolean isAutoHeight() {
return autoHeightProp.get();
}

@Override
protected double computePrefHeight( double width )
{
if ( autoHeightProp.get() )
{
if ( getWidth() == 0.0 ) Platform.runLater( () -> requestLayout() );
else
{
double height = 0.0;
Insets in = getInsets();

for ( int p = 0; p < getParagraphs().size(); p++ ) {
height += getCell( p ).getHeight();
}
if ( height > 0.0 ) {
return height + in.getTop() + in.getBottom();
}
}
}
return super.computePrefHeight( width );
}

@Override
protected void layoutChildren() {
Insets ins = getInsets();
Expand Down