I have got a task to write a calculator on wicket and I have faced with some problems.
How to get button value(1,2,3...-,+,/,*) handle it(multiply or divide) and output a result to text field to user? Could you help me, please.
In swing it is really easy, e.g. new JtextField.setText("Shalom world!"); How I can do the same in wicket?
Thank you
Use a TextField, or Label, to display the calculator value. The model for the component should get an object that you update on each click of a button. A quick way to do this would be to create a member variable in your class that holds your total and use a PropertyModel to get the value of the member variable. If you are using AjaxLink, you will need to add the TextField to your target on click of each button and you need setOutputMarkupId to be true.
Related
Can some one please tell me how to use the result dialog mentioned in the
https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/predefined.html#the-result-dialog
I want to know if this is a predefined dialog and if not where exactly I should define it, any coding samples and how to display it when a button is clicked? Where do I need to put the code? Is it in properties-local.xml file?
Please help. Thank you
You can't pass the message to be shown to the result-dialog. If you just use one of those dialogs, you could define a property to override the default message.
The value of the oxf.fr.detail.submit.go.uri-xpath.*.* property is an XPath expression. If you have a static URL you want to take users to, you can set it to that URL inside single quotes, say 'http://www.orbeon.com/'.
I have a grid layout in which I want to show a pop up when the user tries to replace a component which is already present in the grid.
For e.g. the grid layout has a Label (wrapped in a DragAndDropWrapper) which is present at 0,0 position.
If the user tries to add a new component at the same position(0,0 position), then it should show a pop up (confirmation dialog box) asking the user to confirm if the user wishes the replace the existing component or not.
Now, my issue is that the current thread does not wait for the execution to complete. It keeps going ahead after showing the pop up box. Thus, there is a lot of problem in updating the UI after the input is taken from the dialog box for the user's answer.
Can someone show how to do this? Note that I need to do this in a DragAndDropHandler's drop method call as I need to show the dialog box only when the user tries to drop a new component on an existing component of the grid layout.
A working example would be a great help.
Thanks in advance.
So I followed the comment by André Schild and it did work for me.
I just remember which component and location was used for replacing the component. Then, I ask for a confirmation and if the user says Yes, then I just go ahead and replace it.
Thanks again Andre
I am new in Android app development and using Java language.
My problem is every time I make a TextView or Button there is a triangle with the exclamation mark below them.
and when I click it I saw a message saying:
hardcoded string “Button”, should use #string resource
I have two activities, in my main activity there is a Button that when you click it you will go in second activity.
But when I go to my main.java to make a code for the button. There's always the above shown error. I think the eclipse can't find the id of my button and same for my TextView they have same error message.
Here is the code I made:
Button b = FindViewById(R.id.button1);
I also add:
Button b = (Button) FindViewById(R.id.button1);
I am using the latest eclipse classic and ADT august issue. The platform is Android 4.1 API 16.
You shouldn't hardcode the "text" on the widgets use the strings resources ie., strings in the strings.xml to set the text. Declare the "text" you want to display as a string in strings.xml and access it using #string/your_string_name in the layout file.
Notice the id of the button, which is rounded in red. You have to use this id when you want to call it in a method, for an example
Button b = (Button) FindViewById(R.id.button1);
Furthermore, check whether your graphical layout matches with the image I have provided.
Just try your code again with these changes.
Your main.java would look like this.
I am a newbie too, but I believe I got this. So basically what's happening here, java wants you to put your hardcodes in string.xml. so that when accessing it, you will use the given methods below before:
.
But this is how it should be.
Let's start by string.xml
Then come back to your activity_main.xml
I'm working with the rich:pickList and it's working fine. I just need to find a way to disable the remove button at the moment I select an item located in the target list.
I suppose it could be done with JavaScript or JQuery but I have no experience with that.
The most I've done is to get the text of the selected item of the target list, but I would like to obtain the entire object represented by that item. Besides, I have looked for the button in the DOM tree but the button has no id, so I can't figure out how to find the button in order to can give it the right style class to disable it, and how to do this!
Try setting the attribute of rich:pickList removeVisible. This will display/undisplayed the remove button in the component.
Hope this helps.
-cheers
I want to design one form that contains TextField and ListView in J2ME. But I don't know how to create this form. It is looked like Dictionary Form. Could anybody help me to do that?
You can't really do that with the basic UI controls in MIDP.
List can't contain TextField.
I would suggest looking at LWUIT since it has better controls.
Otherwise, if you don't need to display Images in your List, then you can use a Form containing both TextField and StringItem. Unfortunately, an ItemStateListener added to the Form will probably not give you as much information as a List.
Implementing the list yourself in a CustomItem means writing quite a bit of code but is doable.
If what you need is a TextField where you enter a search String and a List that displays the search result, I suggest using a TextBox first, then a List. Separate screens are by far the quickest solution here.
Edit: you can't use swing in j2me. what you can do is have just a textfield in a form, then add/remove StringItems to/from the Form when the user changes the content of the TextField. You should be able to rely on ItemStateListener to tell you when the textfield content changes.