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

📄 formview.java

📁 用java 实现的IE browser适合于学者
💻 JAVA
字号:
/*
 * Created on 2005-1-15
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.hnjchina.createview;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.*;
import org.eclipse.ui.part.ViewPart;

/**
 * @author limeiyong
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class FormView extends ViewPart{
    private FormToolkit toolkit;
    public void createPartControl(Composite parent) {
        ToolBarManager tbm = new ToolBarManager(1);
		IAction treeviewer=new Action("TreeViewers"){
			public	void	run(){
			}
		};		
        // Add the file actions
        tbm.add(treeviewer);
//        tbm.add(openAction);
//        tbm.add(saveAction);

//        toolkit = new FormToolkit(parent.getShell().getDisplay());
//        Label	lable=new Label(parent,SWT.NONE);
//        form = toolkit.createForm(parent);
        GridLayout layout = new GridLayout();
        parent.setLayout(layout);
//		Hyperlink link = toolkit.createHyperlink(parent, "Click here.",SWT.WRAP);
//		link.addHyperlinkListener(new HyperlinkAdapter() {
//			public void linkActivated(HyperlinkEvent e) {
//				System.out.println("Link activated!");
//			}
//		});
        layout.numColumns = 2;
		GridData gd = new GridData();
		gd.horizontalSpan = 2;
//		link.setLayoutData(gd);
		Label label = new Label(parent, SWT.NULL);
		label.setText("Text field label:");

//        lable.setText("Hello, Eclipse Forms");
        Text text = new Text(parent, SWT.BORDER);
        text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        Button button = new Button(parent, SWT.CHECK);
		button.setText("An example of a checkbox in a form");
		gd = new GridData();
		gd.horizontalSpan = 2;
		button.setLayoutData(gd);
    }
    public void setFocus() {
        
    }
    public void dispose() {
        if (toolkit!=null)
	        toolkit.dispose();
	        super.dispose();
     }
}

⌨️ 快捷键说明

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