javafx-8

Tooltip: how to get mouse coordinates that triggered the tip?

给你一囗甜甜゛ 提交于 2019-12-24 13:42:26
问题 The requirement: show the coordinates of the mouseEvent that triggered the tooltip as its text. For a contextMenu, the location is stored in the contextMenuEvent, so I would listen to contextMenuRequested and update as needed. Couldn't find anything similar for a tooltip, so played a bit (see example below): at the time of showing/shown, I could query the tooltip location: for AnchorLocation.CONTENT_TOP_LEFT its x/y seems to be about the last mouse location, though slightly increased. Could

Scene Builder 2.0 not launching

风流意气都作罢 提交于 2019-12-24 13:33:49
问题 Someone seems to have had a similar issue before. On a fresh install of Windows 8.1 I've installed Netbeans, the lastest JDK, and the JavaFX Scene Builder, but the Scene Builder isn't running. Usually the issue is with the Scene Builder window not appearing/opening files, but right now I can't get it to open for a first run. No error messages, and running it from the command line doesn't return anything. The program doesn't seem to appear in the Task Manager, and there's no icon showing on

How to override installed mappings of Behavior?

孤街浪徒 提交于 2019-12-24 11:56:31
问题 In java-9 Skins made it into public scope, while Behaviors are left in the dark - nevertheless changed considerably, in now using InputMap for all input bindings. CellBehaviorBase installs mouse bindings like: InputMap.MouseMapping pressedMapping, releasedMapping; addDefaultMapping( pressedMapping = new InputMap.MouseMapping(MouseEvent.MOUSE_PRESSED, this::mousePressed), releasedMapping = new InputMap.MouseMapping(MouseEvent.MOUSE_RELEASED, this::mouseReleased), new InputMap.MouseMapping

How to import database data into combo box in javafx

瘦欲@ 提交于 2019-12-24 11:37:30
问题 Using this code I Initialized Combo box @FXML private ComboBox category; And get value using: String Category = category.getValue().toString(); And inserted value to mysql database. Now before inserting next value in category Combo box I need to import the values in the database to the drop down in Combo Box and value should be displayed in the combo box. 回答1: I recommend to read the values from the database and save it into a ObservableList, once you get all the values you can fill the

Javafx adding new tab with fxml on click

徘徊边缘 提交于 2019-12-24 08:26:54
问题 I am trying to add a new tab with fxml I am trying this code: Tab sd=new Tab("Customeradd"); sd.setContent(Source.sourceFor("","Customeradd.fxml")); tabpanel.getTabs().add(sd); and i am getting syntax error on line sd.setContent(Source.sourceFor("","Customeradd.fxml")); and tabpanel is my TabPane . Error Look Like Help Me please 回答1: Assuming you have a FXML at the same directory as the class where you will load it from, you should do something like this (if your FXML defines a TabPane):

How to remove TabPane background shadow

百般思念 提交于 2019-12-24 08:15:39
问题 I found that I can remove the background of TabPane using CSS. But how I can do this by using setStyle ? TabPane tabPane = new TabPane(); tabPane.setStyle("-fx-effect: null;"); EDIT public class clicen extends Application { @Override public void start(Stage primaryStage) { final Label label = new Label("New Connection"); label.setFont(new Font("Arial", 20)); Stage dialog = new Stage(); dialog.initModality(Modality.APPLICATION_MODAL); dialog.initOwner(primaryStage); GridPane gridPane = new

JavaFX typewriter effect for label

倖福魔咒の 提交于 2019-12-24 07:17:11
问题 i have some problem with this method. it works fine, but with one little problem. there is too little time among i call this method. so only the last String is printed on a label. but i want that the next String starting printed, only after previous String is finished. Sorry for my English(( public void some(final String s) { final Animation animation = new Transition() { { setCycleDuration(Duration.millis(2000)); } protected void interpolate(double frac) { final int length = s.length();

JavaFX bad design: Row identity in observable lists behind the TableView?

↘锁芯ラ 提交于 2019-12-24 07:16:42
问题 Suppose I am displaying very long table with TableView. Manual says, TableView is designed to visualize an unlimited number of rows of data So, since million of rows won't fit the RAM, I would introduce some caching. This means, that ObservableList#get() is allowed to return different instances for the same row index. Is this true? What about opposite? May I return the same instance for all row indices filled with different data? I noticed, that this implies some problem with row editing. At

JAVA ScheduledExecutorService only runs once when calling a Task<V>

喜夏-厌秋 提交于 2019-12-24 06:13:35
问题 When I had my logic inside a Runnable it worked fine except I could not interact with the UI Thread. So I am trying to put everything inside a class that extends Task and it works Except the task is only executed once. No errors and I get a succeeded message form the Task succeeded method. I have also tried making the task return Boolean true in the call method but that did not help. public class Main extends Application { public static void main(String[] args) { launch(args); } @Override

How to get mouse position in chart-space

家住魔仙堡 提交于 2019-12-24 05:25:55
问题 How can one obtain the mouse position on an XYChart<Number,Number> , in chart-space coordinates? Here is an example of my attempt using NumberAxis.getValueForDisplay() : public class Test extends Application { @Override public void start(Stage primaryStage) { Axis<Number> xAxis = new NumberAxis(); Axis<Number> yAxis = new NumberAxis(); XYChart<Number,Number> chart = new AreaChart<>(xAxis,yAxis); Pane root = new AnchorPane(); root.getChildren().add(chart); Scene scene = new Scene(root);