javafx-2

How to know if a scroll bar is visible on a JavaFx TableView

╄→гoц情女王★ 提交于 2019-12-23 12:33:57
问题 Is there a way to know if a scroll bar is present on a table view? (Other than what I did in my code below) My goal is to position 2 arrow images (to close/open a side panel) on the right side of a table (over the table.). But I don't want to put them over the scroll bar. The table content is a result of a search, so sometime the scroll bar is visible and other time it is not. If there is not enough items. I want the position of my arrows to change every time the tableview items change. I

How to disable the reordering of table columns in tableView?

对着背影说爱祢 提交于 2019-12-23 10:56:27
问题 Trying to figure out on how can i disable the reordering of table columns in javafx 2? 回答1: Here's the solution: tblView.getColumns().addListener(new ListChangeListener() { @Override public void onChanged(Change change) { change.next(); if(change.wasReplaced()) { tblView.getColumns().clear(); tblView.getColumns().addAll(column1,column2...); } } }); 回答2: After much waste of time, I've found the following, very simple, solution: TableHeaderRow header = (TableHeaderRow) myTableView.lookup(

How to disable the reordering of table columns in tableView?

流过昼夜 提交于 2019-12-23 10:55:06
问题 Trying to figure out on how can i disable the reordering of table columns in javafx 2? 回答1: Here's the solution: tblView.getColumns().addListener(new ListChangeListener() { @Override public void onChanged(Change change) { change.next(); if(change.wasReplaced()) { tblView.getColumns().clear(); tblView.getColumns().addAll(column1,column2...); } } }); 回答2: After much waste of time, I've found the following, very simple, solution: TableHeaderRow header = (TableHeaderRow) myTableView.lookup(

JavaFX - Adding nodes to ScrollPane with correct scrolling direction

女生的网名这么多〃 提交于 2019-12-23 10:12:33
问题 I have a ScrollPane in my scene and would like to add a series of Nodes to it. The exact amount must be dynamic. I've been testing the concept with Label nodes and can successfully add as many Labels as I want to the content of the ScrollPane (currently a VBox). My problem is figuring out how to allow the user to scroll normally through the ScrollPane full of Nodes. The content matches pace with the scrollbar; that is, when I scroll down, the content moves down. I scroll up, the content

Setting TableView generic type from FXML?

℡╲_俬逩灬. 提交于 2019-12-23 09:59:44
问题 The TableView class of JavaFX 2.2 has a generic type S , I am wondering how one can set this from FXML? 回答1: The same happens to a ListView or ComboBox. But I think that in the FXML file you are defining the controls and you are defining a generic ListView or a ComboBox or TableView or whatever. No matter what they are going to show. So to me it makes more sense to set the generic type in the JavaFX controller class, instead of in the FXML file. Hope it helps. 回答2: FXML is dynamically loaded

Create solid separator

强颜欢笑 提交于 2019-12-23 09:59:26
问题 I have looked around quite a bit and cannot find the solution. I am adding a separator in SceneBuilder . This is easy. Now I want this separator to be a solid line. This I am having issues with. I have tried : -fx-border-style: solid; -fx-border-width: 1px; But this doesn't seem to work or any combination of this. 回答1: i think you missed line part in below css .separator *.line { -fx-border-style: solid; -fx-border-width: 1px; } with boarder width 5px Tip : use CSS Analayzer to know css class

javafx & fxml: how do I apply a border to a pane or label in my gui?

纵然是瞬间 提交于 2019-12-23 09:15:56
问题 I'm just getting into using fxml and it seems like a really cool idea, except for the fact that I'm having a tough time getting it to work. Supposedly I'm able to lay out my GUI using a nice markup language, and I can style the elements via CSS. So I have a label on my GUI, and I would like there to be a solid black border around it, with width=1. Seems like this should be straightforward -- adapting examples I see here and there in tutorials, etc., I do the following: <Label text="sample

How to change JavaFx native Bundle exe icon

蓝咒 提交于 2019-12-23 09:09:44
问题 I am trying to chance the icon of the exe file created native bundling of javafx packaging but it still contains the default icon. Please suggest primaryStage.getIcons().add(FileUtility.loadImage("icon.png")); did not help, it only changes the title bar and task bar icon. The ico file still gets generated and icon of the exe files remains the default one I also tried to assign an icon in the project properties-> Deployment-> icon but did not help 回答1: I believe I have encountered the same

JavaFX TextArea: how to set tabulation width

北城以北 提交于 2019-12-23 08:53:53
问题 How do I set tab width of JavaFX TextArea ? When I use tabulation (tab key) in TextArea, the width of the tabulation is wide. I want to control the width, i.e., use 4 spaces. In the documentation I could not find a method to do this. I tried this code (where taInput is a TextArea), but it is not working as it should: taInput.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent e) { if (e.getCode() == KeyCode.TAB) { // TAB SPACES StringBuilder sb = new

JavaFX TextArea: how to set tabulation width

十年热恋 提交于 2019-12-23 08:52:10
问题 How do I set tab width of JavaFX TextArea ? When I use tabulation (tab key) in TextArea, the width of the tabulation is wide. I want to control the width, i.e., use 4 spaces. In the documentation I could not find a method to do this. I tried this code (where taInput is a TextArea), but it is not working as it should: taInput.setOnKeyPressed(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent e) { if (e.getCode() == KeyCode.TAB) { // TAB SPACES StringBuilder sb = new