简体   繁体   English

将焦点jtextfield放在exteds jPanel中

[英]getting focused jtextfield in exteds jPanel

i was searching for date chooser solution i'd founed this: 我正在寻找日期选择器解决方案我已经犯了这个问题:

https://pzt.me/9oan (pw bravvve) https://pzt.me/9oan(pw bravvve)

in the jFrame: 在jFrame中:

        private JDateChooser getJDateChooser() {  
        if (jChoixDate == null) {  
            jChoixDate = new JDateChooser();  
            jChoixDate  
                    .setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);  
            jChoixDate.setBounds(new Rectangle(198, 90, 88, 21));  
            jChoixDate.estValide(false);  
            //jChoixDate.addActionListener(this);  
            jChoixDate.addFocusListener(this);  
            jChoixDate.getEditor().addFocusListener(this);  

        }  
        return jChoixDate;  
    }  

i'v done some modifications to know if the datefield is empty or not and some color modifications if its not enabled,well am using this date chooser in some jframe class,and i wan to know if the datefield is in the focus and if it is,i wan i that if i click some button it will be intialized,i'd traid many solution but none hase fonctionned,how can i do that,thanks 我做了一些修改,知道日期字段是否为空,如果没有启用则进行一些颜色修改,在某些jframe类中使用这个日期选择器,我想知道日期字段是否在焦点中,如果它是的,我想我,如果我点击一些按钮它将初始化,我会做很多解决方案,但没有任何事情,我怎么能这样做,谢谢

consider using good JCalendars/JDatePicker with great reputations, eg 考虑使用具有良好声誉的良好JCalendars / JDatePicker,例如

  1. JCalendar JCalendar

  2. SwingX SwingX

Shameless plug: 无耻插头:

Use the JDatePicker , you can fork it on github modify it to your heart's content, pull requests will be accepted if you make improvements. 使用JDatePicker ,您可以在github 上将它修改为您心中的内容,如果您进行了改进,将接受pull请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM