JavaSwing+derby电子相册

JavaSwing+derby电子相册_第1张图片

此只为主类,完整可执行程序及源代码:点击打开链接

import java.awt.EventQueue;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.GroupLayout;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import tool.ScreenSize;


public class AlbumFrame extends JFrame{
	public AlbumFrame(){
		initComponents();
		ScreenSize.centered(this);
	}

	private void initComponents() {
		albumPanel1 = new AlbumPanel();
		this.setDefaultLookAndFeelDecorated(true);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setTitle("电子相册");
		GroupLayout layout = new GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		
		//设置沿水平轴确定组件位置和大小的 Group。 Parallel:n. 平行线;对比
		layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
				.addComponent(albumPanel1, GroupLayout.DEFAULT_SIZE, 520, Short.MAX_VALUE));
		//设置沿垂直轴确定组件位置和大小的 Group。
		layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
				.addComponent(albumPanel1, GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE));
		this.pack();
	}

	public static void main(String[] args) throws IllegalAccessException {
		/*
		try{
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}catch(ClassNotFoundException e){
			//Level 类定义了一组可用来控制日志输出的标准日志级别。severe:最高级别
			//log()记录带有相关的可抛出信息的消息。 
			Logger.getLogger(AlbumFrame.class.getName()).log(Level.SEVERE, null, e);
		}catch(InstantiationException e){
			Logger.getLogger(AlbumFrame.class.getName()).log(Level.SEVERE, null, e);
		}catch(UnsupportedLookAndFeelException e){
			Logger.getLogger(AlbumFrame.class.getName()).log(Level.SEVERE, null, e);
		}*/
		EventQueue.invokeLater(new Runnable(){
			public void run(){
				new AlbumFrame().setVisible(true);
			}
		});
	}
	
	private AlbumPanel albumPanel1;
}


你可能感兴趣的:(layout,null,Derby,import,相册,parallel)