javafx-2

How to get label.getWidth() in javafx

不羁岁月 提交于 2019-12-30 04:59:28
问题 always when i try to get the width of an Array in Java it just returns 0 and i dont know why. Can somebody explain to me how it is done right? Label label = new Label(); label.setFont(Font.font(label.getFont().getFamily(), 8)); label.setText("" + a[i][j].getList().getFirst().getLength() + " mal " + intToColor(a[i][j].getList().getFirst() .getColor())); label.relocate((x1 + x2) / 2 - label.getWidth() / 2, (y1 + y2) / 2); label.idProperty().set("trackName"); label.setTextFill(Color.web("GREEN")

How to access the Scrollbars of a ScrollPane

狂风中的少年 提交于 2019-12-30 03:29:04
问题 I'm trying to get some information about the ScrollBar components that are by standard included in a ScrollPane . Especially i'm interested in reading the height of the horizontal Scrollbar . How can i reference it? 回答1: Since the mentioned methods did not work for everybody (including me), I investigated it a bit more and found the source of the problem. In general, both methods work, but only as soon as the ScrollPane's skin property has been set. In my case, skin was still null after

Javafx combobox styling

烈酒焚心 提交于 2019-12-30 01:24:07
问题 I need a combobox in javaFX whose popup behavior can be controlled, like upon clicking the combobox, instead of default behavior where it shows a drop down, i want the drop down to be shown above the combobox (insetad of display below the combobox) . Is it possible ? Can we do this with css ? Thanks for any help. 回答1: I hope this will work for you. Make some changes according your need .combo-box .list-cell { -fx-background: white; -fx-background-color: transparent; -fx-text-fill: -fx-text

In JavaFX, should I use CSS or setter methods to change properties on my UI Nodes? [closed]

匆匆过客 提交于 2019-12-30 00:41:07
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . There are two ways to set properties on my UI nodes (labels, buttons, etc.) I could use something like this: Button b = new Button("Sample"); b.setTextFill( Paint.valueOf("red") ); b.setTextAlignment( TextAlignment.CENTER ); Or I could do something equivalent: Button b = new

JavaFX 2 vs Swing for a pure Windows desktop app

让人想犯罪 __ 提交于 2019-12-29 18:54:46
问题 I need to write a desktop app and its been a while since I started used Swing so will have a learning curve with either technology. Are there any advantages in doing my app using JavaFX 2? 回答1: 4 Years back I was having the same question and came to the conclusion that I would be best of using Swing since a lot of third party libraries were still written for Swing in those days. Also 1.0 releases from Sun were usually a bit rough around the edges (I burned myself on JSF 1.0 and JPA 1.0 :-).

javafx animation looping

扶醉桌前 提交于 2019-12-29 09:23:11
问题 in c++ or c programming language, we know to change the cordinate we use gotoxy(x,y) and we can use looping and sleep to change the cordinate and making animation. like this; for(x = 20; x < 25; x++){ gotoxy(x,20); cout << "*" } but my queston is how about in JAVAFX 2.0 programming? i'm using netbeans 7.2. thanks for your any help. 回答1: Have look at using a Timeline Animation. It is a key component of animation in JavaFX and is used to establish when, and in what sequence, key parts of an

How to hide the down arrow button on a combobox in javafx?

为君一笑 提交于 2019-12-29 07:55:20
问题 I have an editable ComboBox and I wish to "hide" the down arrow button so that it looks like a normal textbox. 回答1: Use css as, .combo-box .arrow, .combo-box .arrow-button{ -fx-background-color: transparent; } Sample code:: public class ComboboxSample extends Application { public static void main(String[] args) { launch(args); } final Button button = new Button("Send"); final Label notification = new Label(); final TextField subject = new TextField(""); final TextArea text = new TextArea("");

How to wrap a swing component in a javaFX 2.0 application

徘徊边缘 提交于 2019-12-29 07:34:29
问题 The ability to wrap a swing component in a javaFX application seems to have vanished from javaFX 2: javafx.ext.swing.SwingComponent is not there any more in javaFX 2 beta API. Is there still a way to do this in the new API? 回答1: SwingNode class is used to embed a Swing content into a JavaFX application. Here is the link. 回答2: There is 3rd-party support library, see http://rkennke.wordpress.com/2011/11/16/swing-in-javafx-demo/ 回答3: According to this issue on the FX 2.0 JIRA they aren't

javafx transparent window background with decorations

青春壹個敷衍的年華 提交于 2019-12-29 07:12:10
问题 I'm having a hard time figuring out how to make a transparent background for an application window in javafx. scene.setFill(null) seems to only work with stage.initStyle(StageStyle.TRANSPARENT) . Doc for setFill says Both a null value meaning paint no background and a Paint with transparency are supported, but what is painted behind it will depend on the platform. but that doesn't make sense to me. It works (on windows 8) only with StageStyle.TRANSPARENT which removes the exit button and such

JAVAFX Text Area is not showing formatted output of the string

[亡魂溺海] 提交于 2019-12-29 07:11:49
问题 Here scenario is program reads output properly and it is also printing properly in the log file but when displying same output on JAVAFX text area its format is getting changed(Its in tabular format) and its not displaying properly. Below is the output getting written in log file: ****************PR Deploy Summary Report Start**************** Folder Server Type Failed 010_StyleSheets 10.5.50.195 SS 0 010_StyleSheets 10.5.50.195 WS 0 020_XSL 10.5.50.195 SS 0 030_XSLT 10.5.50.195 SS 0 040