Test.yes.setVisible(true); Test.cancel.setVisible(true); Test.text3.setVisible(true); Test.text1.setVisible(false); Test.text1.setEditable(false);
Test.text1.setText(\ Test.sldday.setVisible(true); Test.yearbox.setVisible(true); Test.yearlabel.setVisible(true); Test.monthbox.setVisible(true); Test.monthlabel.setVisible(true); Test.daybox.setVisible(true); Test.daylabel.setVisible(true); Test.sldtime.setVisible(false); Test.hourbox.setVisible(false); Test.mhlabel.setVisible(false);
Test.minutebox.setVisible(true); Test.today.setEnabled(false); } } }
这里主要是用来对备忘记事的添加按钮进行监听,使点击添加按钮后能够显示相应的文本区和按钮。
Test.java
// Test.finished.setEnabled(false);
Test.daybox.setSelectedItem(ACalendar.strbuttonday); Test.hourbox.setSelectedItem(Test.strhour); Test.minutebox.setSelectedItem(Test.strminute);
Test.yearbox.setSelectedItem(ACalendar.strbuttonyear); Test.monthbox.setSelectedItem(ACalendar.strbuttonmonth);
//记事本主窗口 import java.io.*; import java.awt.*; import javax.swing.*;// import javax.swing.event.*;
import static javax.swing.JFrame.*;// import javax.swing.JButton; import java.awt.event.*; import java.lang.Exception; import java.util.Date; import java.text.*; import java.applet.Applet;
import java.text.SimpleDateFormat;
public class Test extends JFrame { String //自行设定的时间
Date d = new Date(); SimpleDateFormat
SimpleDateFormat(\
String str=sdf.format(d); //系统当前时间
int x,y;
static boolean changeboolean;
boolean yesboolean,yearboolean,monthboolean; JMenuBar menubar;
NongLi nong=new NongLi();
String m=nong.shower();
JTextField nltext=new JTextField(m);
sdf=new
year,month,day,hour,minute;
static String stryear,strday,strmonth,strhour,strminute;
static JMenu today;//,finished; static JButton addbutton,yes,cancel; static JButton change,delete,save,cancel1; static JTextField music= new JTextField(20);
static JTextArea text1,text2,text3; static JCheckBox sldday,sldtime; static
JComboBox
yearbox,monthbox,daybox,hourbox,minutebox;
static JLabel yearlabel,monthlabel,daylabel,mhlabel;
MyMenuListener1 menulistener1; MyMenuListener2 menulistener2; PoliceListen2 policelistener2; Test(){
MyWindowListener winlistener=new MyWindowListener(); addWindowListener(winlistener);//窗口监听 y=PoliceListen.y; x = PoliceListen.x;//获取位置
init(); }
void init(){ nltext.setFont(new
Font(\
华
文
行
\
stryear=str.substring(0,4); strmonth=str.substring(5,7); strday=str.substring(6,8); strhour=str.substring(8,10);
strminute=str.substring(10,12);
menubar=new JMenuBar();//菜单条 today=new JMenu(\今日待办\ //finished=new JMenu(\未完成\ addbutton=new JButton(\添加\
sldday= new JCheckBox(\指定日期\ sldtime=new JCheckBox(\提醒\ yes=new JButton(\确定\ cancel=new JButton(\取消\ save=new JButton(\保存\ cancel1=new JButton(\取消\
楷
delete=new JButton(\删除\ change=new JButton(\修改\ yearbox=new JComboBox
addbutton.setContentAreaFilled(false); addbutton.setBorderPainted(false);
text1=new JTextArea(13,17);
text2=new JTextArea(13,17);//需要删除 text3=new JTextArea(6,24); text1.setEditable(false);
text2.setEditable(false);//需要删除 add(music); add(nltext); add(save); add(cancel1); add(delete); add(change); add(text1); add(text2); add(text3);
nltext.setBounds(66,135,200,49); music.setBounds(180,180,30,39);
save.setBounds(180,210,60,25);
cancel1.setBounds(250,210,60,25); delete.setBounds(250,210,60,25); change.setBounds(180,210,60,25); text1.setBounds(7,7,300,200); text2.setBounds(7,7,300,200); text3.setBounds(7,7,300,90); sldday.setBounds(10,98,77,50); yearbox.setBounds(100,113,53,20); yearlabel.setBounds(158,112,20,20); monthbox.setBounds(175,113,40,20); monthlabel.setBounds(220,112,20,20); daybox.setBounds(238,113,40,20); daylabel.setBounds(283,112,20,20); sldtime.setBounds(50,140,77,50); hourbox.setBounds(140,155,40,20); mhlabel.setBounds(186,155,40,20); minutebox.setBounds(200,155,40,20); yes.setBounds(90,190,60,25); cancel.setBounds(160,190,60,25);
music.setVisible(false);
save.setVisible(false); cancel1.setVisible(false); sldday.setVisible(false); yearbox.setVisible(false); yearlabel.setVisible(false); monthbox.setVisible(false); monthlabel.setVisible(false); daybox.setVisible(false); daylabel.setVisible(false); sldtime.setVisible(false); hourbox.setVisible(false); mhlabel.setVisible(false); minutebox.setVisible(false); text1.setVisible(false);