- 讲师:刘萍萍 / 谢楠
- 课时:160h
- 价格 4580 元
特色双名师解密新课程高频考点,送国家电网教材讲义,助力一次通关
配套通关班送国网在线题库一套
百度广告
此主题相关图片
/*
*
*
* and open the template in the editor.
import Java.awt.BasicStroke;
import Java.awt.Color;
import Java.awt.Cursor;
import Java.awt.Font;
import Java.awt.Graphics2D;
import Java.awt.Point;
import Java.awt.Stroke;
import Java.awt.event.FocusEvent;
import Java.awt.event.MouseAdapter;
import Java.awt.event.MouseListener;
import Java.text.SimpleDateFormat;
import Java.util.Calendar;
import Java.util.Date;
import Javax.swing.BorderFactory;
import Javax.swing.JFrame;
import Javax.swing.JPanel;
import Javax.swing.PopupFactory;
import Javax.swing.event.AncestorEvent;
/**
* @author hadeslee
public class DateChooser extends JPanel{
private Calendar now=Calendar.getInstance();
private JPanel monthPanel;//月历
private JP2 jp2;
private JP4 jp4;
private final LabelManager lm=new LabelManager();
private SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日");
private Popup pop;
* Creates a new instance of DateChooser
public DateChooser() {
}
initDate=date;
select.setTime(initDate);
initLabel();
public void setEnabled(boolean b){
showDate.setEnabled(b);
/**
*/
return select.getTime();
//根据初始化的日期,初始化面板
monthPanel=new JPanel(new BorderLayout());
JPanel up=new JPanel(new BorderLayout());
up.add(jp2=new JP2(),BorderLayout.CENTER);
monthPanel.add(up,BorderLayout.NORTH);
this.addAncestorListener(new AncestorListener(){
//只要祖先组件一移动,马上就让popup消失
hidePanel();
}
private void initLabel(){
showDate.setRequestFocusEnabled(true);
public void mousePressed(MouseEvent me){
}
// toSelect=new JLabel(sdf.format(initDate));
// toSelect.setRequestFocusEnabled(true);
this.add(showDate,BorderLayout.CENTER);
this.setPreferredSize(new Dimension(90,25));
showDate.addMouseListener(new MouseAdapter(){
if(showDate.isEnabled()){
showDate.setForeground(Color.RED);
}
if(showDate.isEnabled()){
showDate.setForeground(Color.BLACK);
}
if(showDate.isEnabled()){
if(isShow){
}else{
}
}
if(showDate.isEnabled()){
}
});
public void focusLost(FocusEvent e){
}
});
//根据新的日期刷新
jp1.updateDate();
SwingUtilities.updateComponentTreeUI(this);
//提交日期
System.out.println("选中的日期是:"+sdf.format(select.getTime()));
hidePanel();
private void hidePanel(){
isShow=false;
pop=null;
}
if(pop!=null){
}
SwingUtilities.convertPointToScreen(show,showDate);
int x=show.x;
if(x< 0){
}
size.width-295){
}
if(y
责编:罗莉
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
点击加载更多评论>>