亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? notepad.java

?? 用java編寫的一個記事本小程序
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
//package P1;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
import javax.swing.JColorChooser;
class Notepad extends Frame implements ActionListener, TextListener,WindowListener,KeyListener
{
	MenuBar theMenuBar;
	Menu file,edit,format,help;
	MenuItem newFile, open, save, saveas,exit;
	MenuItem undo, copy, cut, paste,search,searchAndChange;
	MenuItem font;
	MenuItem about;
	TextArea content;
	FileDialog filesource;
	Frame replace;
	//Dialog find;
	//Dialog 
	Label message;
	int firstUndo = 1;
	int firstBackspace = 1;
	String tmp="", t;
	String source=null;
	//String copytmp="";
	Notepad()
	{
		setTitle("Notepad");
		theMenuBar = new MenuBar();

		file = new Menu("File");
		edit = new Menu("Edit");
		format = new Menu("Format");
		help = new Menu("Help");
		
		newFile = new MenuItem("New");
		open = new MenuItem("Open...");
		save = new MenuItem("Save...");
		saveas = new MenuItem("Save As...");
		exit = new MenuItem("Exit");
		undo = new MenuItem("Undo");
		copy = new MenuItem("Copy");
		cut = new MenuItem("Cut");
		paste = new MenuItem("Paste");
		search = new MenuItem("Find...");
		searchAndChange = new MenuItem("Replace...");
		font = new MenuItem("Font...");
		about = new MenuItem("About...");

		//search = new Frame("Search and Change");
		content = new TextArea();
		content.addTextListener(this);
		//fileopen = new FileDialog();

		newFile.addActionListener(this);
		open.addActionListener(this);
		save.addActionListener(this);
		saveas.addActionListener(this);
		exit.addActionListener(this);
		undo.addActionListener(this);
		copy.addActionListener(this);
		cut.addActionListener(this);
		paste.addActionListener(this);
		search.addActionListener(this);
		searchAndChange.addActionListener(this);
		font.addActionListener(this);
		about.addActionListener(this);

		addWindowListener(this);
		content.addKeyListener(this);
		message = new Label();

		theMenuBar.add(file); theMenuBar.add(edit); theMenuBar.add(format); theMenuBar.add(help);

		file.add(newFile); file.addSeparator(); file.add(open); file.add(save); file.add(saveas);	file.addSeparator(); file.add(exit);
		edit.add(undo); edit.addSeparator(); edit.add(copy); edit.add(cut); edit.add(paste); edit.addSeparator(); edit.add(search); edit.add(searchAndChange);
		format.add(font);
		help.add(about);
		setMenuBar(theMenuBar);
		add(content); add(message, "South");
		setSize(400, 400);
		this.setLocation(450, 200);
		setVisible(true);
	}

	public void newfile()
	{
		
		content.setText("");
		setTitle("Notepad");
		firstUndo = 1;
		firstBackspace = 1;
		message.setText("New");
	}
	public class Ask extends Dialog implements ActionListener, WindowListener
	{
		Label lb;
		Button bt1;
		Button bt2;
		Button bt3;
		Panel pn1;
		
		Ask(Frame frame,String s,boolean b)
		{
			super(frame, s, b);
			
			//find = new Dialog(frame, s, b);
			lb = new Label("Do you want to save?");
			bt1 = new Button("Yes");
			bt2 = new Button("No");
			bt3 = new Button("Cancel");	
			pn1 = new Panel();
			setLayout(new GridLayout(2, 1));	
			pn1.setLayout(new GridLayout(1,3));
			pn1.add(bt1);
			pn1.add(bt2);
			pn1.add(bt3);
			add(lb);
			add(pn1);
			setSize(300, 150);
			this.setLocation(500, 300);
			setVisible(true);
			addWindowListener(this);
			bt1.addActionListener(this);
			bt2.addActionListener(this);
			bt3.addActionListener(this);
		}
		public void windowClosing(WindowEvent e)
		{ dispose(); }
		public void windowOpened(WindowEvent e) { }
		public void windowActivated(WindowEvent e) { }
		public void windowDeactivated(WindowEvent e) { }
		public void windowClosed(WindowEvent e) { }
		public void windowIconified(WindowEvent e) { }
		public void windowDeiconified(WindowEvent e) { }

