javafx-8

JavaFX VGrow TabPane on content change

流过昼夜 提交于 2019-12-12 03:26:02
问题 In my JavaFX application, I have a TabPane in a TitledPane . Within the TabPane is a VBox which includes a button that increases the number of elements in that VBox (and as such, the height of the VBox ). However, I seem to be unable to get the Tab / TabPane to resize when the VBox grows. (Removing the TabPane and putting the VBox in the TitledPane directly leads to proper on-the-fly sizing.) However, changing the tab makes the TabPane realize that it is too small and resize. Below is a small

Javafx TreeView Directory Listing

梦想的初衷 提交于 2019-12-12 03:24:11
问题 I'm trying to create a TreeView which displays directory contents such as: ABC BCD 123.php Where ABC and BCD are both directories. I feel like I'm missing something as the TreeView works fine before I strip out the full directory location but once I strip it, it won't display like the above. public void displayTreeView(String inputDirectoryLocation, CheckBoxTreeItem<String> mainRootItem) { // Creates the root item. CheckBoxTreeItem<String> rootItem = new CheckBoxTreeItem<>

FXML StackPane doesn't align children correctly

亡梦爱人 提交于 2019-12-12 03:06:15
问题 I want a Rectangle and a Label to align in the StackPane, however my code doesn't achieve the desired result: FXML: <fx:root type="HBox" xmlns:fx="http://javafx.com/fxml"> <StackPane fx:id="pane"> <children> <Rectangle fx:id="bubble" fill="#ffffff"></Rectangle> <Label fx:id="message" style="-fx-border-color:black; -fx-border-width: 1; -fx-border-style: solid;"></Label> </children> </StackPane> </fx:root> Controller: public class MessageBubble extends HBox implements Initializable { @FXML

JavaFX:Editable Configuration Files After Packaging

我的未来我决定 提交于 2019-12-12 02:53:16
问题 I've a JavaFX application that I packaged it using antBuild to build a single installer .exe file, my app have some configuration files that was placed in the root of the project this way i load them from the root of the project in order to they can be place beside the .jar file and could be changable: try { File base = null; try { base = new File(MainApp.class.getProtectionDomain().getCodeSource().getLocation().toURI()) .getParentFile(); } catch (URISyntaxException e) { System.exit(0); } try

Determine a JavaFX table row details when reusing tableview context menu

二次信任 提交于 2019-12-12 02:46:29
问题 I have a requirement similar to this example. In the EventHandler callback, how do I determine which row was clicked on? @Override public void handle(ActionEvent event) { // how do I get the row details when reusing context menu and handler code? } I am sharing the context menu because I have to add a CheckMenuItem who's state is "global" to the table, i.e. if its selected on any row, I want to show it as checked when I click on any other row in the table. 回答1: Use a row factory and one

javafx open a new fxml file in new tab dynamically

混江龙づ霸主 提交于 2019-12-12 02:45:06
问题 I am creating a javafx program in which i need to open a new fxml file in new tab dynamically. I want that When user click on button a new tab is opened with new fxml file . I Had no idea I can add tab as per design as much as i need but i want to do it dynamically when user click on button then only a new tab open. I had also seen Questing but not working for me. Please help me. Thank you. 回答1: You can add tabs dynamically with myTabPane.getTabs().add(myNewTab); Create a new Tab with new Tab

Javafx Tableview How To Color Cells with Specific Value

℡╲_俬逩灬. 提交于 2019-12-12 02:36:26
问题 Is there a way to color only some cells with a specific value of a TableView ? Callback<TableColumn, TableCell> historyTableCellFactory = new Callback<TableColumn, TableCell>() { public TableCell call(TableColumn p) { TableCell newCell = new TableCell<CustomerHistoryStructure, String>() { private Text newText; @Override public void updateItem(String items, boolean empty) { super.updateItem(items, empty); if (!isEmpty()) { newText = new Text(items.toString()); newText.setWrappingWidth(140);

Why does the resulting shape from Shape.intersect appear at an incorrect position?

落花浮王杯 提交于 2019-12-12 02:29:41
问题 For one of my current javafx projects I'm working with Venn Diagrams. I'd like to take advantage of Shape.intersect to ease the amount of math calculations I'd have to personally work through (and avoid working with Path objects). Shape.intersect produces a perfect shape, but it is translated / moved a bit and I can't figure out how much to put it back. Ideally, I'd like to have the intersection area occur exactly where the two original shapes intersect - i.e. the new intersection would fit

How to change Rectangles with buttons

岁酱吖の 提交于 2019-12-12 02:13:15
问题 I'm working on this example which is not working properly: public class test extends Application { private void init(Stage primaryStage) { Group root = new Group(); primaryStage.setScene(new Scene(root)); String pillButtonCss = DX57DC.class.getResource("PillButton.css").toExternalForm(); // create 3 toggle buttons and a toogle group for them ToggleButton tb1 = new ToggleButton("Left Button"); tb1.setId("pill-left"); ToggleButton tb2 = new ToggleButton("Center Button"); tb2.setId("pill-center"

pop up window removes primary node in javafx

情到浓时终转凉″ 提交于 2019-12-12 02:12:33
问题 I want to create a photo gallery in javafx using pop up window . But when I pass target image to a method to set content of a pop up window to that image primary image will be removed and pop up window will be open.Why?Please help me .Thank's ( Excuse my for my bad English!!! ) This is that snippet code . final Popup popup = new Popup(); popup.getContent().add(image); popup.setOnShown(new EventHandler<WindowEvent>(){ @Override public void handle(WindowEvent t) { image.setFitHeight(400); image