// 程序主类 public class Diary { public static void main(String args[]) throws Exception { new LoginWindow(); Remember win=new Remember(); win.pack(); } } import javax.swing.*; import javax.swing.tree.*; import java.awt.*; import java.awt.event.*; import javax.swing.event.*; import java.io.*; import java.util.*; // 日记本类 class Remember extends JFrame implements TreeSelectionListener,ActionListener { private static final String DiaryRoot = null; JTree tree=null; int i=0,r=255,g=255,b=255; JTextArea text=new JTextArea(" ",20,50); DefaultMutableTreeNode root; DefaultMutableTreeNode month[]=new DefaultMutableTreeNode[13]; JButton b_save=new JButton("保存"), b_fontCommen=new JButton("还原"), b_fontBig=new JButton("大字"), b_fontRed=new JButton("红色"), b_fontBlue=new JButton("蓝色"), b_bg=new JButton("背景"); Remember() { Container con=getContentPane(); DefaultMutableTreeNode root=new DefaultMutableTreeNode("日记本"); //设置以月份为节点的树 for(i=1;i<=12;i++) { month[i]=new DefaultMutableTreeNode(""+i+"月"); root.add(month[i]); } //设置不同月份的节点 for(i=1;i<=12;i++) { //处理有31天的月份 if(i==1||i==3||i==5||i==7||i==8||i==10||i==12) { for(int j=1;j<=31;j++){ String s1=month[i].toString(); String s2=j+"日.txt"; File file=new File(DiaryRoot+s1+s2); //如果这一天写了日记则相应节点后面添加一个“*”来标志 if(file.exists()==true) month[i].add(new DefaultMutableTreeNode(j+"日*")); else month[i].add(new DefaultMutableTreeNode(j+"日")); } } //处理有30天的月份 else if(i==4||i==6||i==9||i==11) { for(int j=1;j<=30;j++){ String s1=month[i].toString(); String s2=j+"日.txt"; File file=new File(DiaryRoot+s1+s2); //如果这一天写了日记则相应节点后面添加一个“*”来标志 if(file.exists()==true) month[i].add(new DefaultMutableTreeNode(j+"日*")); else month[i].add(new DefaultMutableTreeNode(j+"日")); } } //处理有28天的月份 else { for(int j=1;j<=28...