Java Code Examples for javafx.scene.layout.Region#resize()

The following examples show how to use javafx.scene.layout.Region#resize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DropOp.java    From FxDock with Apache License 2.0 5 votes vote down vote up
public void addRect(Node ref, double x, double y, double w, double h)
{
	BoundingBox screenr = new BoundingBox(x, y, w, h);
	Bounds b = ref.localToScreen(screenr);
	b = target.screenToLocal(b);
	
	Region r = new Region();
	r.relocate(b.getMinX(), b.getMinY());
	r.resize(b.getWidth(), b.getHeight());
	r.setBackground(FX.background(Color.color(0, 0, 0, 0.3)));
	
	add(r);
}
 
Example 2
Source File: DropOp.java    From FxDock with Apache License 2.0 5 votes vote down vote up
public void addOutline(Node ref, double x, double y, double w, double h)
{
	BoundingBox screenr = new BoundingBox(x, y, w, h);
	Bounds b = ref.localToScreen(screenr);
	b = target.screenToLocal(b);
	
	Region r = new Region();
	r.relocate(b.getMinX(), b.getMinY());
	r.resize(b.getWidth(), b.getHeight());
	r.setBackground(FX.background(Color.color(0, 0, 0, 0.1)));
	
	add(r);
}
 
Example 3
Source File: JFXListCell.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
@Override
protected Node getMask() {
    Region clip = new Region();
    JFXNodeUtils.updateBackground(JFXListCell.this.getBackground(), clip);
    double width = control.getLayoutBounds().getWidth();
    double height = control.getLayoutBounds().getHeight();
    clip.resize(width, height);
    return clip;
}
 
Example 4
Source File: GraphEditorContainer.java    From graph-editor with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Sets the graph editor to be displayed in this container.
 *
 * @param graphEditor a {@link GraphEditor} instance
 */
public void setGraphEditor(final GraphEditor graphEditor) {

    if (this.graphEditor != null) {
        this.graphEditor.modelProperty().removeListener(modelChangeListener);
        this.graphEditor.getView().setOnScroll(null);
    }

    this.graphEditor = graphEditor;

    if (graphEditor != null) {

        graphEditor.modelProperty().addListener(modelChangeListener);

        final Region view = graphEditor.getView();
        final GModel model = graphEditor.getModel();
        final SkinLookup skinLookup = graphEditor.getSkinLookup();

        if (model != null) {
            view.resize(model.getContentWidth(), model.getContentHeight());
        }

        setContent(view);
        minimap.setContent(view);
        minimap.setModel(model);
        minimap.setSkinLookup(skinLookup);

        view.toBack();
        view.setOnScroll(event -> panBy(-event.getDeltaX(), -event.getDeltaY()));

    } else {
        minimap.setContent(null);
        minimap.setModel(null);
    }
}
 
Example 5
Source File: ResizePolicyTests.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void doRefreshVisual(Region visual) {
	visual.resize(size.width, size.height);
}