javafx-8

JavaFX Displaying properties in controls

拟墨画扇 提交于 2019-12-23 10:15:08
问题 I'm working through myself Oracle's JavaFX tutorials. After doing Swing for many years (a long time ago) I'm fascinated by the new smart features, incl. properties. I was surprised to see that these examples (e.g: https://docs.oracle.com/javafx/2/ui_controls/table-view.htm) don't use them in a way what I believe to be "proper". The example creates a Person class with properties as fields: public static class Person { private final SimpleStringProperty firstName; ... But the getters are not

How to set only a top padding in JavaFX

给你一囗甜甜゛ 提交于 2019-12-23 10:10:57
问题 I want to specify only one (or several) values for a padding using CSS in JavaFX. I've read the documentation here http://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html#typesize but I can either specify a value for all four side of padding, or a value for each one. Is it not possible to specify, for example, my top padding and let the rest be inherited? Same goes for borders.. 回答1: You will have to CSS like so yourObject.setStyle("-fx-padding: 10 0 0 0;"); This will

JavaFX Self-Contained Application Packaging for Mac without JRE

戏子无情 提交于 2019-12-23 05:39:12
问题 I have a JavaFX 8 desktop application and I'm creating an .app application bundle to distribute the application to Mac users. To keep the size down, I create a bundle that doesn't contain the JRE (the user must have Java already installed to use the generated bundle). My build is a Gradle script but since the Oracle “Self-Contained Application Packaging” tool works with Ant, I make a call out to an Ant script as follows: ant.importBuild 'mac-bundle-ant.xml' The Ant script itself then looks

Display Sales information in TreeTableView

廉价感情. 提交于 2019-12-23 05:31:31
问题 What I want to achieve is more or less having Sale object which when expanded to display SaleTransaction objects under that Sale object. Similar to want is displayed in this image from Code Project where i can also do other CRUD functionality apart from just read(i.e Create, Update and delete). I tried implementing it using TreeTableView like so: List<CreditSale> lstData = new ArrayList<CreditSale>(creditsaleservice.findAllCreditSales()); TreeItem root = new TreeItem<>(); for

Access and change of the value of a css pseudoclass via code in JavaFX 8

微笑、不失礼 提交于 2019-12-23 05:12:32
问题 Is it possible to access css pseudo-classes such as .text-area *.text {} and more importantly change values of them via code? textArea.setStyle() does not seem to be applicable in this case. To describe the problem: I'm trying to change the text-alignment of an TextArea on a button click. I know it's possible to change the alignment via .text-area *.text { -fx-text-alignment: center; } but how can i bind that to a button click? 回答1: Note that there are no pseudoclasses used in the CSS

Rotate object around center in Javafx

回眸只為那壹抹淺笑 提交于 2019-12-23 04:45:26
问题 My application read obj file using interactive mesh library and save it it in meshview. What I want is to rotate the object around its center. Right now my code displays the object but when I rotate it, it is rotated around some point which cause the object to go outside the window. I rather want to rotate the object around its center. I know I have to translate object to origin then rotate then translate again, but I don't know how to do. This is my code: public class JavaFx3DObj extends

How can I cancel a Task after a timeout?

梦想与她 提交于 2019-12-23 04:27:07
问题 I have some Task execute a I/O blocking operation that can hang (fetching a file from an URL ) task = new Task<List<WSDLOperation>>() { @Override protected List<WSDLOperation> call() { List<WSDLOperation> services = new ArrayList<>(); try { services = WSDLService.createService(wsdlURL).getOperations(); } catch (Exception ex) { LOG.log(Level.WARNING, "Can't reach {0}", wsdlURL); } return services; } }; } The method createService can wait forever without throwing any Exception . (I execute the

How to give TableColumns a relative width in FXML?

依然范特西╮ 提交于 2019-12-23 01:15:18
问题 Is it possible to get a resizing TableView in FXML, where each columns resizes itself relatively? I know it's possible in code, but I'm specifically looking for an FXML approach. This is the current approach: <BorderPane xmlns:fx="http://javafx.com/fxml"> <fx:define> <Double fx:id="tableViewWidth" fx:value="600"/> </fx:define> <center> <TableView fx:id="expensesTableView" editable="true" prefWidth="${tableViewWidth}"> <columnResizePolicy> <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />

How to set tab name size in JavaFX

孤人 提交于 2019-12-22 13:54:03
问题 I have this simple tabs example: primaryStage.setTitle("Tabs Test"); Group root = new Group(); Scene scene = new Scene(root, 600, 500, Color.WHITE); TabPane tabPane = new TabPane(); BorderPane mainPane = new BorderPane(); //Create Tabs Tab tabA = new Tab(); tabA.setText("Main Component"); tabA.setClosable(false); // da se mahne opciqta da se zatvarq tab //Add something in Tab StackPane tabA_stack = new StackPane(); tabA_stack.setAlignment(Pos.CENTER); tabA_stack.getChildren().add(accordion);

JavaFx scenebuilder and Maven Integration

这一生的挚爱 提交于 2019-12-22 13:52:27
问题 I have created a JavaFx8 Maven project in eclipse. I have put my fxml files in /src/main/resources/fxml/. I am able to the load the fxml from the java files using FxmlLoader. But, I'm not able to pick the controller class from Fxml file using Scenebuilder. What should I do to be able to see the controller class automatically in the Scenebuilder tool ? I have found a similar question, but the answer wasnt clear. I wasnt able to login to the jira case. Tell JavaFX Scene Builder where to look