javafx-2

Controller returning null in javafx helloworld

时间秒杀一切 提交于 2019-12-24 13:18:40
问题 So of course I dive straight in to creating a simple example. public class Main extends Application { URL bla = getClass().getResource("/sample.fxml"); @Override public void start(Stage primaryStage) throws Exception{ //If you get weird errors: http://zenjava.com/javafx/maven/fix-classpath.html //but not actually my issue. Example displays fine in intellij. try { FXMLLoader loader = new FXMLLoader(bla); Parent root = loader.load(bla); primaryStage.setTitle("Hello World"); primaryStage

JavaFX 2.2 WebView

孤街醉人 提交于 2019-12-24 12:51:10
问题 I am using Javafx and FXML . I have created my form . in one of my pages I have a Tree in the left pane (Split Pane) , and the right pain is a Webview inside the right Anchor pane. when I select a node on the tree (treeItem) the webview will change accordingly to the respective site that was selected in the tree view. This works (like a charm)when I run it as an application. HOWEVER , when viewing this in the browser (i.e. chrome , firefox and safari(mac)) i dont see the web view , it stays

JavaFx: After dialog, two textfields gains focus instead one

天涯浪子 提交于 2019-12-24 11:54:20
问题 following issue: The instruction in the changeListener leads to the behavior that two TextFields gets Focus after a Dialog. When Postleitzahl loses focus it open a dialog. If you click OK, just first textfield have to gain the focus . But what really happen is that the textfield below gains focus too. The method "controlMinChar" sets the minimum amount of numbers. The method setMinCharacter uses the method and uses the focusedProperty private void setMinCharacter(){ plz.focusedProperty()

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

Add a label on top of an imageview that is on a TilePane

狂风中的少年 提交于 2019-12-24 10:58:15
问题 I was making an app that allows users to create custom shops from a game graphically but I was having troubles as I wanted to add a label which shows how much of an item is in a shop but since the imageview is already on a Tile pane, it creates a label beside it but I wanted to create a label on top of it. 回答1: You could make your items labels and apply the images as graphic nodes to the labels. When the items are selected, you can invoke label.setText("text string") on the label to change

How to do per-keystroke validation of TextFieldTableCell?

不羁岁月 提交于 2019-12-24 10:52:01
问题 I am trying to do per-keystroke validation in a JavaFX TextFieldTableCell but I do not know how to capture the text-changed events from the embedded TextField control. If the object in question were simply a TextField , then textField.textProperty().addListener(myChangeListener) would do the trick. TextFieldTableCell also exposes textProperty() , but this property behaves quite differently on TextFieldTableCell . It does not generate change events on a per-keystroke basis. Rather, I see lots

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

Unable to run JavaFx Jar with JRE7

心不动则不痛 提交于 2019-12-24 07:58:24
问题 I am trying to run JavaFx Jar with reference of JRE but it is showing error message and throwing this IOException - C:\Users\JavaUser4\Desktop\New folder (2)>"C:\Program Files\Java\jre7\bin\java.e xe" -jar ABCTemp.jar java.io.IOException: The filename, directory name, or volume label syntax is inc orrect at java.io.WinNTFileSystem.canonicalize0(Native Method) at java.io.Win32FileSystem.canonicalize(Unknown Source) at java.io.File.getCanonicalPath(Unknown Source) at java.io.File

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();