i have a friend list from facebook and above the list ,there is edit text box.
i able to retrieve the name from the list .
When i click on the one position from the list ,i want to show that name to the edit text,then if other name is selected ,then it added to the edit text box after first selected name and so on.
I had tried finding the way of doing this ,but could not able to get the proper answer for implementing this .
added the name to the list which is being selected by the user.
for example
below is the list and above is the edit text when i click on the list view position,the
value of that particular position to be shown in the edit text,now if other position is
clicked by the user ,in the edit text ,it will be shown as name1,name2.
if third value is selected from the list then i should be shown as name1,name2,name3
and so on.
When i am trying to add in the array list,on clicking ,it overwrite the previous value and shown only one value in the edit text.
Regards
inder
Look here, this is a beautiful solution for you to use in your code
Related
I've seen the question answered in How do I create a right click context menu in Java Swing?
and seen how I can create a menu.
However, when I associate it with the text area, it doesn't matter if it has anything written on it or not, it always shows the menu.
I use the text area to reveal how many objects I have created from a specific class (which I save in a ArrayList). What I need, is a menu that when clicking on a specific line of text, it can have the index of the object in the ArrayList and use that menu to Edit/Remove that specified object from the ArrayList.
Is that possible with a Text Area or should I use a different type of displaying component?
As an Example:
Text Area:
Object 1.
Object 2.
Object 3.
When I select , for example, Object 1 with a right click, it shows the menu with Edit and Remove. But when I dont select any of them, the menu does not show.
And when it Shows, it can access the index od the object (object 1 -> index 0, object 2 -> index 1 , etc.)
Thanks a lot for your help,
Nhekas
I use the text area to reveal how many objects I have created from a specific class
Don't use a JTextArea.
Instead I would suggest you should be using a JList. Read the section from the Swing tutorial on How to Use Lists for more information and examples.
The JList has a locationToIndex(...) method which will give you the row where the mouse was clicked. Then you can get the object from the list.
I have a java servlet application where the database is populated by selecting an entry from a dropdown list and entering the values. On another page I have the same dropdown list and also have a find button to display the values that were previously entered by selecting an entry from the dropdown list. I want to get rid of this find button and dynamically display the previously entered values on this page. I heard this can be done using ajax. Please help me out.
Since the code is too much to share I have uploaded the snapshots of both the pages.
https://www.dropbox.com/s/10qmpxzwm8sik8a/1.PNG?dl=0
Here I am entering the values in estimate by selecting the project
https://www.dropbox.com/s/w8macftnm3rez3a/2.PNG?dl=0
Here I want to get the values just by selecting the project from the drop-down without clicking the Find button
You need to be specific with your question.
If I got you right...
You can use a variable in javasceipt to hold the value that was enterd on the other page you got.
Then while using the dropdown on the other page you can retrieve the values that you store and use a simple ajax request with json data to your servelet.
Check here for examples: http://api.jquery.com/jquery.ajax/
I have a table of forms which accepts first name, last name etc. When I navigate through using the tab key and enter some text in first name, all of the text disappears and that row gets selected. I have tried almost all techniques.
Is there any way we can avoid that using coding?
If I use the mouse then it wont give that error.
Assuming an otherwise correct use of JTable, you may need to terminate the edit when focus is lost, as suggested here and here:
table.putClientProperty("terminateEditOnFocusLost", true);
I have put a question(with my answer) and one of active participant gave a brilliant answer ,here is that link: SelectBox.
I have tried,and here is the link : My Question
The answer will be more better if
By Default value of Apple and Cat(which will be selected all time) will be shown in the textbox.
Selecting any check box (except:start & stopall, whether it is single or double or triple),the corresponding checkboxes value should have to shown in the textbox,like Apple, or BallElephant or CatDogElephant.
either startall or stopall will be selected at a time.
any inputs will be appreciated.
There is the Chosen jquery plugin that looks like what you want.
Otherwise, you can make yout input field readonly and update its values with a js function when a checkbox is clicked.
i am working with j2me List.It contain many elements.I want when i select the any of them
i can use it value in my required function.e.g in my code i select a number when i select it
i press a command chat a text area is shown when i write some text there this i can get easily
but how the selected element from list how i can get it .....
<Object Of List>.getSelectedIndex();
You can maintain a Vector which have the same data as filled in List Component.
Now you can get getSelectedIndex and can retrieve object from Vector from the position to get the selected Data.