When using WebView to display buttons with Bootstrap CSS the button disappears when the button is in a disabled state. When the button enters the enabled state the button displays correctly.
The problem is due to the opacity CSS Setting for the Bootstrap ".btn.disabled" class which contains
opacity: .65;
If I have the following style on the button as per the bootstrap css, the button does not display
<input type="button" value="TEST" style="opacity: .65">
The opacity style works correctly on the same version of JavaFX (8u40) on Windows.
Here is a code sample which will display the official Bootstrap page at the Buttons - "Disabled State" section
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.*;
public class JavaFXWeb extends Application {
@Override
public void start(Stage stage) throws Exception {
BorderPane bp = new BorderPane();
WebView webView = new WebView();
WebEngine webEngine = webView.getEngine();
webEngine.load("http://getbootstrap.com/css/#buttons-disabled");
bp.setCenter(webView);
Scene scene = new Scene(bp, 1200, 800);
stage.setScene(scene);
stage.setTitle("Disabled Button - Opacity Test");
stage.show();
}
public static void main(String[] args) {
launch(JavaFXWeb.class, args);
}
}
The problem is due to the opacity CSS Setting for the Bootstrap ".btn.disabled" class which contains
opacity: .65;
If I have the following style on the button as per the bootstrap css, the button does not display
<input type="button" value="TEST" style="opacity: .65">
The opacity style works correctly on the same version of JavaFX (8u40) on Windows.
Here is a code sample which will display the official Bootstrap page at the Buttons - "Disabled State" section
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.*;
public class JavaFXWeb extends Application {
@Override
public void start(Stage stage) throws Exception {
BorderPane bp = new BorderPane();
WebView webView = new WebView();
WebEngine webEngine = webView.getEngine();
webEngine.load("http://getbootstrap.com/css/#buttons-disabled");
bp.setCenter(webView);
Scene scene = new Scene(bp, 1200, 800);
stage.setScene(scene);
stage.setTitle("Disabled Button - Opacity Test");
stage.show();
}
public static void main(String[] args) {
launch(JavaFXWeb.class, args);
}
}