workframe.java

来自「研究生入学考试题」· Java 代码 · 共 63 行

JAVA
63
字号
import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class workFrame extends JFrame{
	private JPanel textPanel,buttonPanel;
	private JScrollPane inTestPane, outTextPane;
	private JTextArea inTextArea,outTextArea;
	private JButton inButton,clearButton;
	
	public workFrame(){
		setSize(400,400);
		setLocation(200,200);
		
		
		textPanel = new JPanel();
		inTextArea = new JTextArea();
		inTestPane = new JScrollPane(inTextArea);
		outTextArea = new JTextArea();
		outTextPane = new JScrollPane(outTextArea);
//		outTextArea.setBackground(new Color(100,100,0));
		outTextArea.setEditable(false);
		textPanel.setLayout(new GridLayout(2,1));
		textPanel.add(inTestPane);
		textPanel.add(outTextPane);
		
		buttonPanel = new JPanel();
		inButton    = new JButton("Input");
		clearButton = new JButton("Clear");
		buttonPanel.setLayout(new GridLayout(2,1));
		buttonPanel.add(inButton);
		buttonPanel.add(clearButton);
		
	    setLayout(new BorderLayout());
	    getContentPane().add(textPanel,"Center");
	    getContentPane().add(buttonPanel,"East");
		setVisible(true);
	}
	
	public JButton getInButton(){
		return inButton;
	}
	public JButton getClearButton(){
		return clearButton;
	}
	public JTextArea getInTextArea(){
		return inTextArea;
	}
	public JTextArea getOutTextArea(){
		return outTextArea;
	}
	
//	public static void main(String[] argv){
//		workFrame myFrame = new workFrame();
//		myFrame.setVisible(true);
//	}

}

⌨️ 快捷键说明

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