系统简单主界面

package com.boomlink.design;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTree;
import javax.swing.UIManager;

import org.jvnet.lafwidget.LafWidget;
import org.jvnet.lafwidget.utils.LafConstants.AnimationKind;
import org.jvnet.substance.SubstanceLookAndFeel;
import org.jvnet.substance.skin.OfficeSilver2007Skin;
/**
* 系统简单主界面
* @author 浪人
*/
public class MFrame{
   /**
    * JFrame
    */
  JFrame jf;
   /**
    * JPanel
    */
  JPanel jp;
   /**
    * JTabbedPane
    */
  JTabbedPane jtp;
   /**
    * JSplitPane
    */
  JSplitPane jsp;
   /**
    * JTree
    */
  JTree jtree;
   /**
    * 构造方法
    */
   public MFrame(){
    setlaf();
    build();
  }
   /**
    * 设置look and feel
    */
   public void setlaf(){
    JFrame.setDefaultLookAndFeelDecorated( true);
    UIManager.put(LafWidget.ANIMATION_KIND, AnimationKind.NONE);
    SubstanceLookAndFeel.setSkin( new OfficeSilver2007Skin());
  }
   /**
    * 构建JFrame内部元素
    */
   public void build(){
    jf = new JFrame();
    jp = new JPanel();
    jtp = new JTabbedPane();
    jsp = new JSplitPane();
    jtree = new JTree();
    jp.setLayout( new BorderLayout());
    jp.add(jtree);
     // 布置JSplitPane的内容
    jsp.setOneTouchExpandable( true);
    jsp.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    jsp.setLeftComponent(jp);
    jsp.setRightComponent(jtp);
    jsp.setDividerSize(10);
    jsp.setDividerLocation(260);
    jf.add(jsp);
     // 布置JFrame的south为状态栏
    JPanel statusp = new JPanel();
    statusp.setLayout( new FlowLayout(FlowLayout.LEFT));
    statusp.add( new JLabel( "版权所有@浪人"));
    jf.add(statusp, "South");
  }
   /**
    * 布置并显示JFrame
    */
   public void show(){
    jf.setTitle( "浪人系统");
    jf.setSize(1024, 768);
    jf.setExtendedState(JFrame.MAXIMIZED_BOTH);
     int screenWidth = (( int) java.awt.Toolkit.getDefaultToolkit()
        .getScreenSize().width);
     int screenHeight = (( int) java.awt.Toolkit.getDefaultToolkit()
        .getScreenSize().height);
    jf.setLocation((screenWidth - 800) / 2, (screenHeight - 600) / 2);
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jf.setVisible( true);
  }
   /**
    * 入口方法
    * @param args String[]
    */
   public static void main(String[] args){
     new MFrame().show();
  }
}
 
界面截图见附件。
 
 

你可能感兴趣的:(职场,系统,休闲)