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

📄 mspaint.java

📁 java实现的简单的画图软件
💻 JAVA
字号:
package com.catking.mainFrm;

import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

import com.catking.buttom.ColorPane;
import com.catking.left.ButtonPane;
import com.catking.middle.MyCanvas;
import com.catking.middle.ResizeSquare;
import com.catking.middle.WhiteSquare;

public class MsPaint {

	/**
	 * @param args
	 */
	
	private Display display;
	private ButtonPane bp;
	private ColorPane cp;
	private MyCanvas canvas;
	private static final int HEADICON = 0;
	
	public MsPaint(){
		display = Display.getDefault();
		SourceManager.loadResource();
		
		Shell shell = new Shell(display, SWT.SHELL_TRIM );
		shell.setText("未命名-画图");
		shell.setImage(SourceManager.imgs[HEADICON]);		
		
		buildGUI(shell);
		
		
		
		shell.setBackground(display.getSystemColor(SWT.COLOR_DARK_GRAY));
		
		shell.pack();
		shell.open();
		
		while(!  shell.isDisposed()){
			
			if(! display.readAndDispatch())
				display.sleep();
			
		}
		SourceManager.releaseResource();
	}
	private void buildGUI(Shell shell){
		//Button Pane		
		bp = new ButtonPane(shell);
		
		cp = new ColorPane(shell);
		canvas = new MyCanvas(shell, bp, cp);
		
		shell.setLayout(new FormLayout());
		
		FormData data = new FormData();
		data.left = new FormAttachment(0, 5);
		data.top = new FormAttachment(0, 5);
		bp.setLayoutData(data);
		
		data = new FormData();
		data.left = new FormAttachment(bp, 5);
		data.top = new FormAttachment(0, 5);
		data.right = new FormAttachment(100, -5);
		canvas.setLayoutData(data);
		
		data = new FormData();
		data.left = new FormAttachment(0, 5);
		data.top = new FormAttachment(bp, 5);
		data.bottom = new FormAttachment(100, -5);
		cp.setLayoutData(data);
		
	}

	
	public static void main(String[] args) {
		
		new MsPaint();
	}
}

⌨️ 快捷键说明

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