God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
OCPJP6
Rob Camick wrote:I don't really understand your question so I'll just point you to the section from the Swing tutorial on How to Use Lists which contains a working example of dynamically adding/removing elements from the ListModel.
Once you understand that example you should be able to customize your code.
God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
OCPJP6
Michael Dunn wrote:add the new data to ListB's model
(you may also need a custom renderer if you want to display multiple lines from a JTextArea)
if you want to change what's in ListB, set a new model
Ashish Tiwari wrote:
I am really new to Java Swing ! Could you explain me or suggest me that how should I write Custom Renderer ?
Maneesh Godbole wrote:
http://java.sun.com/docs/books/tutorial/uiswing/components/list.html#renderer
Maneesh Godbole wrote:You are welcome.
It is interesting to note that the "renderer" concept can be used with a JTable as well as JTree along with the list. Check out the tutorials whenever you get time.
God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
OCPJP6
God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
OCPJP6
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:A modal dialog will block when setVisible(true) is called on it. Otherwise, a WindowListener and its windowClosed event will work.
God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
OCPJP6
Ashish Tiwari wrote:Hi Folks,
I am new to Java Swings.I have a problem which is described as :
I have two list in Parent window (say list ListA and ListB) .ListA has few items .On Clicking the ListA's item one popup window will be displayed .In this pop-up (child) window we have a TextArea and a save button.
On clicking the Save Button the data entered into the TextArea should be displayed in ListB immediately.
I used this approach in parent window
[list] On clicking the ListA item
[/list]
In pop-up window created text area and button
On clicking button will set the textarea value to the parentwindow.setListB (May be I am wrong here )
So when I click on ListA item gui appears, I enter data and click Save ....!!!
No data display in ListB , while Again clicking the ListA item the previous entered data of ListB appears .
![]()
I want to reflect the data in ListB immediately as click on Pop-up save button .
Regards,
Alan Mehio
London, UK
God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
OCPJP6
God Gave Me Nothing I Wanted, He Gave Me Everything I Needed.
OCPJP6