资源简介
substance+swing完整案例,包括substance的jar包及一个完整的例子,之前找了很久,为方便大家,提供了一个简单例子。
代码片段和文件信息
package com.ffcs.TestCase;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JButton;
import javax.swing.Jframe;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableModel;
import org.jvnet.substance.skin.SubstanceBusinessBlueSteelLookAndFeel;
public class TestSwingframe extends Jframe {
private JMenuBar mainBar = new JMenuBar();
private JMenu sysMenu = new JMenu(“系统“);
private JMenuItem exitItem = new JMenuItem(“退出“);
private JMenuItem loginItem = new JMenuItem(“登陆“);
private JMenu aboutMenu = new JMenu(“关于“);
private JMenuItem helpItem = new JMenuItem(“帮助“);
private JPopupMenu popup = new JPopupMenu();
private JMenuItem sendItem = new JMenuItem(“发信息“);
private JMenuItem infoItem = new JMenuItem(“看账户“);
private JMenuItem logoutItem = new JMenuItem(“注销“);
private JTable table;
private JScrollPane jspLogin;
private JScrollPane jsplogTA;
private JPanel displayPanel;
private JPanel btnPanel;
private JButton dispalyBtn;
private JButton preBtn;
private JButton nextBtn;
public static DefaultTableModel defaultModel;
public static JTextArea logTA;
public TestSwingframe() {
super(“皮肤测试“);
setMainBar();
setPanel();
initframe(600 450);
}
private void initframe(int frameWidth int frameHeight) {
settitle(“皮肤测试“);
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension screenDimension = tk.getScreenSize();
int screenWidth = screenDimension.width;
int screenHeight = screenDimension.height;
setLocation((screenWidth - frameWidth) / 2
(screenHeight - frameHeight) / 2);
setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
setSize(frameWidth frameHeight);
setVisible(true);
}
private void setMainBar() {
setJMenuBar(mainBar);
mainBar.add(sysMenu);
mainBar.add(aboutMenu);
sysMenu.add(loginItem);
sysMenu.addSeparator();
sysMenu.add(exitItem);
aboutMenu.add(helpItem);
popup.add(sendItem);
popup.add(infoItem);
popup.add(logoutItem);
}
private void setPanel() {
String[][] playerInfo = new String[0][0];
String[] names = { “用户“ “登陆时间“ “当前状态“ };
defaultModel = new DefaultTableModel(playerInfo names);
logTA =
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 866 2009-12-05 00:22 substance\Readme.txt
文件 4573 2018-06-26 15:35 substance\TestSwingfr
文件 1621451 2009-12-04 00:45 substance\substance.jar
目录 0 2018-06-26 15:37 substance\
评论
共有 条评论