-
Bug
-
Resolution: Fixed
-
P2
-
fx2.0
-
b32
java6 32bit
to reproduce run following code
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ButtonBackgroundSize extends Application {
public static void main(String[] args) {
launch( args);
}
private Parent getContent() {
VBox list = new VBox(10);
Button but = new Button("Button long long line\n the\n\n\n\n\n\n first line");
but.setStyle("-fx-background-image: "
+ "url(\"file:red-rectangle.png\");"+"-fx-background-size: 100% 100%;-fx-border-color: red;");
list.getChildren().add(but);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(200);
stage.setHeight(200);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.setVisible(true);
}
}
///////////////////////////////////////
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ButtonBackgroundSize extends Application {
public static void main(String[] args) {
launch(args);
}
private Parent getContent() {
VBox list = new VBox(10);
Button but = new Button("Button long long line\n the\n\n\n\n\n\n first line");
but.setStyle("-fx-background-image: "
+ "url(\"file:red-rectangle.png\");" + "-fx-background-size: 50%;"
+ "-fx-background-repeat: no-repeat;");
list.getChildren().add(but);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(400);
stage.setHeight(400);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.setVisible(true);
}
}
/////////////////////////////////////////////////
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ButtonBackgroundSizeDirtyRegions extends Application {
Button but;
VBox list;
public static void main(String[] args) {
launch(args);
}
private Parent getContent() {
list = new VBox(10);
but = new Button("Button long long line\n the\n\n\n\n\n\n first line");
but.setStyle("-fx-background-image: "
+ "url(\"file:red-rectangle.png\");" + "-fx-background-size: 300%;"
+ "-fx-background-repeat: no-repeat;-fx-border-color:green;");
list.getChildren().add(but);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(400);
stage.setHeight(400);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.show();
new Thread(new Runnable(){
@Override
public void run() {
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(ButtonBackgroundSize.class.getName()).log(Level.SEVERE, null, ex);
}
Platform.runLater(new Runnable(){
@Override
public void run() {
list.getChildren().remove(but);
}
});
}
}).start();
}
}
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ButtonBackgroundSize extends Application {
public static void main(String[] args) {
launch( args);
}
private Parent getContent() {
VBox list = new VBox(10);
Button but = new Button("Button long long line\n the\n\n\n\n\n\n first line");
but.setStyle("-fx-background-image: "
+ "url(\"file:red-rectangle.png\");"+"-fx-background-size: 100% 100%;-fx-border-color: red;");
list.getChildren().add(but);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(200);
stage.setHeight(200);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.setVisible(true);
}
}
///////////////////////////////////////
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ButtonBackgroundSize extends Application {
public static void main(String[] args) {
launch(args);
}
private Parent getContent() {
VBox list = new VBox(10);
Button but = new Button("Button long long line\n the\n\n\n\n\n\n first line");
but.setStyle("-fx-background-image: "
+ "url(\"file:red-rectangle.png\");" + "-fx-background-size: 50%;"
+ "-fx-background-repeat: no-repeat;");
list.getChildren().add(but);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(400);
stage.setHeight(400);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.setVisible(true);
}
}
/////////////////////////////////////////////////
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ButtonBackgroundSizeDirtyRegions extends Application {
Button but;
VBox list;
public static void main(String[] args) {
launch(args);
}
private Parent getContent() {
list = new VBox(10);
but = new Button("Button long long line\n the\n\n\n\n\n\n first line");
but.setStyle("-fx-background-image: "
+ "url(\"file:red-rectangle.png\");" + "-fx-background-size: 300%;"
+ "-fx-background-repeat: no-repeat;-fx-border-color:green;");
list.getChildren().add(but);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(400);
stage.setHeight(400);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.show();
new Thread(new Runnable(){
@Override
public void run() {
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(ButtonBackgroundSize.class.getName()).log(Level.SEVERE, null, ex);
}
Platform.runLater(new Runnable(){
@Override
public void run() {
list.getChildren().remove(but);
}
});
}
}).start();
}
}
- relates to
-
JDK-8113097 Region background images with percentage sizes are broken
- Resolved
-
JDK-8091363 Better "auto" implementation for CSS "-fx-background-size"
- Open