package NoteBook;
import javax
import java
import java
import java
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import javax
import
import java
import java
import java
import java
public class NoteBook implements ActionListener {
JFrame jf;
JTextArea jta;
JMenuItem[][] jmi;
myStack ms=new myStack();
public NoteBook(){
jf=new JFrame(
JMenuBar jmb=new JMenuBar();
jta=new JTextArea();
jf
ms
JScrollPane jsp=new JScrollPane(jta);
jf
String[] str
String[][] str
{
{
{
JMenu[] jm=new JMenu[str
// jmi=new JMenuItem[str
for(int i=
jm[i]=new JMenu(str
System
jmb
}
for(int i=
jmi=new JMenuItem[str
for(int j=
if(
jm[i]
}else {
jmi[i][j]=new JMenuItem(str
jm[i]
jmi[i][j]
}
}
}
jf
jf
jf
Toolkit tk=Toolkit
jf
jf
}
public JTextArea getJTextArea(){
return this
}
public JFrame getJFrame(){
return this
}
public void actionPerformed(ActionEvent e) {
// TODO Auto
String str=e
if(
new NoteBook();
}else if (
JFileChooser jfc=new JFileChooser();
jfc
if(jfc
File selectfile=jfc
try {
FileReader reader=new FileReader(selectfile);
Scanner sc=new Scanner(reader);
while(sc
String line=sc
jta
}
try {
reader
} catch (IOException e
// TODO Auto
e
}
} catch (FileNotFoundException e
// TODO Auto
e
}
}
if(jfc
///////////////////////處理/////////////////////////////
javax
}
}else if(
JFileChooser jfc=new JFileChooser();
jfc
if(jfc
File selectfile=jfc
try {
PrintWriter pw=new PrintWriter(selectfile);//往文件裡寫
pw
pw
} catch (FileNotFoundException e
// TODO Auto
e
}
}
if(jfc
///////////////////////////////////添加//////////////////////////
javax
}
}else if(
JOptionPane jop=new JOptionPane();
String filePath=jop
// jop
String str
System
if(filePath
javax
}else {
javax
}
PrintWriter pw;
try {
pw = new PrintWriter(filePath);
pw
pw
} catch (FileNotFoundException e
// TODO Auto
e
}//往文件裡寫
}else if(
javax
}else if(
javax
}else if(
jf
}else if(
String str
jta
}else if(
ms
jta
}else if(
py();
}else if(
ms
jta
}else if(
String str
StringBuffer strbuf=new StringBuffer(jta
int temp
jta
}else if(
ms
exchange myExchange=new exchange(this);
}else if(
ms
String str
StringBuffer str
str
str
jta
}else if(
ms
Date dt=new Date();
SimpleDateFormat formater=new SimpleDateFormat();
formater
String str
StringBuffer sb
String temp=new String(sb
jta
/////////////////加載時間////////////////////////
}else if(
ms
}else if(
help myhelp=new help(this);
}else if(
javax
}
}
public static void main(String[] args){
NoteBook nb=new NoteBook();
}
}
////////////////////替換類////////////////////////
class exchange implements ActionListener{
JDialog jd;
JTextField jf
JTextField jf
JTextArea jta;
public exchange(Object obj){
if(obj instanceof NoteBook){
NoteBook nb=(NoteBook)obj;
jd=new JDialog(nb
jta=nb
}
jf
jf
JLabel jl
JLabel jl
JButton jb
jb
JButton jb
jb
JPanel jp
jp
jp
JPanel jp
jp
jp
JPanel jp
jp
jd
jd
jd
Toolkit tk=Toolkit
jd
jd
jd
jd
}
public void actionPerformed(ActionEvent e) {
// TODO Auto
System
if(
String str=jf
String str
str
jta
}
if(
jd
}
}
}
/////////////////幫助類///////////////////
class help implements ActionListener{
JDialog jd;
public help(Object obj){
if(obj instanceof NoteBook){
NoteBook nb=(NoteBook)obj;
jd=new JDialog(nb
}
JMenuBar jmb=new JMenuBar();
JMenuItem jm
jm
JMenuItem jm
jm
jmb
jd
jd
Toolkit tk=Toolkit
jd
jd
jd
jd
}
public void actionPerformed(ActionEvent e) {
// TODO Auto
System
if(
javax
}
if(
javax
}
}
}
//////////////////////////我的堆棧///////////////////////
class myStack{
List list;
public myStack(){
list=new ArrayList();
}
public void push(Object obj){
if(obj instanceof String){
String str=(String)obj;
list
}else{
System
}
}
public String pop(){
String obj=(String)list
list
return obj;
}
}
////////////////////////////////////////////////////////////
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26798.html