开发者

A Swing component to display separate, selectable strings on different lines?

开发者 https://www.devze.com 2023-02-13 17:43 出处:网络
I\'m looking for a Swing component that displays several separate strings (probably from a string array or list) on separate lines within a pane or field (scrollable if there\'s too many to show at on

I'm looking for a Swing component that displays several separate strings (probably from a string array or list) on separate lines within a pane or field (scrollable if there's too many to show at once). The user needs to be able to select one of these lines (double-clicking 开发者_开发问答would be ideal) and thereby trigger a listener that does some magic with that line's string. Can anyone point me in the right direction?


Try a JList: http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/JList.html. Can be added to a ScrollPane if you want to include scrolling ability.


I suggest you to use a JList inside a vertical JScrollPane.


The user needs to be able to select one of these lines (double-clicking would be ideal) and thereby trigger a listener that does some magic with that line's string

You can use the List Action for this.

0

精彩评论

暂无评论...
验证码 换一张
取 消