javafx-8

toFront() throwing UnsupportedOperationException

眉间皱痕 提交于 2019-12-11 13:03:57
问题 I want to create a StackPane where, whatever is added, a node of my choice is always at the front (rather than having to be careful about the order I add things in, or remembering to call toFront() on that particular node whenever anything is added.) In order to do this, I simply place a listener on the child list of the relevant StackPane object, so that whenever anything changes, it calls toFront() on the relevant node, for example: public class Test extends Application { @Override public

LoadException: Root value already specified on custom control

旧城冷巷雨未停 提交于 2019-12-11 12:59:08
问题 Example below causes javafx.fxml.LoadException: Root value already specified. The code is written according to example here: http://docs.oracle.com/javafx/2/fxml_get_started/custom_control.htm Code: public class NavigationView extends ButtonBar { private static final String defaultTemplate = "/fxml/navigator.fxml"; public NavigationView() { this(null); } public NavigationView(URL resource) { //FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("custom_control.fxml")); if( resource

Set Printer PageLayout margin to zero

不打扰是莪最后的温柔 提交于 2019-12-11 12:51:59
问题 I created a small Javafx application that allows the user to print a node. I want the margin to be zero. I used the following code below, but it didn't work. printer = javafx.print.Printer.getDefaultPrinter(); pageLayout = printer.createPageLayout(Paper.JAPANESE_POSTCARD, PageOrientation.PORTRAIT, 0.0f, 0.0f, 0.0f, 0.0f); According to the documentation, the last four parameters in createPageLayout is the margins(Left,Right,Top,Bottom). I made a print-test but there still a 0.5 inch margin in

no error then why ObservableList is not working in this project?

蓝咒 提交于 2019-12-11 12:39:41
问题 i saw this project in previous answer and I tried to run it but it didn't how to pass data from parsed text file and insert the values to ObservableList in javafx? data inputted from text file to table view and then piechart JAVAFX, everything was work except the pie chart I am trying to get data from table view to pie chart, i have done after few edits I can't run it anymore the problem in ObservableList pieChartData = FXCollections .observableArrayList() this is the code package show;

position of TableColumn in Scene

眉间皱痕 提交于 2019-12-11 12:28:53
问题 I have a TableView with several TableColumns and I want to place a Node below a certain TableColumn. How do I get the exact position (x,y-coordinates) of the TableColumn so I can bind the translate properties of my node? Here is a snippet of how I placed a button on the top right corner of my TableView: button.translateXProperty().unbind(); button.translateXProperty().bind(tableView.widthProperty().divide(2.0).subtract(button.getWidth() / 2.0 + 2.0) + tableView.localToScene(0.0, 0.0).getX());

JavaFX TreeTable select children when parent is selected and remove selection from parent

让人想犯罪 __ 提交于 2019-12-11 12:23:11
问题 I have a TreeTable which has maximum depth of 2, e.g. fooType -foo -foo If I select fooType I want the program to select automatically all child-items AND deselect the parent item. But when I try this, I always get an IndexOutOfBoundsException. myTreeTable.getSelectionModel().selectedItemProperty().addListener((obs, ov, nv) -> { if (nv.getValue() instanceof fooType) { myTreeTable.getSelectionModel().clearSelection(myTreeTable.getSelectionModel().getSelectedIndex()); if (!nv.isExpanded()) { nv

Invoke a ComboBox's enter key/action event handler regardless of value property change

谁说胖子不能爱 提交于 2019-12-11 11:46:01
问题 With an editable ComboBox, is there any way to have the ENTER key event or action event handler occur regardless of whether or not the Combobox 's value property has changed? I essentially would like to have the same behaviour in a ComboBox 's TextField on pressing the ENTER key as it occurs for a TextField . What I Have Tried My initial thought was to simply use setOnAction for a ComboBox ; however, according to the documentation for it: The ComboBox action, which is invoked whenever the

OnKeyPressed event not triggered on TableRow in TableView Javafx8

谁都会走 提交于 2019-12-11 11:32:04
问题 I'm trying to have a KeyEvent handler on a TableRow of TableView, but the handler doesn't get called. I'm aware that a handler can be registered on the TableView and use the selectionmodel/ focus model to get the slected or focussed item but i want to register a key event on row for a specific use case. The documentation of onKeyPressed event says, Defines a function to be called when this Node or its child Node has input focus and a key has been pressed. The function is called only if the

Setting LineChart plot-area width

懵懂的女人 提交于 2019-12-11 11:28:17
问题 I am trying to code a class named MultipleAxisLineChart . As its name says - it will be a LineChart which will have multiple axis (I assume that all additional axes will be placed either on Side.LEFT or Side.RIGHT ). All axes on given side will be positioned by tickLabelGapProperty . Right axes should be additionaly x-translated by the sum of left side axes' width. The problem arised when I came to the moment of computing the preferred chart width (given my previous assumptions the charts

Get the treeCell Implementation using the treeItem in JavaFX

╄→尐↘猪︶ㄣ 提交于 2019-12-11 11:18:04
问题 I am implementing drag and drag between two tree views. When a treeItem is dropped onto another treeView of treeItem a line connection is established between the two treeItems. This is working fine , but to have a connection initially without a drag and drop events is problem to me. I am using treeCell for the drag and drop events. 回答1: As I thought, this turns out to be pretty difficult. There is, by design, no way to get the TreeCell belonging to a given TreeItem . This is because of the