⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainframe.java

📁 一个可以存储和打印成绩单的系统
💻 JAVA
字号:
package org.signsmile.view;

import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JSplitPane;

import org.minjey.cjsjk.core.ModelManager;
import org.minjey.cjsjk.core.ModelManagerImpl;
import org.minjey.cjsjk.view.tree.ModelListenerImpl;
import org.minjey.cjsjk.view.tree.TreePanelImpl;

public class MainFrame extends JFrame {
	private static final long serialVersionUID = 1L;
	private static MainFrame mainFrame;
	private JSplitPane jsplit;
	private TreePanelImpl jTreePanel;
	private static ModelManager modelManager;

	public static MainFrame GetMainFrame() {
		if (mainFrame == null)
			mainFrame = new MainFrame();
		return mainFrame;
	}

	private MainFrame() {
		mainFrame = this;
		JMenuBar jmb = new MyMenuBar();
		this.setJMenuBar(jmb);

		jTreePanel = new TreePanelImpl();

		modelManager = new ModelManagerImpl(new ModelListenerImpl(jTreePanel));

		WelcomePanel viewPanel = new WelcomePanel();
		jsplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jTreePanel,
				viewPanel);
		jsplit.setOneTouchExpandable(true);
		this.getContentPane().setLayout(new BorderLayout());
		this.getContentPane().add(jsplit, BorderLayout.CENTER);
		JLabel jL = new JLabel("开发团队:长春理工计算机学院06级网络工程(1)班12舍343");
		jL.setHorizontalAlignment(JLabel.CENTER);
		this.getContentPane().add(jL, BorderLayout.SOUTH);

		this.setSize((int)(0.9*this.getToolkit().getScreenSize().width),(int)(0.9*this.getToolkit()
				.getScreenSize().height));
		this.setLocation(this.getToolkit().getScreenSize().width / 2
				- this.getWidth() / 2, this.getToolkit().getScreenSize().height
				/ 2 - this.getHeight() / 2);

		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		jsplit.setDividerLocation((int) (0.2 * this.getWidth()));

		this.setTitle("成教数据库管理");
		this.setVisible(true);
		this.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				MainFrame.GetMainFrame().dispose();
			}
		});
	}

	public void switchView(JPanel view) {
		jsplit.setRightComponent(view);
		jsplit.setDividerLocation((int) (0.2 * MainFrame.GetMainFrame()
				.getWidth()));
	}

	public void repaint(long time, int x, int y, int width, int height) {
		jsplit.setDividerLocation((int) (0.2 * this.getWidth()));
		jsplit.updateUI();
		super.repaint(time, x, y, width, height);
	}

	public static void main(String[] args) {
		MainFrame.GetMainFrame();
	}

	public static ModelManager getModelManager() {
		return modelManager;
	}

	public TreePanelImpl getJTreePanel() {
		return jTreePanel;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -