package org;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Event;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import javax.swing.border.Border;
public class ApplicationWindow {
private JFrame jFrame = null; // @jve:decl-index=0:visual-constraint="10,52"
private JPanel jContentPane = null;
private JMenuBar jJMenuBar = null;
private JMenu fileMenu = null;
private JMenu editMenu = null;
private JMenu helpMenu = null;
private JMenuItem exitMenuItem = null;
private JMenuItem aboutMenuItem = null;
private JMenuItem cutMenuItem = null;
private JMenuItem copyMenuItem = null;
private JMenuItem pasteMenuItem = null;
private JMenuItem saveMenuItem = null;
private JDialog aboutDialog = null;
private JPanel aboutContentPane = null;
private JLabel aboutVersionLabel = null;
private JMenuItem newWindow = null;
private JMenuItem newWindow1 = null;
/**
* This method initializes jFrame
*
* @return javax.swing.JFrame
*/
public JFrame getJFrame() {
if (jFrame == null) {
jFrame = new JFrame();
jFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
jFrame.setJMenuBar(getJJMenuBar());
jFrame.setSize(569, 353);
jFrame.setContentPane(getJContentPane());
jFrame.setTitle("ApplicationWindow");
}
return jFrame;
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new BorderLayout());
}
return jContentPane;
}
/**
* This method initializes jJMenuBar
*
* @return javax.swing.JMenuBar
*/
private JMenuBar getJJMenuBar() {
if (jJMenuBar == null) {
jJMenuBar = new JMenuBar();
jJMenuBar.add(getFileMenu());
jJMenuBar.add(getEditMenu());
jJMenuBar.add(getHelpMenu());
}
return jJMenuBar;
}
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getFileMenu() {
if (fileMenu == null) {
fileMenu = new JMenu();
fileMenu.setText("File");
fileMenu.add(getSaveMenuItem());
fileMenu.add(getExitMenuItem());
}
return fileMenu;
}
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getEditMenu() {
if (editMenu == null) {
editMenu = new JMenu();
editMenu.setText("Edit");
editMenu.add(getNewWindow());
editMenu.add(getNewWindow1());
editMenu.add(getCutMenuItem());
editMenu.add(getCopyMenuItem());
editMenu.add(getPasteMenuItem());
}
return editMenu;
}
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getHelpMenu() {
if (helpMenu == null) {
helpMenu = new JMenu();
helpMenu.setText("Help");
helpMenu.add(getAboutMenuItem());
}
return helpMenu;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getExitMenuItem() {
if (exitMenuItem == null) {
exitMenuItem = new JMenuItem();
exitMenuItem.setText("Exit");
exitMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
}
return exitMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getAboutMenuItem() {
if (aboutMenuItem == null) {
aboutMenuItem = new JMenuItem();
aboutMenuItem.setText("About");
aboutMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialog aboutDialog = getAboutDialog();
aboutDialog.pack();
Point loc = getJFrame().getLocation();
loc.translate(20, 20);
aboutDialog.setLocation(loc);
aboutDialog.setVisible(true);
}
});
}
return aboutMenuItem;
}
/**
* This method initializes aboutDialog
*
* @return javax.swing.JDialog
*/
private JDialog getAboutDialog() {
if (aboutDialog == null) {
aboutDialog = new JDialog(getJFrame(), true);
aboutDialog.setTitle("About");
aboutDialog.setContentPane(getAboutContentPane());
}
return aboutDialog;
}
/**
* This method initializes aboutContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getAboutContentPane() {
if (aboutContentPane == null) {
aboutContentPane = new JPanel();
aboutContentPane.setLayout(new BorderLayout());
aboutContentPane.add(getAboutVersionLabel(), BorderLayout.CENTER);
}
return aboutContentPane;
}
/**
* This method initializes aboutVersionLabel
*
* @return javax.swing.JLabel
*/
private JLabel getAboutVersionLabel() {
if (aboutVersionLabel == null) {
aboutVersionLabel = new JLabel();
aboutVersionLabel.setText("Version 1.0");
aboutVersionLabel.setHorizontalAlignment(SwingConstants.CENTER);
}
return aboutVersionLabel;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getCutMenuItem() {
if (cutMenuItem == null) {
cutMenuItem = new JMenuItem();
cutMenuItem.setText("Cut");
cutMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,
Event.CTRL_MASK, true));
}
return cutMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getCopyMenuItem() {
if (copyMenuItem == null) {
copyMenuItem = new JMenuItem();
copyMenuItem.setText("Copy");
copyMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,
Event.CTRL_MASK, true));
}
return copyMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getPasteMenuItem() {
if (pasteMenuItem == null) {
pasteMenuItem = new JMenuItem();
pasteMenuItem.setText("Paste");
pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,
Event.CTRL_MASK, true));
}
return pasteMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getSaveMenuItem() {
if (saveMenuItem == null) {
saveMenuItem = new JMenuItem();
saveMenuItem.setText("Save");
saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
Event.CTRL_MASK, true));
}
return saveMenuItem;
}
/**
* This method initializes newWindow
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getNewWindow() {
if (newWindow == null) {
newWindow = new JMenuItem();
newWindow.setText("新增窗口");
newWindow.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
CommonUtils.getTabbedContainer().addPageComponentByTest();
}
});
}
return newWindow;
}
/**
* This method initializes newWindow1
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getNewWindow1() {
if (newWindow1 == null) {
newWindow1 = new JMenuItem();
newWindow1.setText("样式改变");
newWindow1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
// setCurrentUIStyle(CommonUtils.getTabbedContainer().getTabbedContainer());
没有合适的资源?快使用搜索试试~ 我知道了~
TabbedContainer
共30个文件
class:13个
java:7个
gif:4个
4星 · 超过85%的资源 需积分: 10 23 下载量 25 浏览量
2011-05-11
10:17:29
上传
评论
收藏 550KB RAR 举报
温馨提示
Netbeans中的TabbedContainer容器,解决了Swing中jTabbedPane需手动设置关闭按钮,可以轻松设置,类似于Netbeans主窗口的布局。
资源推荐
资源详情
资源评论
收起资源包目录
netbeanswing-tabbedcontainer.rar (30个子文件)
netbeanswing-tabbedcontainer
.project 524B
bin
org
Main$1.class 927B
ApplicationWindow$3.class 860B
ApplicationWindow$2.class 1KB
image
title.gif 536B
title2.gif 583B
swing
DialogA.class 2KB
PanelA.class 1KB
InternalFrameA$1.class 878B
InternalFrameA.class 2KB
TabbedContainerPage.class 6KB
ApplicationWindow$1.class 761B
ApplicationWindow.class 6KB
CommonUtils.class 614B
Main.class 511B
ApplicationWindow$4.class 705B
src
org
TabbedContainerPage.java 7KB
image
title.gif 536B
title2.gif 583B
swing
InternalFrameA.java 2KB
PanelA.java 1KB
DialogA.java 1KB
Main.java 588B
CommonUtils.java 455B
ApplicationWindow.java 8KB
.classpath 314B
lib
org-openide-windows.jar 107KB
org-openide-util.jar 587KB
org-openide-awt.jar 349KB
org-netbeans-swing-tabcontrol.jar 730KB
共 30 条
- 1
资源评论
- zs88166852012-07-30Netbeans的Tab抽出来了,还不错
- livepdm2011-10-11的确把Netbeans的Tab抽出来了,不过,目前Java6 提供了在tab上增加其他控件的方法调用,可以不再使用这个了。
- fj_cloud2013-01-05不错,Netbeans 还是很强大的
- 大鸟软件2012-07-08是有一定的参考价值,但是还是不够完美,只能用于学习
lbhreadme
- 粉丝: 3
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功