-
Bug
-
Resolution: Not an Issue
-
P4
-
8u40
If you run the code below, you get:
1) a stage with an Hello button whose title is centred
2) the "button.getAlignment()=CENTER_LEFT" on stdio
=> BUG: Hello title should be aligned on the left
However if you uncomment the line
// button.setAlignment(Pos.CENTER_LEFT);
and run the code again, the label is now aligned on the left.
So Button class does not honour the default value of Button.alignment property.
But it honours any subsequent setting.
package buttonalignmenttest;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
public class ButtonAlignmentTest extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
final Button button = new Button("Hello");
System.out.println("button.getAlignment()=" + button.getAlignment());
// button.setAlignment(Pos.CENTER_LEFT);
final Scene scene = new Scene(button);
primaryStage.setScene(scene);
primaryStage.setWidth(300.0);
primaryStage.show();
}
}
1) a stage with an Hello button whose title is centred
2) the "button.getAlignment()=CENTER_LEFT" on stdio
=> BUG: Hello title should be aligned on the left
However if you uncomment the line
// button.setAlignment(Pos.CENTER_LEFT);
and run the code again, the label is now aligned on the left.
So Button class does not honour the default value of Button.alignment property.
But it honours any subsequent setting.
package buttonalignmenttest;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
public class ButtonAlignmentTest extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
final Button button = new Button("Hello");
System.out.println("button.getAlignment()=" + button.getAlignment());
// button.setAlignment(Pos.CENTER_LEFT);
final Scene scene = new Scene(button);
primaryStage.setScene(scene);
primaryStage.setWidth(300.0);
primaryStage.show();
}
}
- duplicates
-
JDK-8088356 Wrapping a ProgressBar into a Button's internal imageView the Alignment "CENTER_LEFT" is equal to "CENTER"
-
- Closed
-