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

📄 consoleframe.java

📁 学生资料管理系统 基于c/s模式开发 用户可以运行用户端登陆服务器 然后通过客户端来进行服务器端的数据库操作
💻 JAVA
字号:
import java.awt.BorderLayout;
import java.awt.FileDialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTextArea;

public class ConsoleFrame  extends JFrame implements ActionListener,WindowListener{
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		public JTextArea textArea;
		
		public ConsoleFrame(){
			
			getContentPane().setLayout(new BorderLayout());
			setSize(640,400);
			setLocation(60,70);
			setTitle("sunringove");
			
			JMenu file=new JMenu("File");
			JMenuBar menuBar=new JMenuBar();
			JMenuItem item1=new JMenuItem("Save Log");
			file.add(item1);
			file.addSeparator();
			JMenuItem item2=new JMenuItem("Exit");
			file.add(item2);
			menuBar.add(file);
			setJMenuBar(menuBar);
			
			textArea=new JTextArea();
			textArea.setLineWrap(true);   
			textArea.setEditable(false);
			
			textArea.setText("Console");
			System.out.println();
			
			add(textArea,BorderLayout.CENTER);
			addWindowListener(this);
			item1.addActionListener(this);
			item2.addActionListener(this);
			
		}
		
		
		public void appendString(String string){
			textArea.append("\n"+string);
		}
			
	
		public void windowOpened(WindowEvent arg0) {}
		public void windowClosing(WindowEvent arg0) {
			System.exit(0);
		}
		public void windowClosed(WindowEvent arg0) {	}
		public void windowIconified(WindowEvent arg0) {}
		public void windowDeiconified(WindowEvent arg0) {}
		public void windowActivated(WindowEvent arg0) {}
		public void windowDeactivated(WindowEvent arg0) {}


		public void actionPerformed(ActionEvent e) {
			String value=e.getActionCommand();
	    	    
		    if(value.equals("Exit"))
		    {
		    	System.exit(0);
		    }
		    else
		    {
		    	FileDialog fileBox=new FileDialog(this,"Save",FileDialog.SAVE);
			    fileBox.setVisible(true);
		      }
			
		}
		
			
		
		
	}


⌨️ 快捷键说明

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