0
votes

There is a width property under Properties inherited from class javafx.scene.control.Control here:

http://docs.oracle.com/javafx/2/api/javafx/scene/control/Button.html

Upon clickign the width property, you can see the following page:

http://docs.oracle.com/javafx/2/api/javafx/scene/control/Control.html#widthProperty

with the "See Also" option where getWidth(), setWidth(double) are listed:

I am trying to use setWidth(double) for my button but I get an error message in NetBeans that:

setWidth(double) has protected access in Control

I am using it like this in my code for my button:

public Button[] stop_QR;

stop_QR[i].setWidth(20); 

I know it is declared as protected, but I don't understand why I can't use it? Please advise

2
This is likely by design to cep courage you to make use of properly layout managers (at a guess) - MadProgrammer

2 Answers

1
votes

It is made protected to allow layout managers calculate the optimal bounds of the Node. The users are expected to use setPrefWidth(), setMinWidth() and setMaxWidth() methods to constrain preferred node size.

0
votes

Protected means a field or method can only be accessed by it's super and subclasses.