xtaskpane

XTaskPane 类似XP 左边的导航栏,在开发Swing应用的时候很好用的。

下面两张截图反应了JXTaskPane的动画效果。可以自由的卷起和展开。



JXTaskPane的的使用步骤:

1、新建一个 JXTaskPaneContainer

2、新建{i}个JXTaskPane (i>=1)

3、依次将 新建的JXTaskPane 添加到 JXTaskPaneContainer 中去。

4、最后将 JXTaskPaneContainer 添加到JFrame 中。

附上 SwingX doc中的示例代码


JXFrame frame = new JXFrame();

// a container to put all JXTaskPane together
JXTaskPaneContainer taskPaneContainer = new JXTaskPaneContainer();

// create a first taskPane with common actions
JXTaskPane actionPane = new JXTaskPane();
actionPane.setTitle("Files and Folders");
actionPane.setSpecial(true);

// actions can be added, a hyperlink will be created
Action renameSelectedFile = createRenameFileAction();
actionPane.add(renameSelectedFile);
actionPane.add(createDeleteFileAction());

// add this taskPane to the taskPaneContainer
taskPaneContainer.add(actionPane);

// create another taskPane, it will show details of the selected file
JXTaskPane details = new JXTaskPane();
details.setTitle("Details");

// add standard components to the details taskPane
JLabel searchLabel = new JLabel("Search:");
JTextField searchField = new JTextField("");
details.add(searchLabel);
details.add(searchField);

taskPaneContainer.add(details);

// put the action list on the left
frame.add(taskPaneContainer, BorderLayout.EAST);

// and a file browser in the middle
frame.add(fileBrowser, BorderLayout.CENTER);

frame.pack();
frame.setVisible(true);

默认JXTaskPane 的动画功能是起用的,你也可以关闭 :

只要 myJXTaskPane.setAnimated(false); 就可以了。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值