开发者

What is this component name

开发者 https://www.devze.com 2023-02-12 01:39 出处:网络
What is the name of the component in java Swing shown in the following link http://www.scriptocean.com/template3.html

What is the name of the component in java Swing shown in the following link http://www.scriptocean.com/template3.html

It is known as extended ListView in Android. But I want to know the same in 开发者_开发知识库Java Swing.


Do you mean this component ?

What is this component name

If so, to display it in Java, you have some choices.

  • If you want your items to be easily clickable (that's to say action senders), you would tend to use JButtons in a vertical BoxLayout 'ed JPanel
  • If you simply want to display items, then customize their display, you would undoubtly go the JList way. Also take a look at Swing tutorial, which is always of great help.

EDIT

Accordint o comment, to have an area below the button displaying content, you'll use the second solution with a twist. As all elements in Swing are in fact JComponents and can be put in thers, you'll use JPanel as JList elements. in each JPanel, you'll have ione button always visible and one sub-panel that is hidden at startup. When clicking the JButton, you'll simply show or hide the associated sub-panel. If you want to have some kind of effect, you can either

  • wait for the upcoming JavaFX transitions effects
  • Use Filthy Rcih Clients animations library (take a look at their links page).


There is no standard Swing component that behaves like in your example. But you can find something similar in the SwingX project : the JXTaskPane and JXTaskPaneContainer components.

Unlike your example, the sections are not exclusive. But you can achieve this exclusivity with a few lines of code.

0

精彩评论

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