javafx

How do I create a JavaFX transparent stage with shadows on only the border?

寵の児 提交于 2019-12-28 03:38:10
问题 I've read through many questions on transparency and shadows, but I don't think I've seen this specific issue addressed. I'm able to successfully create a window with both transparency and a shadow, but I can't figure out how to make the color shadow not affect the transparency color. For example, the following code creates a window with a gray transparency and a red drop shadow. However, the red color affects the transparency of the main window as well, but I only want the shadow to extend

How I can stop an animated GIF in JavaFX?

纵饮孤独 提交于 2019-12-28 03:07:11
问题 I want to use an animated GIF in my project, but I dont know how I can stop the loop animation. I mean, I want the GIF to play 1 time only. Thanks! 回答1: I haven't done GIF animation, wasn't even aware that JavaFX would have methods for starting and stopping them. If you wish to do ANY animation using images, I rather suggest you do it frame by frame yourself. This way you have full control over it and you can have more than just 256 colors in your image. I read a very good article about

Javafx 2 click and double click

自闭症网瘾萝莉.ら 提交于 2019-12-28 02:43:26
问题 I would like to know if it was possible to detect the double-click in JavaFX 2 ? and how ? I would like to make different event between a click and a double click. Thanks 回答1: Yes you can detect single, double even multiple clicks: myNode.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){ if(mouseEvent.getClickCount() == 2){ System.out.println("Double clicked"); } } } }); MouseButton

How to create a reorder-able TableView in JavaFx

戏子无情 提交于 2019-12-28 02:13:07
问题 I have a JavaFx TableView . I'd like to allow the user to click and drag to reorder the table rows. I can't seem to find any way to do this, but it seems like a pretty common thing in GUIs. 回答1: Here is some code to re-order rows in a ListView by dragging the rows. Drag the birds to re-order them. Implementation for a TableView would be somewhat similar. import javafx.application.Application; import javafx.collections.*; import javafx.geometry.*; import javafx.scene.Scene; import javafx.scene

Embedding Gecko/WebKit in Java

℡╲_俬逩灬. 提交于 2019-12-27 20:20:08
问题 I'd like to have Gecko, WebKit, or another webbrowser embedded in Java as a Swing/AWT control. I'm looking for something different than JRex or JWebPane . 回答1: You could use JxBrowser. It features a Swing/JavaFX component that wraps the Chromium engine while providing a rich API and out-of-the-box hardware-acceleration through the GPU. Unfortunately, they've dropped support for other engines (like Gecko and WebKit) since 4.0 version. Note that it's not free, except for open-source projects.

Embedding Gecko/WebKit in Java

情到浓时终转凉″ 提交于 2019-12-27 20:18:00
问题 I'd like to have Gecko, WebKit, or another webbrowser embedded in Java as a Swing/AWT control. I'm looking for something different than JRex or JWebPane . 回答1: You could use JxBrowser. It features a Swing/JavaFX component that wraps the Chromium engine while providing a rich API and out-of-the-box hardware-acceleration through the GPU. Unfortunately, they've dropped support for other engines (like Gecko and WebKit) since 4.0 version. Note that it's not free, except for open-source projects.

Embedding Gecko/WebKit in Java

给你一囗甜甜゛ 提交于 2019-12-27 20:16:31
问题 I'd like to have Gecko, WebKit, or another webbrowser embedded in Java as a Swing/AWT control. I'm looking for something different than JRex or JWebPane . 回答1: You could use JxBrowser. It features a Swing/JavaFX component that wraps the Chromium engine while providing a rich API and out-of-the-box hardware-acceleration through the GPU. Unfortunately, they've dropped support for other engines (like Gecko and WebKit) since 4.0 version. Note that it's not free, except for open-source projects.

Numeric TextField for Integers in JavaFX 8 with TextFormatter and/or UnaryOperator

帅比萌擦擦* 提交于 2019-12-27 17:40:48
问题 I am trying to create a numeric TextField for Integers by using the TextFormatter of JavaFX 8. Solution with UnaryOperator: UnaryOperator<Change> integerFilter = change -> { String input = change.getText(); if (input.matches("[0-9]*")) { return change; } return null; }; myNumericField.setTextFormatter(new TextFormatter<String>(integerFilter)); Solution with IntegerStringConverter: myNumericField.setTextFormatter(new TextFormatter<>(new IntegerStringConverter())); Both solutions have their own

javafxports how to call android native Media Player

隐身守侯 提交于 2019-12-27 15:57:53
问题 As the javafxports Media is not yet implemented I'm looking to use the Android Native MediaPlayer instead. Does anyone know how to do this. 回答1: If you have a look at the GoNative sample here (docs and code), you'll find a way to add Android native code to your JavaFX project. This is a simple example of adding android.media.MediaPlayer to a JavaFX project using the Gluon plugin. Based on a Single View project, let's add first an interface with the required audio method signatures: public

JavaBean wrapping with JavaFX Properties

眉间皱痕 提交于 2019-12-27 11:06:46
问题 I want to use JavaFX properties for UI binding, but I don't want them in my model classes (see Using javafx.beans properties in model classes). My model classes have getters and setters, and I want to create properties based on those. For example, assuming an instance bean with methods String getName() and setName(String name) , I would write SimpleStringProperty property = new SimpleStringProperty(bean, "name") expecting that property.set("Foobar") would trigger a call to bean.setName . But