A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© Thunder_-_Li 中级黑马   /  2013-10-22 22:35  /  1316 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

本帖最后由 Thunder_-_Li 于 2013-10-22 22:36 编辑

管理员  给加点   技术分呗
源码太大了   。。。。一个例子  给大家参考  作为调试和学习       java基础+jdbc+sqlserver   喜欢的要源码的  加我的QQ:329246352

package com.lzw;

public class MainFrame extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel frameContentPane = null;
private MenuBar frameMenuBar = null;
private ToolBar toolBar = null;
private DesktopPanel desktopPane = null;
private JPanel statePanel = null;
private JLabel stateLabel = null;
private JLabel nameLabel = null;
private JLabel nowDateLabel = null;
private JSeparator jSeparator1 = null;
private static JLabel czyStateLabel = null;
private JSeparator jSeparator2 = null;

/**
  * 程序主方法,运行程序的入口
  *
  * @param args
  */
public static void main(String[] args) {
  SplashScreen splashScreen = SplashScreen.getSplashScreen();
  JFrame login = new LoginDialog();
  if (splashScreen != null) {
   try {
    login.setDefaultCloseOperation(EXIT_ON_CLOSE);
    Thread.sleep(3000);
   } catch (InterruptedException e) {
   }
  }
  login.setVisible(true);
}

/**
  * This method initializes jJToolBarBar
  *
  * @return JToolBar
  */
private ToolBar getJJToolBarBar() {
  if (toolBar == null) {
   toolBar = new ToolBar(getFrameMenuBar());
   toolBar.setCursor(new Cursor(Cursor.HAND_CURSOR));
  }
  return toolBar;
}

/**
  * 初始化窗体菜单栏的方法
  *
  * @return JMenuBar
  */
protected MenuBar getFrameMenuBar() {
  if (frameMenuBar == null) {
   frameMenuBar = new MenuBar(getDesktopPane(), getStateLabel());
  }
  return frameMenuBar;
}

/**
  * This method initializes desktopPane
  *
  * @return JDesktopPane
  */
private DesktopPanel getDesktopPane() {
  if (desktopPane == null) {
   desktopPane = new DesktopPanel();
  }
  return desktopPane;
}

/**
  * This method initializes statePanel
  *
  * @return JPanel
  */
private JPanel getStatePanel() {
  if (statePanel == null) {
   GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
   gridBagConstraints6.gridx = 2;
   gridBagConstraints6.fill = GridBagConstraints.VERTICAL;
   gridBagConstraints6.insets = new Insets(0, 5, 0, 5);
   gridBagConstraints6.gridy = 0;
   GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
   gridBagConstraints4.gridx = 3;
   gridBagConstraints4.gridy = 0;
   GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
   gridBagConstraints3.gridx = 6;
   gridBagConstraints3.fill = GridBagConstraints.VERTICAL;
   gridBagConstraints3.insets = new Insets(0, 5, 0, 5);
   gridBagConstraints3.gridy = 0;
   GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
   gridBagConstraints11.gridx = 5;
   gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
   gridBagConstraints11.gridy = 0;
   nowDateLabel = new JLabel();
   Date now = new Date();
   nowDateLabel.setText(String.format("%tF", now));
   GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
   gridBagConstraints2.gridx = 7;
   gridBagConstraints2.weightx = 0.0;
   gridBagConstraints2.fill = GridBagConstraints.NONE;
   gridBagConstraints2.gridy = 0;
   nameLabel = new JLabel("爱你一点一点有限公司   ");
   GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
   gridBagConstraints1.gridx = 4;
   gridBagConstraints1.fill = GridBagConstraints.VERTICAL;
   gridBagConstraints1.weighty = 1.0;
   gridBagConstraints1.insets = new Insets(0, 5, 0, 5);
   gridBagConstraints1.gridy = 0;
   GridBagConstraints gridBagConstraints = new GridBagConstraints();
   gridBagConstraints.gridx = 0;
   gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
   gridBagConstraints.weightx = 1.0;
   gridBagConstraints.gridy = 0;
   statePanel = new JPanel();
   statePanel.setLayout(new GridBagLayout());
   statePanel.setBorder(BorderFactory.createBevelBorder(RAISED));
   statePanel.add(getStateLabel(), gridBagConstraints);
   statePanel.add(getJSeparator(), gridBagConstraints1);
   statePanel.add(nameLabel, gridBagConstraints2);
   statePanel.add(getJSeparator1(), gridBagConstraints3);
   statePanel.add(nowDateLabel, gridBagConstraints11);
   statePanel.add(getCzyStateLabel(), gridBagConstraints4);
   statePanel.add(getJSeparator2(), gridBagConstraints6);
  }
  return statePanel;
}

public static JLabel getCzyStateLabel() {
  if (czyStateLabel == null) {
   czyStateLabel = new JLabel("操作员:");
  }
  return czyStateLabel;
}

public JLabel getStateLabel() {
  if (stateLabel == null) {
   stateLabel = new JLabel();
   stateLabel.setText("当前没有选定窗体");
  }
  return stateLabel;
}
public class MainFrame extends JFrame {

111.jpg (73.45 KB, 下载次数: 1)

111.jpg

评分

参与人数 1技术分 +1 收起 理由
周志龙 + 1 感谢分享,只要多来论坛提问和回答精品问题.

查看全部评分

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马