So I have created a contextMenu and disabled the default contextMenu for textFields in my application.
I am already able to open the contextMenu that I have created with a right click on the textField. My problem now is how can i edit the textField when I select a menuItem?
For example I have an "S" as content in my textField and I want to change it to an "A" with my menuItem.
It should work as if i select the textField and press "A" on the keyboard.
Related
I'm using JavaFx and have a popup window to edit / create.
When the action is to edit, I need that some fields won't be selectables nor editables, what method i can use to do it?
Note: to do no editable, I'm using:
fieldname.setEditable(false);
I have 64 buttons.
I want when click on one of Button change color other button and other Button each time diffrent from Previous.
I want make ottlo game and this part of code for offer Authorized houses.
thanks
You can create an onClick method, and set this all of your buttons.
In the onClick method, you can get all of your buttons by scene.lookup() method - you need to set styleclass for this buttons. For example: the css class is my-colored-buttons, then you can call scene.lookup(".my-colored-buttons");
Another solution is add all of yout buttons to your controller. This is not too good solution I think, hard to maintain.
#FXML
private Button btn1;
#FXML
private Button btn2;
#FXML
private Button btn3;
...
After you get all of the buttons, get current button from event variable, and change only the other buttons color. So the currently clicked button will not change.
I'm working in a Dialog in JavaFX , the user have to insert a keyword in a textfield , then have to press a buttontype that I have created like this:
ButtonType find= new ButtonType("Find");
Here my problem, the button always stays in the lower right corner of the dialog, so , I want to put where I want. In the case was a button I would solve with a Pane and SetLayoutX/SetLayoutY, but I don't know how to do with Buttontype.
I'm creating a SearchTextField that allows me to Type into a TextField, then a ListView narrows the selection on what is typed.
The ListView is not visible until you enter the TextField and is unmanaged.
The only problem I have is that any items below the TextField overlap the ListView.
Is there any way to make the ListView appear on top of anything below the TextField (Like a context menu does)?
I show context menu when user right clicks on row at TableView and select clicked item:
downloadContextMenu.popup()
tableView.selection.clear()
tableView.selection.select(row)
but TableView show selection only if I will move mouse to something else (i.e. button) after it. So, how to update TableView in this case?
downloadContextMenu is Menu
P.S. If I will do it by this:
tableView.selection.clear()
tableView.selection.select(row)
downloadContextMenu.popup()
I will have the same problem, but after next opening of context menu (open menu, then click outside to close it, then open again)