java swing datagrid_swing-gui经典实例源码

importjava.util.Calendar;//util包,Calendar类importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.io.*;importjava.util.Hashtable;//util包,哈希表?可以设置键key,寻找匹配。/*** This code was edited or generated using CloudGarden's Jigloo

* SWT/Swing GUI Builder, which is free for non-commercial

* use. If Jigloo is being used commercially (ie, by a corporation,

* company or business for any purpose whatever) then you

* should purchase a license for each developer using Jigloo.

* Please visit www.cloudgarden.com for details.

* Use of Jigloo implies acceptance of these licensing terms.

* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR

* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED

* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.*/publicclassCalendarPadextendsJFrameimplementsMouseListener//声明接口{intyear,month,day;

Hashtable hashtable;

File file;

JTextField showDay[];

JLabel title[];

Calendar 日历;//此类有什么方法?int星期几;

NotePad notepad=null;

Month 负责改变月;

Year 负责改变年;

String 星期[]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};

JPanel leftPanel,rightPanel;publicCalendarPad(intyear,intmonth,intday)

{

JPanel leftPanel=newJPanel();

JPanel leftCenter=newJPanel();

JPanel leftNorth=newJPanel();

leftCenter.setLayout(newGridLayout(7,7));

JPanel rightPanel=newJPanel();

rightPanel.setPreferredSize(newjava.awt.Dimension(262,256));//设置右边面版的大小?this.year=year;//把形参传给实参。this.month=month;this.day=day;

负责改变年=newYear(this);

负责改变年.setYear(year);

负责改变月=newMonth(this);

负责改变月.setMonth(month);

title=newJLabel[7];//用来显示星期的LabelshowDay=newJTextField[42];for(intj=0;j<7;j++)

{

title[j]=newJLabel();

title[j].setText(星期[j]);

title[j].setBorder(BorderFactory.createRaisedBevelBorder());//什么意义?leftCenter.add(title[j]);

}

title[0].setForeground(Color.red);

title[6].setForeground(Color.blue);for(inti=0;i<42;i++)//添加显示日期的TextField,并未设置setText(){

showDay[i]=newJTextField();

showDay[i].addMouseListener(this);

showDay[i].setEditable(false);

leftCenter.add(showDay[i]);

}

日历=Calendar.getInstance();//得到当前日期?Box box=Box.createHorizontalBox();//Box的定义,new 呢 ?box.add(负责改变年);

box.add(负责改变月);

leftNorth.add(box);

leftPanel.setLayout(newBorderLayout());

leftPanel.add(leftNorth,BorderLayout.NORTH);

leftPanel.add(leftCenter,BorderLayout.CENTER);

leftPanel.add(newLabel("请在年份输入框内输入所查年份(负数表示公元前),并回车确定"),BorderLayout.SOUTH);

leftPanel.validate();//显示所包含组件Container con=getContentPane();//什么意义?this.setFocusCycleRoot(false);//什么意义?JSplitPane split=newJSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftPanel,rightPanel);//什么?中间带条的?con.add(split,BorderLayout.CENTER);

con.validate();

hashtable=newHashtable();

file=newFile("日历记事本.txt");//在当前目录下新建:日历记事本.txt文件。若已经存在呢?if(!file.exists())

{try//文件输入输出操作步骤{//file=new File("日历记事本.txt");建立文件对象FileOutputStream out=newFileOutputStream(file);//建立输出流对象,以文件对象为参数。ObjectOutputStream objectOut=newObjectOutputStream(out);//建立输出对象,以输出流为参数。objectOut.writeObject(hashtable);//把文件内容写进哈希表。objectOut.close();//关闭out.close();

}catch(IOException e)

{

}

}

notepad=newNotePad(this);

rightPanel.add(notepad);

设置日历牌(year,month);

addWindowListener(newWindowAdapter()//覆盖接口方法。{publicvoidwindowClosing(WindowEvent e)

{

System.exit(0);

}

});

setVisible(true);//没有显式声明Frame,即JFrame f=new JFrame("标题");因为继承。this.setBounds(29,52,570,285);//大小位置。x,y,Width,Heightthis.setTitle("\u5927\u6c14\u8c61&\u78a7\u5929\u98de\u9e64");this.setResizable(false);//窗口大小不可改变。validate();//检查包含的组件。}publicvoid设置日历牌(intyear,intmonth)

{

日历.set(year,month-1,1);//设置哪年哪月哪日,month为什么-1?星期几=日历.get(Calendar.DAY_OF_WEEK)-1;//get方法得到上面设置的,为什么-1?if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)

{

排列号码(星期几,31);

}elseif(month==4||month==6||month==9||month==11)

{

排列号码(星期几,30);

}elseif(month==2)

{if((year%4==0&&year%100!=0)||(year%400==0))

{

排列号码(星期几,29);

}else{

排列号码(星期几,28);

}

}

}publicvoid排列号码(int星期几,int月天数)//排列本月号码需要从上月开始算。{for(inti=星期几,n=1;i

{

showDay[i].setText(""+n);//""+n表示:把n用字符串表示。if(n==day)

{

showDay[i].setForeground(Color.green);

showDay[i].setFont(newFont("TimesRoman",Font.BOLD,20));

}else{

showDay[i].setFont(newFont("TimesRoman",Font.BOLD,12));

showDay[i].setForeground(Color.black);

}if(i%7==6)

{

showDay[i].setForeground(Color.blue);

}if(i%7==0)

{

showDay[i].setForeground(Color.red);

}

n++;

}for(inti=0;i

{

showDay[i].setText("");

}for(inti=星期几+月天数;i<42;i++)

{

showDay[i].setText("");

}

}publicintgetYear()//引用时,int a = this.getYear();{returnyear;

}publicvoidsetYear(inty)//调用时,this.setYear(8);{

year=y;

notepad.setYear(year);

}publicintgetMonth()

{returnmonth;

}publicvoidsetMonth(intm)

{

month=m;

notepad.setMonth(month);

}publicintgetDay()

{returnday;

}publicvoidsetDay(intd)

{

day=d;

notepad.setDay(day);

}publicHashtable getHashtable()

{returnhashtable;

}publicFile getFile()

{returnfile;

}publicvoidmousePressed(MouseEvent e)

{

JTextField source=(JTextField)e.getSource();//定义组件的另外一种方法。此法完全引用了事件源组件的所有属性。try{

day=Integer.parseInt(source.getText());

notepad.setDay(day);

notepad.设置信息条(year,month,day);

notepad.设置文本区(null);

notepad.获取日志内容(year,month,day);

}catch(Exception ee)

{

}

}publicvoidmouseClicked(MouseEvent e)

{

}publicvoidmouseReleased(MouseEvent e)

{

}publicvoidmouseEntered(MouseEvent e)

{

}publicvoidmouseExited(MouseEvent e)

{

}publicstaticvoidmain(String args[])

{

Calendar calendar=Calendar.getInstance();//得到当前日期。inty=calendar.get(Calendar.YEAR);intm=calendar.get(Calendar.MONTH)+1;intd=calendar.get(Calendar.DAY_OF_MONTH);newCalendarPad(y,m,d);

}

}

<div style=";text-align:center;;height:auto;" class="datagrid-cell datagrid-cell-c1-checkId">已通过</div></td><td field="button"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-button"><a href="#" style="color: red" onclick="fileManager(0)">图片管理</a></div></td><td field="truckNo"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-truckNo">辽PD6885</div></td><td field="truckCardColor"><div style=";text-align:center;;height:auto;" class="datagrid-cell datagrid-cell-c1-truckCardColor">黄牌</div></td><td field="vtNam"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-vtNam">秦皇岛九福物流有限公司</div></td><td field="driverNam"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-driverNam">叶红建</div></td><td field="linkTel"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-linkTel">13842929049</div></td><td field="workCompanyCod"><div style=";text-align:center;;height:auto;" class="datagrid-cell datagrid-cell-c1-workCompanyCod">金海粮油</div></td><td field="cargoNam" style="display:none;"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-cargoNam"></div></td><td field="consignCod" style="display:none;"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-consignCod"></div></td><td field="planDte"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-planDte">2023-05-01</div></td><td field="validTyp"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-validTyp">当天有效</div></td><td field="ifEnd"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-ifEnd">x</div></td><td field="individualId" style="display:none;"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-individualId">0</div></td><td field="rejectReason"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-rejectReason"></div></td><td field="checkNam"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-checkNam">jhly</div></td><td field="checkTim"><div style=";height:auto;" class="datagrid-cell datagrid-cell-c1-checkTim">2023-04-29 21:09</div></td>以上代码为网页源码,帮我写一段python程序从以上代码中找出drivernam和checkTim并保存数据库中
最新发布
06-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值