use of javafx.event.ActionEvent in project Gargoyle by callakrsos.
the class DockTabPaneSkin method removeTabs.
private void removeTabs(List<? extends DockTab> removedList) {
for (final DockTab tab : removedList) {
stopCurrentAnimation(tab);
// Animate the tab removal
final TabHeaderSkin tabRegion = tabHeaderArea.getTabHeaderSkin(tab);
if (tabRegion != null) {
tabRegion.isClosing = true;
tabRegion.removeListeners(tab);
removeTabContent(tab);
// remove the menu item from the popup menu
ContextMenu popupMenu = tabHeaderArea.controlButtons.popup;
TabMenuItem tabItem = null;
if (popupMenu != null) {
for (MenuItem item : popupMenu.getItems()) {
tabItem = (TabMenuItem) item;
if (tab == tabItem.getTab()) {
break;
}
tabItem = null;
}
}
if (tabItem != null) {
tabItem.dispose();
popupMenu.getItems().remove(tabItem);
}
// end of removing menu item
EventHandler<ActionEvent> cleanup = ae -> {
tabRegion.animationState = TabAnimationState.NONE;
tabHeaderArea.removeTab(tab);
tabHeaderArea.requestLayout();
if (getSkinnable().getTabs().isEmpty()) {
tabHeaderArea.setVisible(false);
}
};
if (closeTabAnimation.get() == TabAnimation.GROW) {
tabRegion.animationState = TabAnimationState.HIDING;
Timeline closedTabTimeline = tabRegion.currentAnimation = createTimeline(tabRegion, Duration.millis(ANIMATION_SPEED), 0.0F, cleanup);
closedTabTimeline.play();
} else {
cleanup.handle(null);
}
}
}
}
use of javafx.event.ActionEvent in project jgnash by ccavanaugh.
the class ConsoleDialogController method initialize.
@FXML
void initialize() {
oldErrStream = System.err;
oldOutStream = System.out;
// Force a monospaced font
consoleArea.setFont(Font.font("Monospaced", consoleArea.getFont().getSize()));
Engine.getLogger().addHandler(logHandler);
try {
outStream = new PrintStream(new OutputStream() {
@Override
public void write(int b) {
oldOutStream.write(b);
JavaFXUtils.runLater(() -> consoleArea.appendText(String.valueOf((char) b)));
}
}, false, Charset.defaultCharset().name());
} catch (final UnsupportedEncodingException ex) {
Logger.getLogger(ConsoleDialogController.class.getName()).log(Level.SEVERE, null, ex);
}
try {
errStream = new PrintStream(new OutputStream() {
@Override
public void write(int b) {
oldErrStream.write(b);
JavaFXUtils.runLater(() -> consoleArea.appendText(String.valueOf((char) b)));
}
}, false, Charset.defaultCharset().name());
} catch (final UnsupportedEncodingException ex) {
Logger.getLogger(ConsoleDialogController.class.getName()).log(Level.SEVERE, null, ex);
}
// Plug in the new streams
System.setOut(outStream);
System.setErr(errStream);
timeline = new Timeline(new KeyFrame(Duration.millis(REFRESH_PERIOD), new EventHandler<ActionEvent>() {
private long total;
private long used;
private long oldUsed;
private static final int diff = 1;
@Override
public void handle(ActionEvent event) {
total = runtime.totalMemory() / BYTES_PER_MB;
used = total - runtime.freeMemory() / BYTES_PER_MB;
if (used < oldUsed - diff || used > oldUsed + diff) {
JavaFXUtils.runLater(() -> {
memoryUsageProgressBar.setProgress((double) used / (double) total);
memoryUsageText.setText(used + "/" + total + " MB");
});
oldUsed = used;
}
}
}));
timeline.setCycleCount(Animation.INDEFINITE);
timeline.play();
// Close with the main application
MainView.getPrimaryStage().addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, event -> handleCloseAction());
}
use of javafx.event.ActionEvent in project fxexperience2 by EricCanull.
the class RotatorControl method initialize.
/**
* Private
*/
private void initialize(String text) {
final FXMLLoader loader = new FXMLLoader();
//NOI18N
loader.setLocation(RotatorControl.class.getResource("/fxml/FXMLRotatorControl.fxml"));
loader.setController(this);
loader.setRoot(this);
try {
loader.load();
} catch (IOException ex) {
Logger.getLogger(GradientPicker.class.getName()).log(Level.SEVERE, null, ex);
}
assert rotator_label != null;
rotator_label.setText(text);
rotator_dial.setOnAction((ActionEvent event) -> {
event.consume();
});
rotator_handle.setOnAction((ActionEvent event) -> {
event.consume();
});
}
use of javafx.event.ActionEvent in project fxexperience2 by EricCanull.
the class GradientPickerStop method initialize.
private void initialize() {
final FXMLLoader loader = new FXMLLoader();
//NOI18N
loader.setLocation(GradientPickerStop.class.getResource("/fxml/FXMLGradientPickerStop.fxml"));
loader.setController(this);
loader.setRoot(this);
try {
loader.load();
} catch (IOException ex) {
Logger.getLogger(GradientPicker.class.getName()).log(Level.SEVERE, null, ex);
}
assert offset_textfield != null;
assert chip_rect != null;
//NOI18N
offset_textfield.setText("" + offset);
chip_rect.setFill(color);
gradientPicker.setSelectedStop(this);
stop_button.setOnAction((ActionEvent event) -> {
event.consume();
});
// when we detect a width change, we know node layout is resolved so we position stop in track
widthProperty().addListener((ov, oldValue, newValue) -> {
if (newValue.doubleValue() > 0) {
thumbWidth = newValue.doubleValue();
valueToPixels();
}
});
}
use of javafx.event.ActionEvent in project fxexperience2 by EricCanull.
the class DemoController method bringBackAfter.
private void bringBackAfter() {
PauseTransition pauseTransition = new PauseTransition();
pauseTransition.setDuration(Duration.seconds(1.5));
pauseTransition.play();
pauseTransition.setOnFinished((ActionEvent t) -> {
btn.setOpacity(1);
btn.autosize();
});
}
Aggregations