电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

java电子日记本代码及运行结果

java电子日记本代码及运行结果_第1页
java电子日记本代码及运行结果_第2页
java电子日记本代码及运行结果_第3页
// 程序主类 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...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

小辰8+ 关注
实名认证
内容提供者

出售各种资料和文档

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部