Comments for Java Tips Weblog https://tips4java.wordpress.com Sun, 30 Nov 2025 19:25:41 +0000 hourly 1 http://wordpress.com/ Comment on List Editor by Anonymous https://tips4java.wordpress.com/2008/10/19/list-editor/#comment-13076 Sun, 30 Nov 2025 19:25:41 +0000 http://tips4java.wordpress.com/?p=125#comment-13076 In reply to Anonymous.

EditListAction

If you which to use a different model or different data
If you wish to use a different model or different data,

In case you’d like to “modernize” the ActionListener:
/*
* Create the popup editor
*/
private void createEditPopup()
{ ….
editTextField.addActionListener(e ->

(Typing code looks horrible, so I drop the rest.)

ListAction

By default the Enter will will be used to invoke the Action
By default the Enter key will be used to invoke the Action

from the keyboard although you can specify and KeyStroke you wish.
from the keyboard, although you can specify any KeyStroke you wish.

All the best

Jörg

]]>
Comment on List Editor by Anonymous https://tips4java.wordpress.com/2008/10/19/list-editor/#comment-13075 Sun, 30 Nov 2025 19:01:13 +0000 http://tips4java.wordpress.com/?p=125#comment-13075 In reply to Rob Camick.

Thanks for the explanation.

]]>
Comment on List Editor by Rob Camick https://tips4java.wordpress.com/2008/10/19/list-editor/#comment-13073 Sat, 29 Nov 2025 01:18:54 +0000 http://tips4java.wordpress.com/?p=125#comment-13073 In reply to Anonymous.

When creating a JList with a String array a simple anonymous inner class is used for the model and only contains getSize() and getElementAt(…) methods. There are no methods to update the model, which is why the simple implementation requires the DefaultListModel.

]]>
Comment on List Editor by Anonymous https://tips4java.wordpress.com/2008/10/19/list-editor/#comment-13072 Fri, 28 Nov 2025 23:52:54 +0000 http://tips4java.wordpress.com/?p=125#comment-13072 Hello Rob,

thanks for the code. I just tested under java 25 and found that EditListAction doesn’t work if a String array is passed to the JList constructor. Maybe that’s what you meant when writing you must use the DefaultListModel. Still I thought that if only String data will be saved I could use a String[] parameter. So I would prefer the JList creation in the example implementation code to look like JList list = new JList(myDefaultListModel); to prevent any misunderstanding.

Thanks again

Jörg

]]>
Comment on Wrap Layout by Marty Lamb https://tips4java.wordpress.com/2008/11/06/wrap-layout/#comment-13071 Tue, 10 Jun 2025 12:23:35 +0000 http://tips4java.wordpress.com/?p=194#comment-13071 It’s 2025 and this is still helping folks. It just saved me a ton of time and pulled me out of some rabbit holes where I was exploring other solutions. Thanks!

]]>
Comment on Text Prompt by Anonymous https://tips4java.wordpress.com/2009/11/29/text-prompt/#comment-13069 Sat, 29 Mar 2025 00:47:46 +0000 http://tips4java.wordpress.com/?p=1250#comment-13069 Mi mas sincero agradecimiento a quien compartió su trabajo de manera altruista, eso ya no se ve, soy un programador que esta aprendiendo el lenguaje y me ayudo MUCHISIMO, gracias de nuevo al autor

]]>
Comment on Text and New Lines by vaxacex https://tips4java.wordpress.com/2009/02/07/text-and-new-lines/#comment-13068 Fri, 21 Mar 2025 11:50:15 +0000 http://tips4java.wordpress.com/?p=529#comment-13068 Thank you, man! After 16 years, I found this article and saved myself thousands of headaches and hours

]]>
Comment on Wrap Layout by Anthony K https://tips4java.wordpress.com/2008/11/06/wrap-layout/#comment-13066 Wed, 15 Jan 2025 03:28:47 +0000 http://tips4java.wordpress.com/?p=194#comment-13066 This was grreat to read

]]>
Comment on Text Area Scrolling by Marissa Hunt https://tips4java.wordpress.com/2008/10/22/text-area-scrolling/#comment-13062 Tue, 29 Oct 2024 07:48:40 +0000 http://tips4java.wordpress.com/?p=135#comment-13062 Great reading your blogg

]]>
Comment on Swing and Java 8 by markwilliams211992 https://tips4java.wordpress.com/2015/04/05/swing-and-java-8/#comment-13029 Mon, 26 Feb 2024 12:42:01 +0000 http://tips4java.wordpress.com/?p=1998#comment-13029 Thanks for sharing such knowledge.

]]>