javafx-8

Display VlcJ in JavaFX using SwingNode

本小妞迷上赌 提交于 2019-12-07 12:00:30
FXMLController initialize method: @FXML private VBox vbContainer; MediaPlayerVLC m_mediaPlayer; public void initialize(URL url, ResourceBundle rb) { final SwingNode swingNode = new SwingNode(); m_mediaPlayer = new MediaPlayerVLC(); createAndSetSwingContent(swingNode, m_mediaPlayer); vbContainer.getChildren().add(0, swingNode); } And createAndSetSwingContent(): private void createAndSetSwingContent(final SwingNode swingNode, JComponent jComponent) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { swingNode.setContent(jComponent); } }); } MediaPlayerVLC class: package

TableView exclude bottom row (total) from sorting

*爱你&永不变心* 提交于 2019-12-07 11:58:35
问题 I have a simple TableView (Java FX 2.0, but I suppose the problem is fairly generic) that gets the default sorting feature. However the table has a total in its last line so I would like to exclude that last line from the sorting algorithm. I found a solution for a Swing JTable that consists in creating a separate table for the total row - that would be transposable to a TableView but it seems a bit cumbersome. I have tried implementing my own Comparator but I don't think it is possible to

JavaFX CSS class for GridPane, VBox, VBox

a 夏天 提交于 2019-12-07 11:30:12
问题 Is there a predefined CSS class for JavaFX GridPane, VBox, HBox? I can't find anything in the CSS reference, but it seems weird that default components would not have one defined. If there isn't a pre-defined class, is there a better way than to add the class manually on all grids: GridPane pane = new GridPane(); pane.getStyleClass().add("grid-pane"); 回答1: No, only Control subclasses have default css classes defined. I think this is because applications that want to manage their own graphics

Java FX Filter table view

喜你入骨 提交于 2019-12-07 10:04:01
问题 I'm trying to use a text field to filter through a table view, I want a text field (txtSearch) to search for the 'nhs number', 'first name', 'last name' and 'triage category'. I've tried implementing various solutions online and had no luck, I'm still new to all this so apologies if this was asked poorly. any help would be greatly appreciated, my code is below. public class QueueTabPageController implements Initializable { @FXML private TableView<Patient> tableView; @FXML private TableColumn

Insert text at the center of a image

泪湿孤枕 提交于 2019-12-07 08:00:42
问题 I have this code which inserts Image into the center of a borderpane: private static final ImageView iv; static { iv = new ImageView(StartPanel.class.getResource("/com/dx57dc/images/6.jpg").toExternalForm()); } bpi.setCenter(iv); And now I have this problem. I have this insert text as a label at the center of the image. Text inftx = new Text("Infrastructure"); How I can do this? 回答1: You can use a StackPane to performed the desired image overlap. The following code can be used on your example

JavaFX: Align Buttons inside ButtonBar (using SceneBuilder or fxml)

本小妞迷上赌 提交于 2019-12-07 06:44:50
问题 I have a JavaFX ButtonBar with two Buttons (created via SceneBuilder). I want one of the buttons to be left-aligned and the other right-aligned. (see screenshot) From the docs I already know how I could achieve this inside the java-source-code: ButtonBar.setButtonData(newButton, ButtonData.LEFT); BUT I want to know how to achieve this WITHOUT having to write this inside my java-files but how I can achieve this using just SceneBuilder or the corresponding fxml file . My .fxml file currently

Set image on left side of dialog

此生再无相见时 提交于 2019-12-07 06:38:31
问题 I created this very simple example for JavaFX alert dialog for JavaFX8u40. public class MainApp extends Application { public static void main(String[] args) { Application.launch(args); } private Stage stage; @Override public void start(Stage primaryStage) throws Exception { Button create = new Button("Create Alert"); create.setTooltip(new Tooltip("Create an Alert Dialog")); create.setOnAction(e -> { createAlert(); }); primaryStage.setScene(new Scene(create)); primaryStage.show(); stage =

Wrapping Label text in a VBox using FXML

。_饼干妹妹 提交于 2019-12-07 04:20:18
问题 I'm writing a JavaFX application and I'd like to create a screen that contains 2 long pieces of text. I don't know what the text is ahead of time, it will be filled in by some code at run time. To do this I thought I'd make a VBox with 2 Labels. I assume that if I don't add dimensions, the Labels will span the VBox. Since the text is long I'd like it to wrap. Here's the FXML that I tried: <VBox spacing="20" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> <children>

Why SortedList.add() throws UnsupportedOperationException?

这一生的挚爱 提交于 2019-12-07 04:18:53
问题 Very simple code: import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.collections.transformation.SortedList; public final class SortedListTest { public static void main( String[] args ) { final ObservableList<Integer> il = FXCollections.observableArrayList(); final SortedList<Integer> sil = new SortedList<>( il ); sil.comparatorProperty().set((l,r)-> l-r ); sil.add( 12 ); } } Execution: Exception in thread "main" java.lang

JavaFX: How can I use correctly a ProgressIndicator in JavaFX

家住魔仙堡 提交于 2019-12-07 04:14:23
问题 I´m newbe in JavaFX. I have a problem with my JavaFX application, I need to start my ProgressIndicator (type INDETERMINATE) before a database query. This is part of my code: spinner.setVisible(true); passCripto = cripto.criptoPass(pass); MyDao dao = new MyDaoImpl(); boolean isLoginOk = dao.isUserOk(user, passCripto); boolean isStatusOk = dao.idStatusUser(user); When finished, I need to set spinner to FALSE but the spinner only is showed when database query is finished. How can I solve this ?