#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x69506461, pid=9682, tid=1785752384
#
# JRE version: 7.0_06-b09
# Java VM: Java HotSpot(TM) Server VM (23.0-b21 mixed mode linux-x86 )
# Problematic frame:
# C 0x69506461
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/fx/NetBeansProjects/MenuButton/hs_err_pid9682.log
Phoning home...
Using server: 10.161.186.18, port 4711
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
Java Result: 134
Run Code:
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Ellipse;
import javafx.scene.text.Text;
import javafx.stage.Popup;
import javafx.stage.Stage;
import javafx.util.Duration;
public class MenuButtonApp extends Application {
private Stage stageLocal;
private CheckBox checkBox = new CheckBox();
final private Timeline tl = new Timeline();
private Popup p1;
private Button parentButton;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
this.stageLocal = stage;
p1 = new Popup();
checkBox.selectedProperty().addListener(new InvalidationListener() {
@Override
public void invalidated(Observable ov) {
if (checkBox.isSelected()) {
stageLocal.hide();
tl.playFromStart();
} else {
stageLocal.show();
}
}
});
KeyFrame kf1 = new KeyFrame(Duration.ZERO);
KeyFrame kf2 = new KeyFrame(Duration.millis(3000), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
System.out.println("Stage is visible now");
stage.show();
checkBox.setSelected(false);
}
});
tl.getKeyFrames().addAll(kf1, kf2);
parentButton = new Button("Parent");
parentButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
p1.show(stage, 100, 100);
}
});
checkBox.setText("Make Stage Invisible");
checkBox.setSelected(false);
p1.setAutoFix(true);
p1.setAutoHide(false);
StackPane stack = new StackPane();
Ellipse ellipse = new Ellipse(70.0F, 50.0F);
ellipse.setFill(Color.AQUAMARINE);
stack.getChildren().clear();
stack.getChildren().addAll(ellipse, new Text("Popup!!"));
p1.getContent().clear();
p1.getContent().addAll(stack);
Scene scene = new Scene(new Group(), 300, 300);
VBox vbox = new VBox(5.0F);
vbox.getChildren().clear();
vbox.getChildren().addAll(checkBox, parentButton);
((Group) scene.getRoot()).getChildren().clear();
((Group) scene.getRoot()).getChildren().addAll(vbox);
stage.setScene(scene);
stage.show();
}
}
Click Button and check the checkBox.
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x69506461, pid=9682, tid=1785752384
#
# JRE version: 7.0_06-b09
# Java VM: Java HotSpot(TM) Server VM (23.0-b21 mixed mode linux-x86 )
# Problematic frame:
# C 0x69506461
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/fx/NetBeansProjects/MenuButton/hs_err_pid9682.log
Phoning home...
Using server: 10.161.186.18, port 4711
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
Java Result: 134
Run Code:
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Ellipse;
import javafx.scene.text.Text;
import javafx.stage.Popup;
import javafx.stage.Stage;
import javafx.util.Duration;
public class MenuButtonApp extends Application {
private Stage stageLocal;
private CheckBox checkBox = new CheckBox();
final private Timeline tl = new Timeline();
private Popup p1;
private Button parentButton;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
this.stageLocal = stage;
p1 = new Popup();
checkBox.selectedProperty().addListener(new InvalidationListener() {
@Override
public void invalidated(Observable ov) {
if (checkBox.isSelected()) {
stageLocal.hide();
tl.playFromStart();
} else {
stageLocal.show();
}
}
});
KeyFrame kf1 = new KeyFrame(Duration.ZERO);
KeyFrame kf2 = new KeyFrame(Duration.millis(3000), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
System.out.println("Stage is visible now");
stage.show();
checkBox.setSelected(false);
}
});
tl.getKeyFrames().addAll(kf1, kf2);
parentButton = new Button("Parent");
parentButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
p1.show(stage, 100, 100);
}
});
checkBox.setText("Make Stage Invisible");
checkBox.setSelected(false);
p1.setAutoFix(true);
p1.setAutoHide(false);
StackPane stack = new StackPane();
Ellipse ellipse = new Ellipse(70.0F, 50.0F);
ellipse.setFill(Color.AQUAMARINE);
stack.getChildren().clear();
stack.getChildren().addAll(ellipse, new Text("Popup!!"));
p1.getContent().clear();
p1.getContent().addAll(stack);
Scene scene = new Scene(new Group(), 300, 300);
VBox vbox = new VBox(5.0F);
vbox.getChildren().clear();
vbox.getChildren().addAll(checkBox, parentButton);
((Group) scene.getRoot()).getChildren().clear();
((Group) scene.getRoot()).getChildren().addAll(vbox);
stage.setScene(scene);
stage.show();
}
}
Click Button and check the checkBox.