Spinner in JavaFX - javafx

I created a number TextField and a spinner with JavaFX. I want that my spinner contains numbers from 1 to that number already entered in the textfield. Is that possible and how?? I need your help please .Thanks

I think it may be help to you, frist call listener on your text field and change the max value of spinner by :
UPDATE: Make your spinner like that :
IntegerSpinnerValueFactory valueFactory = new IntegerSpinnerValueFactory(0, 10);
Spinner<Integer> spinner = new Spinner<Integer>(valueFactory);
and then use this method in listener that you call on your text Field
valueFactory.setMax(Integer.parseInt(Your_Text_Field.getText());

Related

selection only works for the first Text node in a TextFlow [duplicate]

I have made a TextFlow, as I need to use multiple font-postures (I have set particular "Text" to either italic or normal). Once I display the TextFlow, it's not selectable/copyable. All I need is the TextFlow to be selectable once it's displayed in a scene, so it can be copy/paste-able.
Text example with font-posture (only one for examples sake):
Text volumeText = new Text(volume.getText());
volumeText.setFill(Color.WHITE);
volumeText.setFont(Font.font("arial", FontPosture.ITALIC, 13));
TextFlow reference = new TextFlow(
lastNameText, miscelanous1, firstNameText, miscelanous2);
reference.setLayoutX(115);
reference.setLayoutY(480);
reference.setMaxWidth(500);
control.getChildren().add(reference);
Text and TextFlow in JavaFX are not "selectable".
There is an issue open for this : Text should have API for selecting group of characters based on their position similar to the DOM's Range.
Until the issue is taken care of, your best option is to use a 3rd party control like RichTextFX.
I think I got a nasty way of doing the similar job
Text could sense the mouse enter & exit move event
We could set a signal for mouse pressed and release event. Would be nice to have this event triggered on Textflow node
extends Text class to have mouse enter event handler, when the global signal is on and mouse enters text then copy the text to some places
and also record the text place in the textflow
using sth. like
var index = textflow.getChildren().indexof(text)
record the pair of index and text
when mouse release or exit event are triggered, sort the texts selected and generate the corresponding texts into clipboard

getting modified value in vaadin combobox with button click

I have a Vaadin ComboBox, populated with some values. I want to add a new value and pass that new value to the action listener upon clicking a Button, just next to the ComboBox.
I am not getting any clue how to proceed further.
Please help me. Thanks in advance.

Flex 4 - pushing a text field's value into an array that populates a datagrid

Is this possible? I would like to be able to push a text field's value into an array on a button click, then have that array populate a data grid. I'm kind of new to flex and was wondering if someone could point me in a direction or show me how to do this.
Yes, this is very possible. Create an array and assign it as the dataProvider for your DataGrid (Make sure your array is declared to as Bindable). Then append the value of the text field to your array whenever the user clicks the button. The DataGrid should update automatically whenever your bindable array changes. Hope that helps.

Setting Record Data resets ToggleButton

I am facing a strange problem.
I have created a normal ext-gwt grid with two columns. One column displays a number and the other renders a ToggleButton. As soon as the ToggleButton gets pressed a small window appears with: 1- a textfield (to enter a number), 2- an ok button.
When the ok button is pressed the column containing the number should change it's value to the value given in the small window's textfield. This is the final picture I want to have. Easy! right?
The problem comes now. This is what is executed when the ok button is pressed in order to change the value in the column:
Integer value = new Integer(10);
Record record = store.getRecord(bean);
record.set("employeeNumber", value);
Although the value is actually changed using this code, it makes something weird. The ToggleButton remains in the "un-pressed" state whenever this code is executed. If I remove the last line, the ToggleButton functions normally again (gets pressed).
Any idea how to solve the problem of the ToggleButton?
Thank you
So you want the toggle button to change state after setting the value, right?
How do you get the toggle button into the grid?
I assume by using a custom widget renderer? In this case the render(..) method will be called more than once, returning a fresh and un-toggled button each time which will be displayed...
Maybe you could post some more code...?

How to change datagrid cell's itemRenderer dynamically

i have a simple datagrid having 2 columns named as image and place. where image column has mx.controls.Image itemRenderer and place is simple. my requirement is to change itemRenderer of image cell when it will be clicked. i means to say when user click on any image from image column than i want to show that image path in editable mode and when user edit that path then the selected cell will start displayed the updated image.
i dont know how to do this and getting depressed . please anyone help me ! :(
You don't need to change itemRenderer for that - just implement that code in your single item renderer. You can add listeners inside it and change the contents of the current cell.
I suggest when going into editable mode for your DataGrid: Also create an itemEditor for your Image column, make it an extended TextInput class. This extended TextInput class will change the data object's imageAddress/url when you are done editing ("itemEditEnd" event).
Let me know if this helps, thanks!

Resources