		public void actionPerformed(ActionEvent ae)
		{
			if (ae.getSource().equals(bt1))
			{
				saveas();
				System.exit(0);
			}
			if (ae.getSource().equals(bt2))
			{
				newfile();
				dispose();
			}
			if (ae.getSource().equals(bt3))
			{
				dispose();
			}
		}
	}
	
	public class Ask2 extends Dialog implements ActionListener, WindowListener
	{
		Label lb;
		Button bt1;
		Button bt2;
		Button bt3;
		Panel pn1;
		
		Ask2(Frame frame,String s,boolean b)
		{
			super(frame, s, b);
			
			//find = new Dialog(frame, s, b);
			lb = new Label("Do you want to save?");
			bt1 = new Button("Yes");
			bt2 = new Button("No");
			bt3 = new Button("Cancel");	
			pn1 = new Panel();
			setLayout(new GridLayout(2, 1));	
			pn1.setLayout(new GridLayout(1,3));
			pn1.add(bt1);
			pn1.add(bt2);
			pn1.add(bt3);
			add(lb);
			add(pn1);
			setSize(300, 150);
			this.setLocation(500, 300);
			setVisible(true);
			addWindowListener(this);
			bt1.addActionListener(this);
			bt2.addActionListener(this);
			bt3.addActionListener(this);
		}
		public void windowClosing(WindowEvent e)
		{ dispose(); }
		public void windowOpened(WindowEvent e) { }
		public void windowActivated(WindowEvent e) { }
		public void windowDeactivated(WindowEvent e) { }
		public void windowClosed(WindowEvent e) { }
		public void windowIconified(WindowEvent e) { }
		public void windowDeiconified(WindowEvent e) { }

		public void actionPerformed(ActionEvent ae)
		{
			if (ae.getSource().equals(bt1))
			{
				saveas();
				System.exit(0);
			}
			if (ae.getSource().equals(bt2))
			{
				System.exit(0);
			}
			if (ae.getSource().equals(bt3))
			{
				dispose();
			}
		}
	}
	public void open()
	{
		try
		{

			filesource = new FileDialog(this, "open", FileDialog.LOAD);
			filesource.show();
			source = filesource.getDirectory() + filesource.getFile();
			DataInputStream fileRead = new DataInputStream(new FileInputStream(source));
			String line="";
			content.setText("");
			while ((line = fileRead.readLine()) != null)
				content.append(line + "\n");
			setTitle(filesource.getFile());
			fileRead.close();
			message.setText(source);
			
			

		}
		catch (Exception e) { message.setText(e.getMessage()); }
	
	}

	public void save()
	{
		try
		{
			if (source==null)
			{
			filesource = new FileDialog(this, "save", FileDialog.SAVE);
			filesource.show();
			source = filesource.getDirectory() + filesource.getFile();
			DataOutputStream fileWrite = new DataOutputStream(new FileOutputStream(source));
			String info = content.getText();
			if (info == null || info.length() < 1)
				message.setText("cannot save the empty information");
			else
				fileWrite.writeBytes(info);
			setTitle(filesource.getFile());
			fileWrite.close();
			message.setText(source);
			}
			else
			{
				DataOutputStream fileWrite = new DataOutputStream(new FileOutputStream(source));
				String info = content.getText();
				if (info == null || info.length() < 1)
					message.setText("cannot save the empty information");
				else
					fileWrite.writeBytes(info);
				setTitle(filesource.getFile());
				fileWrite.close();
				message.setText(source);
			}
		}
		catch (Exception e) { message.setText(e.getMessage()); }
	}
	public void saveas()
	{
		try
		{
			
			filesource = new FileDialog(this, "save", FileDialog.SAVE);
			this.setLocation(500, 300);
			filesource.show();
			source = filesource.getDirectory() + filesource.getFile();
			DataOutputStream fileWrite = new DataOutputStream(new FileOutputStream(source));
			String info = content.getText();
			if (info == null || info.length() < 1)
				message.setText("cannot save the empty information");
			else
				fileWrite.writeBytes(info);
			setTitle(filesource.getFile());
			fileWrite.close();
			message.setText(source);
			
		}
		catch (Exception e) { message.setText(e.getMessage()); }
	}

	public void exit()
	{
		System.exit(0);
	}
//above is the file menu
	public void undo()
	{
		
		/*if (firstUndo == 1&&(firstBackspace!=2))
		{
			tmp = "";
			firstUndo++;
		
		}*/
		t = content.getText();
		content.setText(tmp);
		tmp = t;
		firstBackspace = 1;
		message.setText("File content Modified");
	}

