javafx-2

ChoiceBox with custom Item in a TableView

假如想象 提交于 2020-01-16 05:47:22
问题 I have a private TableView<Indicators> tableviewIndicators; with column private TableColumn<Indicators, WindowsItem> tablecolumnFrame; public static class WindowsItem { CustomInternalWindow chrt; private WindowsItem(CustomInternalWindow _chrt) { chrt = _chrt; } public String toString() { return chrt.getTitle(); } } private Indicators(String tl, WindowsItem chrt, String pne, Boolean sel) { this.tool_col = new SimpleStringProperty(tl); if (chrt == null) { this.chart_col = new

JavaFx: How to make 'Tooltip' bigger?

不问归期 提交于 2020-01-16 03:03:10
问题 I set tooltip for buttons,but it looks so small(font size),how can I make it bigger?I have tried myTooltip.setFont(new Font(20)) ,but it dosen't work,why?And how can I make the font bigger? Thank you all guys! 回答1: Set the style in a stylesheet, or directly, e. g.: tooltip.setStyle("-fx-font-size: 20"); 来源: https://stackoverflow.com/questions/32420960/javafx-how-to-make-tooltip-bigger

how to repeat a node in same scene in javafx

☆樱花仙子☆ 提交于 2020-01-15 15:40:07
问题 I want to repeat one node in scene . Is it possible ? for example I have an anchorpane and 3 panes on it . I have one button on pane(1) and I want to add it to pane(2) after some process in program ... . I want to repeat that node exactly like the old one( with same properties) 回答1: No, you cannot repeat the same node in a scene. From the Node Javadocs : A node may occur at most once anywhere in the scene graph. Specifically, a node must appear no more than once in all of the following: as

JavaFX 2 - Can´t import .css File

…衆ロ難τιáo~ 提交于 2020-01-15 11:27:09
问题 I´m currentl trying to get into JavaFX 2.0 but I can´t get .css Stylesheets to work within my application. I´ve followed the guide at http://docs.oracle.com/javafx/2/get_started/css.htm#BABBGJBI but whenever I try to import a .css file via scene.getStylesheets().add(Login.class.getResource("loginform.css").toExternalForm()); I get the following Error: Exception in Application start method Exception in thread "main" java.lang.RuntimeException: Exception in Application start method at com.sun

How do I make a class in JavaFX 2.0 a usable Node?

喜你入骨 提交于 2020-01-15 04:36:42
问题 I am new to JavaFX so please don't hesitate to explain basic concepts. I am able to create a simple GUI and I have a TabPane with two tabs in my program. My question is how do I create a class that can be used as a node? For example, tab.setContent(stuff) would add stuff to a tab , tab assuming of course that stuff is a Node . So let's say I create a class called Clock and want to add an instance of it to tab , how do I do such a thing? The clock should be a graphical object. I'm new to

JavaFX 2 ComboBox setValue() does not set CB text

老子叫甜甜 提交于 2020-01-14 12:38:46
问题 My problem is that the selected ComboBox item text is not visible on the screen after selecting it with setValue(). Here are some details: Adding items to my CB: combo.getItems().add("a"); combo.getItems().add("b"); combo.getItems().add("c"); combo.getItems().add("d"); Afterwards, when Button A is pushed: combo.setValue(null); When Button B is pushed: combo.setValue("a"); Now, if I push Button B first, "a" is shown, thats OK. After that if I push Button A, no text is shown on the ComboBox,

javafx drawing lines and text

醉酒当歌 提交于 2020-01-14 10:23:25
问题 I've got a problem with drawing lines in JavaFx. We're making an application simulating traffic - there are 16 streets, and every street has a different color dependent on traffic. There is a very simple picture: http://img546.imageshack.us/img546/9949/uliceu.jpg My first idea on how to do this was to draw streets as lines and simply change its colors. But I cant put a text on the line (I want a text with a street name). So I tried to put a line and a text on the StackPane. Then I added that

javafx drawing lines and text

徘徊边缘 提交于 2020-01-14 10:23:18
问题 I've got a problem with drawing lines in JavaFx. We're making an application simulating traffic - there are 16 streets, and every street has a different color dependent on traffic. There is a very simple picture: http://img546.imageshack.us/img546/9949/uliceu.jpg My first idea on how to do this was to draw streets as lines and simply change its colors. But I cant put a text on the line (I want a text with a street name). So I tried to put a line and a text on the StackPane. Then I added that

TimerTask can't update the JavaFX Label text

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-14 01:34:09
问题 I have a fairly simple JavaFX GUI application which has an label that shows how much time is left until a certain action starts. To achieve this, I've created a DownloadTimer class as shown below: public class DownloadTimer(){ private int minutes; private int seconds; private Timer innerTimer = new Timer(); private TimerTask innerTask; private boolean isActive; public DownloadTimer(int minutes, int seconds) { if (seconds > 60) { int minToAdd = seconds / 60; this.minutes = minutes; this

How to work with canvas and text in javafx

两盒软妹~` 提交于 2020-01-13 06:34:28
问题 I am new to JavaFX and I am trying to display a rational number. For example for the number 5/7 I want the program to show the following: Here is the code I've tried to use in order to get the result (but it shows nothing but a blank white pane): import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx