I have a text box with a valuechange handler :
#UiHandler("box")
public void box_onValueChange(ValueChangeEvent<String> event) {
window.alert("allright");
}
It works great if i lose focus by clicking elsewhere. Except when i click on a button.
Is there a trick i didn't see ? Should i hack my onclick event to fire the valuechangeevent anyway ?
Thanks
Related
I wrote this code to disable using another button by clicking this button in Java/Android Studio but it is not working.
public void btnPowerCheck_onClick(View v) {
SendMessage("43");
Button ButtonBtnPowerCheck = findViewById(R.id.btnPowerCheck);
ButtonBtnPowerCheck.setEnabled(false);
}
Thanks for response, It was my problem, I entered tags and ids wrong
I Created a button on my codename one frm but when I click on the button it does not perform the Action Event. I tried removing the Button and to recreate but it does not work.
Using something like:
Button b = new Button("My Button");
myForm.add(b);
b.addActionListner(e -> {
ToastBar.showInfoMessage("Hi There");
});
Works for me.
So I'm trying to make a kind of Wheel of Fortune game or Hangman. I have 33 buttons which represent the alphabet, 1 button = 1 letter. When a user presses one, it has to 'dissapear' (become disable and invisible). I created all the buttons in the SceneBuilder so they are located in the FXML file.
How do I actually do that? I created this method for the first button. But it doesn't work properly, no matter what button I press the first one dissapear. Is there an easier way to do it wIthout writing 33 different methods for each button?
public void letterChosen (ActionEvent evt) {
b1.setDisable(true);
b1.setVisible(false);
The Button that was clicked is available as the source of the ActionEvent.
Additionally userData could be attached to the Button, in case you cannot get the necessary information to handle the button click from other properties of the Button:
public void letterChosen(ActionEvent event) {
Button source = (Button) event.getSource();
source.setVisible(false);
System.out.println("pick: "+source.getUserData());
}
FXML
<Button onAction="#letterChosen" userData="a" text="A"/>
<Button onAction="#letterChosen" userData="b" text="B"/>
Note that it isn't necessary to disable a Node that isn't shown, since a Node that is not visible cannot be interacted with. a disabled Button will appear "faded" by default, but could also be shown differently, e.g. using CSS.
My button on zul file using MVVM.
<button id="ok" label="OK" onClick="#command('vm.myCommand')"/>
my vm
#Command
public void myCommand(){
System.out.println('my command clicked');
}
It display twice when I double click on my button. How to prevent this?
use autodisable attribute of button please have a look below code.
<zk>
<button id="ok" label="OK" autodisable="self" />
</zk>
You can run this code in zk Fiddle .When you click on button it automatically disable itself and when action is done it enable again.
Not related to your concrete problem but ZK Progree Bar another option to prevent user click after any action performed by user.
I am implementing an editor in Swing. It shows plain text with hyperlinks. The problem statement is that when a user clicks on a hyperlink, a popup menu must appear at the mouse position or just below the hyperlink text. User can select the option from the menu and the text of hyperlink will be updated to the text in the option user selected. Moreover, after selecting the option, the menu disappears.
I am trying it on both jTextPane and jEditor pane. I used hyperlinkUpdate listener to display popup menu, but it always appears at the top left corner of the GUI.
Moreover, I could not find how to update the text of the hyperlink.
Here is the code of hyperlinkUpdate event:
private void jEditorPane1HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {
if(evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED){
System.out.println(evt.getDescription());
jPopupMenu1.setAlignmentX(jEditorPane1.getMousePosition().x);
jPopupMenu1.setAlignmentY(jEditorPane1.getMousePosition().y);
jPopupMenu1.setVisible(true);
}
}
Someone kindly guide me in this matter.
Thanks in advance.
The call should be like this
JPopupMenu popup = new JPopupMenu();
popup.add("Item 1");
popup.add("Item 2");
popup.show(mouseEvent.getComponent(),mouseEvent.getX(),mouseEvent.getY());
See an example here
http://www.experts-exchange.com/Programming/Languages/Java/Q_20143329.html