	public void copy()
	{
		Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
		String copytmp = content.getSelectedText();
		StringSelection stringSelection = new StringSelection(copytmp);
		clipboard.setContents(stringSelection, null);


	}

	public void cut()
	{
		Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
		String temp = content.getSelectedText();
		StringSelection stringSelection = new StringSelection(temp);
		clipboard.setContents(stringSelection, null);
		int start = content.getSelectionStart();
		int end = content.getSelectionEnd();
		content.replaceRange("", start, end);
		message.setText("File content Modified");
	}

	public void paste()
	{
		Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
		Transferable transferable = clipboard.getContents(this);
		DataFlavor flavor = DataFlavor.stringFlavor;
		if (transferable.isDataFlavorSupported(flavor))
		{
			try
			{
				int start = content.getSelectionStart();
				int end = content.getSelectionEnd();
				content.replaceRange("", start, end);
				String str;
				int n = content.getCaretPosition();
				str = (String)transferable.getTransferData(flavor);
				content.insert(str, n);
				message.setText("File content Modified");
			}
			catch (Exception ee)
			{

			}
		}
		
	}
	public class Find extends Dialog implements ActionListener, WindowListener
	{
		Label lb;
		TextField tf;
		Button bt;
		int start = 1;
		String allcontent =content.getText();
		String target=null;
		int length;
		Find(Frame frame,String s,boolean b)
		{
			super(frame, s, b);
			//find = new Dialog(frame, s, b);
			lb = new Label("");
			tf = new TextField(10);
			bt = new Button("Find");
			setLayout(new GridLayout(4, 2));
			add(new Label(""));
			add(new Label(""));
			add(tf);
			add(bt);
			add(new Label(""));
			add(lb);
			setSize(400, 200);
			this.setLocation(500, 300);
			setVisible(true);
			addWindowListener(this);
			bt.addActionListener(this);
		}
		public void windowClosing(WindowEvent e)
		{ dispose(); }
		public void windowOpened(WindowEvent e) { }
		public void windowActivated(WindowEvent e) { }
		public void windowDeactivated(WindowEvent e) { }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆久久久久久| 精品一二三四在线| 国产欧美视频一区二区| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美性色综合网| 欧美日韩情趣电影| 欧美三级韩国三级日本一级| 91成人在线精品| 欧美日韩午夜影院| 91.xcao| 欧美一区二区视频免费观看| 日韩美女视频在线| 国产亚洲制服色| 欧美经典三级视频一区二区三区| 国产精品你懂的在线| 亚洲欧美自拍偷拍色图| 一区二区免费在线| 美女视频免费一区| 国产精品白丝jk黑袜喷水| 成人晚上爱看视频| 在线日韩国产精品| 日韩欧美不卡在线观看视频| 国产欧美日产一区| 亚洲激情av在线| 蜜桃传媒麻豆第一区在线观看| 国产传媒日韩欧美成人| 91丨porny丨中文| 欧美一区日韩一区| 中文字幕在线视频一区| 婷婷成人激情在线网| 国模冰冰炮一区二区| 91久久国产最好的精华液| 欧美不卡123| 伊人性伊人情综合网| 美女视频一区在线观看| 91啪在线观看| 精品国产一区二区精华| 一区二区三区日韩在线观看| 久久国产视频网| 91麻豆国产精品久久| 精品久久久久99| 一区二区三区四区五区视频在线观看| 麻豆91精品91久久久的内涵| 91亚洲资源网| 久久亚洲一区二区三区明星换脸| 亚洲精品福利视频网站| 国产成a人无v码亚洲福利| 欧美日韩黄色影视| 亚洲欧美日韩一区二区| 国产乱码精品一区二区三区忘忧草 | 欧美精品日韩一本| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 色综合久久中文字幕综合网| 欧美一级日韩一级| 亚洲黄色免费电影| 国产传媒欧美日韩成人| 欧美一级二级在线观看| 一区二区三区资源| 成人av在线资源网站| 欧美v国产在线一区二区三区| 亚洲一区二区五区| 91亚洲大成网污www| 久久精品日韩一区二区三区| 奇米一区二区三区| 欧美丰满美乳xxx高潮www| 亚洲激情第一区| 91亚洲午夜精品久久久久久| 中文在线资源观看网站视频免费不卡 | 国产精品嫩草影院av蜜臀| 国产自产视频一区二区三区| 日韩一二三区不卡| 蜜桃av一区二区三区| 欧美绝品在线观看成人午夜影视| 亚洲一区日韩精品中文字幕| 91色乱码一区二区三区| 中文字幕一区不卡| 一本色道亚洲精品aⅴ| 亚洲精品ww久久久久久p站| 99精品1区2区| 亚洲线精品一区二区三区八戒| 91福利在线观看| 亚洲第一福利一区| 欧美一二三区在线| 狠狠狠色丁香婷婷综合激情| 久久久久久久久99精品| 国产91在线观看丝袜| 最新高清无码专区| 欧美日韩你懂得| 麻豆91在线观看| 国产拍欧美日韩视频二区| 国产成人av在线影院| 亚洲人成在线播放网站岛国| 在线精品视频一区二区| 日韩影院精彩在线| 26uuu成人网一区二区三区| 成人国产亚洲欧美成人综合网 | 色吧成人激情小说| 香蕉影视欧美成人| 精品黑人一区二区三区久久 | 亚洲观看高清完整版在线观看| 欧美日韩国产在线观看| 九九精品一区二区| 国产精品久久久久久妇女6080 | 精品国产三级电影在线观看| 国产成人福利片| 亚洲免费视频成人| 精品国产一区二区三区av性色| 成人高清免费在线播放| 五月婷婷综合激情| 国产亚洲短视频| 欧美在线一区二区三区| 久久精品国产第一区二区三区| 国产精品久久看| 91精品国产免费| 91在线视频免费91| 久久精品国产99国产| 国产精品久久久一本精品| 欧美一区二区三区日韩| 99精品欧美一区二区三区小说| 午夜视频久久久久久| 国产精品久久久久久亚洲伦| 91麻豆精品国产91久久久久久 | 成人黄色a**站在线观看| 日韩制服丝袜av| 国产精品久久午夜| 日韩精品自拍偷拍| 欧美视频在线一区二区三区| 丁香婷婷深情五月亚洲| 蜜桃一区二区三区在线观看| 亚洲精品一二三区| 久久久久高清精品| 欧美草草影院在线视频| 欧美日韩电影在线| 在线视频国内一区二区| 97超碰欧美中文字幕| 国产在线精品视频| 久久精品国内一区二区三区| 五月激情综合婷婷| 亚洲午夜久久久久| 尤物av一区二区| 亚洲同性同志一二三专区| 国产婷婷色一区二区三区在线| 日韩欧美亚洲另类制服综合在线| 欧美日韩国产一区| 欧美中文字幕一区二区三区| 色综合久久久久综合| 成人97人人超碰人人99| 成人午夜私人影院| 成人精品视频一区| 99久久久免费精品国产一区二区 | 亚洲成av人片www| 亚洲日本成人在线观看| 国产精品短视频| 亚洲欧洲成人av每日更新| 国产精品美女久久久久久久久久久 | 国产午夜精品久久| 国产午夜精品一区二区| 国产偷国产偷亚洲高清人白洁| 欧美变态口味重另类| 久久午夜羞羞影院免费观看| 久久夜色精品国产欧美乱极品| 国产亚洲短视频| 国产精品卡一卡二卡三| 亚洲女子a中天字幕| 亚洲一区二区三区不卡国产欧美 | 日韩一级片网站| 日韩三级中文字幕| 国产亚洲1区2区3区| 国产精品久久久久久久久晋中 | 91麻豆精品视频| 欧美怡红院视频| 日韩你懂的电影在线观看| 欧美精品一区二区高清在线观看 | 欧美一区二区三区四区视频 | 91亚洲精品久久久蜜桃网站| 色综合天天综合网国产成人综合天| 色噜噜狠狠成人网p站| 91精品国产丝袜白色高跟鞋| 久久久亚洲国产美女国产盗摄| 国产精品久久久久久户外露出| 亚洲在线观看免费| 久99久精品视频免费观看| 成人av午夜电影| 欧美日韩不卡一区二区| 久久综合给合久久狠狠狠97色69| 中文字幕av不卡| 性久久久久久久| 成人午夜私人影院| 欧美另类z0zxhd电影| 欧美韩日一区二区三区| 亚洲国产日日夜夜| 国产乱码字幕精品高清av| 欧美视频精品在线观看| 久久久国产精品麻豆| 亚洲成va人在线观看| 国产福利91精品一区二区三区| 欧美日韩黄色一区二区| 中文字幕精品一区二区三区精品| 丝袜美腿亚洲综合| 99久久久国产精品|