javafx

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 set Default CSS for all Buttons in JAVAFx

巧了我就是萌 提交于 2020-01-16 01:18:14
问题 I have over 100 Buttons in my JAVAfx application and I want to give a DEFAULT styling[given below] to all buttons in the programme. Please help ! :) -fx-background-color:#3c7fb1; -fx-text-fill: black; -fx-font-size: 14px; -fx-padding: 3 30 3 30; 回答1: Create a new CSS file. Attach the CSS file to your Scene . Put your button styles to .button {} . 回答2: It's easy to set default Style for all JavaFX Button in an application. Just give a id to the style sheet which you want to set as default for

How to include CSS files of javafx project in gradle assemble?

混江龙づ霸主 提交于 2020-01-16 01:16:33
问题 I have a javafx project including css files. I want them directly in the main java src: src/main/java/Foo.java src/main/java/Foo.css When I now use my gradle script to build a fat jar, it does not include the css files and running the jar ends up in a npe. My gradle script looks like this: apply plugin: 'java' apply plugin: 'eclipse' jar { manifest { attributes "Main-Class": "foo.Main" } from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } configurations.runtime

How to display a gallery of small picture icons in a Left-Right-Horizontal navigatable style, like in JavaScript/ JQuery

别等时光非礼了梦想. 提交于 2020-01-16 01:05:25
问题 This is usually done in JavaScript/ JQuery . I'd like an implementation in Java/ JavaFx. A bit more details: I have a gallery of pictures I'd like to list, first as small 32 * 32 , then when a user clicks on one of the 32 * 32 icons, a larger one of the clicked should appear on another pane. The problem I have is listing them horizontally so that a user could use Left-Right navigation arrows on either edge to show other new pictures not yet in view (more 32 by 32 picture icons become visible

Creating a Javafx image from a int array

人盡茶涼 提交于 2020-01-16 00:52:25
问题 I am desperately trying to create an Image from a pixel-array with integer values. Regardless of using the WritableImage or the Canvas, it is always said that the PixelFormat is BYTE_RGB or BYTE_BGRA_PRE, so that I am forced to use a byte-array. Is there any way to change the PixelFormat to <IntBuffer> or did I overlook another component that is capable of having a PixelFormat<IntBuffer> ? 回答1: You haven't described the structure of the pixel data in your int[] , but you can do something

How to stop cursor from moving to a new line in a TextArea when Enter is pressed

可紊 提交于 2020-01-16 00:39:24
问题 I have a Chat application. I'd like the cursor in the chatTextArea to get back to the position 0 of the TextArea chatTextArea . This, however, won't work: chatTextArea.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent ke) { if (ke.getCode().equals(KeyCode.ENTER)) { ChatClient.main(new String[]{"localhost", String.valueOf(4444), chatTextArea.getText()}); chatTextArea.setText(""); chatTextArea.positionCaret(0); } } }); How can I get it to work? Thank you. 回答1:

Update TreeView on custom TreeItem property change

Deadly 提交于 2020-01-15 15:57:27
问题 I have extended TreeCell and TreeItem class. MyTreeItem contains a custom property which I use inside MyTreeCell to render graphics/font etc. The problem is when I set MyTreeCell.customProperty I'm not sure how to make the TreeView/Cell redraw. For example: public class MyTreeItem extends TreeItem { Object customProperty public void setCustomProperty(Object customProperty) { this.customProperty = customProperty // how to fire a change event on the TreeView? } } Any comments on the solution or

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

How to dynamically change the height of a stage in JavaFx

风格不统一 提交于 2020-01-15 12:39:08
问题 Is it possible to create a Stage in JavaFx whose height changes dynamically? Or, in other words, is it possible to change the height of a Stage once it has been created ( stage.show() ), so that the stage morph's into its new height? 回答1: Use stage.sizeToScene() to resize the stage to whatever the current preferred size of it's root is. stage.setScene(new Scene(someContent)); stage.show(); .... stage.getScene().setRoot(someNewContent)); stage.sizeToScene(); You can also just call stage

JavaFX: BooleanBindings in bind with multiple EasyBind maps

末鹿安然 提交于 2020-01-15 12:29:27
问题 This question goes further where JavaFX: Disable multiple rows in TableView based on other TableView stops. I want to generate a more general topic, of which other people could also benefit. I also have the two tableviews. I also want to disable a row in table2 when table1 contains the same object. This is achieved with the code below: //Check if a row needs to be disabled: this is achieved with a rowfactory ObservableList<String> listOfSKUs = EasyBind.map(table1.getItems(),Product::getSKU);