Customize textField control to accept date
I want to customize a JTextField control to be formatted so that it can be viewed as a date field in the format of dd-MM-yyyy and get a valid date from the users. And also I want a calender to appear beside the JTextField, so that the user gets an option to
pick the date from the calender.
Thanks in advance.
Hi Grant
Thanks for your reply.
I have found the 'Control Hints' panel for the EO Attribute I am interested in formatting.
The 'Format Type' drop down box displays only '<none>'
and the 'Format' drop down box displays nothing.
I have found the formatinfo.xml file (as described in the Help documentation) and added this to my project. When the project is compiled, this file is put in the output directory, as are the other xml files.
I expected this to populate these drop down boxes - but no.
Should my formatting be selected from these drop down boxes or can I simply type my required format into the 'Format' control?
The links in the Help documentation for the 'Control Hints' screen appear not to lead anywhere so I am unable to find out how to create a new Control Hint or to learn more about Control Hints.
Can you please assist.
Many thanks
Urmila
Similar Messages
-
TextField that accepts dates in DD-MM-YYYY format
I need to create a texfield that accepts dates in DD-MM-YYYY. Also, if the input does not correspond to a date, I want to trap focus in the control....
Thanks,
VOops, sorry for the previous post, it is not the code i am using...
Here it is:
import com.id.swing.mask.JMaskField;
import java.awt.Color;
import java.awt.Dimension;
import java.text.ParseException;
import javax.swing.JComponent;
import java.awt.Toolkit;
import javax.swing.JOptionPane;
import java.text.SimpleDateFormat;
import java.sql.Date;
import java.util.Locale;
import java.awt.event.FocusListener;
import java.awt.event.FocusEvent;
public class IdDateMask extends JMaskField implements FocusListener {
protected SimpleDateFormat m_sdfDbPattern;
protected SimpleDateFormat m_sdfUserPattern;
protected String m_userDatePattern = "ddMMyy";
protected String m_mask = "{[0-1]}#/{[0-3]}#/##";
protected boolean m_canBeNull;
public IdDateMask(String mask, String userPattern) {
super(mask);
super.setLocale(new Locale(System.getProperty("id.pyrites.user.language"),
System.getProperty("id.pyrites.user.country")));
m_userDatePattern = userPattern;//ie ddMMyy
m_canBeNull = true;
initialize();
protected void initialize(){
setForeground(new Color(51, 0, 255));
setDisabledTextColor(new Color(0, 0, 0));
setColumns(8);
setPreferredSize(new Dimension(84,20));
setMinimumSize(new Dimension(27,20));
setMaximumSize(new Dimension(128,20));
m_sdfDbPattern = new SimpleDateFormat("yyyy-MM-dd", getLocale());
m_sdfUserPattern = new SimpleDateFormat(m_userDatePattern, getLocale());
m_sdfUserPattern.setLenient(false);
public void focusGained(FocusEvent e) {
this.setBackground(new Color(255,204,204));
public void focusLost(FocusEvent e) {
isValidDate();
this.setBackground(Color.WHITE);
public boolean canBeNull() {
return m_canBeNull;
public void setCanBeNull(boolean value) {
m_canBeNull = value;
public boolean isValidDate() {
boolean retVal = false;
try {
String theStr = super.getText();//ie: 310802
if(!canBeNull()) {
if (theStr.equals("")) throw(new Exception());
else m_sdfUserPattern.parse(theStr);//ParseException can be thrown here
} else {
if(!theStr.equals("")) System.out.println(m_sdfUserPattern.parse(theStr));//ParseException can be thrown here
return true;
} catch (ParseException ex) {
System.out.println("IdDateMask - verifyDate() - ERROR: " + ex.getMessage());
Toolkit.getDefaultToolkit().beep();
try {
JOptionPane.showMessageDialog(IdDateMask.this,
java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValid") + m_userDatePattern,
java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValidDlgTitle"),
JOptionPane.ERROR_MESSAGE);
} catch(Exception e) {
System.out.println("IdDateMask - verifyDate() - I18N - ERROR: " + e.getMessage());
JOptionPane.showMessageDialog(IdDateMask.this,
"MSG_DATE_notValid" + m_userDatePattern,
"MSG_DATE_notValidDlgTitle",
JOptionPane.ERROR_MESSAGE);
// super.setText("");
// this.requestFocus();
return false;
} catch (Exception ex) {
System.out.println("IdDateMask - verifyDate() - ERROR: " + ex.getMessage());
Toolkit.getDefaultToolkit().beep();
try {
JOptionPane.showMessageDialog(IdDateMask.this,
java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notNull"),
java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notNullDlgTitle"),
JOptionPane.ERROR_MESSAGE);
} catch(Exception e) {
System.out.println("IdDateMask - verifyDate() - I18N - ERROR: " + e.getMessage());
JOptionPane.showMessageDialog(IdDateMask.this,
"MSG_DATE_notNull",
"MSG_DATE_notNullDlgTitle",
JOptionPane.ERROR_MESSAGE);
// super.setText("");
// this.requestFocus();
return false;
public void setToday() {
setValue((new Date(System.currentTimeMillis())).toString());
public void setText(String value) {
setValue(value);
public void setValue(String value) {
if(!(value == null) && (!value.equals(""))) {
//We receive the yyyy-MM-dd format...
//The format of the displayed date is m_userDatePattern
//So, we have to transform YYYY-MM-dd into for example ddMMYY
//Let's do it.
try {
//If the field is empty, a ParseException is thrown
String valueToDisplay = m_sdfUserPattern.format(m_sdfDbPattern.parse(value));
super.setText(valueToDisplay);
//Next we have to localize it according to medium format
} catch (ParseException ex) {
System.out.println("IdDateMask - setValue("+ value +") - ERROR: " + ex.getMessage());
Toolkit.getDefaultToolkit().beep();
try {
JOptionPane.showMessageDialog(IdDateMask.this,
java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValidInput") + value,
java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValidInputDlgTitle"),
JOptionPane.ERROR_MESSAGE);
} catch(Exception e) {
System.out.println("IdDateMask - setValue("+ value +") - I18N - ERROR: " + e.getMessage());
JOptionPane.showMessageDialog(IdDateMask.this,
"MSG_DATE_notValidInput" + value,
"MSG_DATE_notValidInputDlgTitle",
JOptionPane.ERROR_MESSAGE);
} else {
super.setText("");
public String getText() {
return getValue();
public String getValue() {
//Return date with format yyyy-MM-dd
//But i have a String of format m_userDatePattern
try {
if(canBeNull() && (super.getText().equals(""))) return "";
else {
String outputDateStr = m_sdfDbPattern.format(m_sdfUserPattern.parse(super.getText()));
return outputDateStr;
} catch (ParseException ex) {
System.out.println("IdDateMask - getValue() - ERROR: " + ex.getMessage());
Toolkit.getDefaultToolkit().beep();
try {
JOptionPane.showMessageDialog(IdDateMask.this,
java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValid") + m_userDatePattern,
java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValidDlgTitle"),
JOptionPane.ERROR_MESSAGE);
} catch(Exception e) {
System.out.println("IdDateMask - getValue() - I18N - ERROR: " + e.getMessage());
JOptionPane.showMessageDialog(IdDateMask.this,
"MSG_DATE_notValid" + m_userDatePattern,
"MSG_DATE_notValidDlgTitle",
JOptionPane.ERROR_MESSAGE);
return "";
public void setEnabled(boolean value) {
super.setEnabled(value);
//color section
public void setBackgroundText(Color c) {
setBackground(c);
public void setForegroundText(Color c) {
setForeground(c); -
How to compare Date in the TextField or DateTime with Date/Time field?
Hi All,
I am facing an issue with respect Date comparinson. I tried to look into entire discussions but failed to get the answer.
My issue is: I wanted to comparet Date/time field value with Date value which is in TextField.
The functionality of my form is:
I have dropdown list which lists the registered customer ids binded to XML Datasource. On selection of the customer id from the dropdown I am displaying customer registration date in the TextField or say Date/Time field as below code in dropdown change event.
RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value; (this is TextField control)
In form I have an Date/Time field in which use will select the date of item purchase. In the validation part I want to make sure that, the purchase date selected in Date/Time field must be greater than the Customer Registraiton Date. I able to compare if the customer selects the date from two different Date/Time fields. But how to compare the dates which one is in Date/Time field and Date is in TextField?
I have tried using Num2Date and Date2Num with "YYYY-MM-DD" format to compare but not succeed!
Can you guys help me in this? Thanks in advance
Regards.Hi,
Yes, I am able to display the date which I have assigned to the text box. In the message box it show the value as '31/05/2009', since in this format i am assigining the date in the text box.
Here is the code which I am assigning the value:
RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value;
Do I need to change the format while assigning value in text box?
You have told that, you have attached your test form, nothing is the reply. Can you repost the file?
Regards. -
now in india, java is being taught in ICSE syllabus as computer application. I find it very difficult to accept data during run time
in dos mode to teach the use of control structures.A lot of people do, that is the motivation behind the BlueJ development environment.
http://www.bluej.org
Did you have a question to ask too? -
How can I use table control to enter data
Hi all,
I want to use table control to enter data, instead of using textboxes.
So that the user can enter many data at once and just click the save button at the end of the work, only one click.
How can I use the table control at this context?
Thanks.
Deniz.Hi deniz,
go through it:
/people/ravishankar.rajan/blog/2007/02/23/an-easier-way-of-displaying-and-editing-data-using-table-control
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/code%2bto%2bhandle%2bmultiple%2brecords%2bin%2bbdc%2btable%2bcontrol
Regards, -
Dear all,
How can I control the Post Date (WADAT_IST) when I use BAPI_OUTB_DELIVERY_CONFIRM_DEC to PGI?
Thanks to help me.In ECC 6.0, I used this BAPI to perform the picking using this way:
1. Implement enhancement point BAPI_OUTB_DELIVERY_CONFIRM_D01 in enhancemnt spot ES_SAPLV50I to set the update picking flag on delivery control structure.
GS_DLV_BAPI_CONTROL-UPDATE_PICKING = 'X'
2. Implement enhancement of standard BADI SMOD_V50B0001. Use method EXIT_SAPLV50I_004 to loop at table CT_VBPOK and update the fields VBELN and POSNN with suitable values.
There is one problem with this solution, though. The delivery quantity cannot be updated. Any increase in the delivery qty ITEM_DATA-DLV_QTY actually updates the picked quantity on the delivery. Consequently, there is little practical use of this technique.
John -
Control actual GI date using BAPI_OUTB_DELIVERY_CONFIRM_DEC
Hi Guys:
I am using BAPI_OUTB_DELIVERY_CONFIRM_DEC to perform PGI against delivery order automaticlly.
But I find this BAPI can't specify the actual GI date,and SAP just default current date as GI date.
Is there any parameter can control this GI date for this BAPI?
Or any other solution?
Thanks.
StephenHi Junwen,
Did you call the BAPI_TRANSACTION_COMMIT afterwards?
Before this the data is not saved. After that it is saved.
Regards,
Rob. -
Retrieving acceptable date format
I'm developing a script using SAP GUI Scripting API,
There are some fields on user's screen which must be filled with a date.
For some users, these fields accepts date in MM.DD.YYYY format, while for some others the accepted format is DD.MM.YYYY.
My question is: How can I know which date format is accepted by a GuiComponent in order to make the correct input?
Could not find any method or property in any component that could give me a clue.
(I'm having troubles with decimal values too, once I cannot determine if the separator is a dot or a comma, but I suppose solving the date problem may lead to solving this one too.)
Thanks in advance.Hi Ycarus,
there are as always several solutions. One of these might look like this:
For example, is the date entered as follows:: 01.03.2011
on error resume next
session.findById("wnd[0]/usr/. . .").text = "31.12.9999"
if error.number > 0 or error.number < 0 then
session.findById("wnd[0]/usr/. . .").text = "03.01.2011"
else
session.findById("wnd[0]/usr/. . .").text = "01.03.2011"
end if
on error goto 0
To find out whether a comma or a decimal point to be used as a separator, you could take a similar approach.
Regards,
ScriptMan
Edited by: ScriptMan on Mar 28, 2011 11:10 AM -
Change acceptance date in I-recruitment
I accepted an applicant in iRec but input the wrong date for acceptance. Now I want to change the date so that the applicant can be hired earlier than the accept date.
But in fact, the applicant should be accepted on 2012-03-02 as he got onboard on 2012-03-05. With the wrong date of acceptance, the hiring date has to be postponed to at least one day after 2012-03-10, e.g., the earliest hiring day is 2012-03-11 in this case.
We can’t update the date in iRec. Could you help to provide a solution to ensure that the issue can be fixed and the applicant can be hired on time.Hi,
You can change the date from Core HR form.
Search for the Applicant ->Click on Other->Application and change the Accepted status and update the Date.
Thanks -
Why we are not using "Message Control" for Master data ?
Hi friends,
We are using Message control as output determination for Transactional data, <b>what is the main reason for not using the msg control for Master data.</b>Please explain with details...
I am very thankful to them...
Thanks and Regards.
<i><b>Naveen Kumar. Chamala</b></i>Hi Naveen,
Listing down those I know -
1. Master data is expected to be changed/created less frequestly.
2. Transactional data is expected to be chnaged/created more frequestly.
3. Transactions to create/change/display master data do no have message control integration, since you are not supposed to print/fax/mail master data to your partners.
4. Distribution of master data in generally supposed to happen within Enterprise boundry and typically you will have one central server maintaining master data which will be distributed to multiple downstream operation system (Some thing where MDM fits). So ideally when distributing master data using ALE you will be sending it to multiple systems.
5. Distributing transactional data PO/SO etc is same as sending fax/print which fits with the requirement of message control.
Hope this helps,
Regards,
Sanjeev -
Managed Beans vs. POJO Data Control for sharing data
Hi,
I am currently using JAX-WS proxy client and POJO Data Controls to retrieve data from web services. This data needs to be shared across users. Normally I would use application scoped managed beans for this, but since I prefer using data controls and the binding layer, would using static POJO Data Control classes achieve the same thing?Hi,
Data Controls don't exist across user sessions so in your use case use a managed bean in application scope. If you want to make this available from a Data Control
- create a POJO
- Use EL in the POJO to access the managed bean
- Create a DataControl from the POJO
This way the Data Control exposes the data as an API but itself always reaches out to the managed bean as a data store/cache
Frank -
Authorization control when fetching data from PA OM tables
Hi all,
I want to know how to control DB level authorization using HR_READ_INFOTYPE and RP_READ_INFOTYPE. Taht is, i want to check whetehr the user who is executing a report is having read authorization for that infotype. If not, i should not fetch the data and the report should return error message?
Instead of authorization (std, custom) object, i want to control when fetching data from PA and OM tables in HR. How to achieve the same?As EJP said, your query might have problem with the using clause. Post your query.
It gives an exception when I try to run the query, and I'm trying to fetch all columns not only 'taskid'
java.sql.SQLException: ORA-25154: column part of USING clause cannot have qualifier
Yes, with the exact sql query he posted. It gives that exception.I guess you are trying to fetch all the columns by using the above query which i posted. No you should not fetch all the columns. Because the rs will only the three columns.
Also, use 'as' with that query like,
select t1.taskid as t1_taskid, t2.taskid as t2_taskid ,t3.taskid as t3_taskid from...Edited by: Ram on Aug 23, 2011 6:20 PM -
Customization credit control area at Plant level.
Dear Experts,
Presently we have have customization credit control area on sales organization level, Can we set the same on plant level.
if it possible in standard SAP please guide me the same, How do i set the same
Thanks and Best Regards,
BK GAIKWADhi
this is to inform you that
this is not possible in standard SAP.
through ENHANCEMENT you can solve it.
balajia -
Deviation acceptance date expired in MIGO
Hello All,
When i am doing GR for a Schedule agreement. I am getting this Error "Deviation acceptance date expired".
I have checked other threads before posting in forum.
Here material is not shelf life managed material. But still i am getting this error.
Kindly help me out to over come this error
Regards,
Manojmessage no Showed here is ZEMIN_MSG043 is it customized message
-
ORA-01190: control file or data file 1 is from before the last RESETLOGS
hi, experts.
i have oradb 11g and using it for OIM11
after some actions in oim i try to get my db to previous state (many times it was done successfully)
but now i have problem ORA-01190: control file or data file 1 is from before the last RESETLOGS
im runing in noarchivelog mode
i have autobackup of controlfile and i have 2 backups of my db
please help me
maybe some one know how to restore my backup to new db and then change configuration of wls and oim...Hi, Thanks for reply
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
1 1 OIMDB 2372279074 PARENT 1 02-APR-10
2 2 OIMDB 2372279074 PARENT 940976 11-JUL-11
3 3 OIMDB 2372279074 PARENT 5590849 09-AUG-11
4 4 OIMDB 2372279074 PARENT 5590850 10-AUG-11
5 5 OIMDB 2372279074 PARENT 5596482 11-AUG-11
7 7 OIMDB 2372279074 PARENT 5596483 11-AUG-11
8 8 OIMDB 2372279074 PARENT 5596484 12-AUG-11
6 6 OIMDB 2372279074 ORPHAN 5622931 11-AUG-11
9 9 OIMDB 2372279074 PARENT 5627526 18-AUG-11
10 10 OIMDB 2372279074 PARENT 5627527 18-AUG-11
11 11 OIMDB 2372279074 ORPHAN 5627528 18-AUG-11
12 12 OIMDB 2372279074 CURRENT 5627528 18-AUG-11
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
9 Full 1.50G DISK 00:00:31 12-AUG-11
BP Key: 9 Status: AVAILABLE Compressed: NO Tag: TAG20110812T114515
Piece Name: D:\APP\999-ILYASOV\FLASH_RECOVERY_AREA\OIMDB\BACKUPSET\2011_08_12\O1_MF_NNNDF_TAG20110812T114515_749PJDCW_.BKP
List of Datafiles in backup set 9
File LV Type Ckp SCN Ckp Time Name
1 Full 5627525 12-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\SYSTEM01.DBF
2 Full 5627525 12-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\SYSAUX01.DBF
3 Full 5627525 12-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\UNDOTBS01.DBF
4 Full 5627525 12-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\USERS01.DBF
5 Full 5627525 12-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\DEV_OIMLOB.DBF
6 Full 5627525 12-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\DEV_IASSDPM.DBF
7 Full 5627525 12-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\DEV_MDS.DBF
8 Full 5627525 12-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\DEV_SOAINFRA.DBF
9 Full 5627525 12-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\DEV_OIM.DBF
BS Key Type LV Size Device Type Elapsed Time Completion Time
10 Full 9.36M DISK 00:00:01 12-AUG-11
BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20110812T114515
Piece Name: D:\APP\999-ILYASOV\FLASH_RECOVERY_AREA\OIMDB\BACKUPSET\2011_08_12\O1_MF_NCSNF_TAG20110812T114515_749PKJJS_.BKP
SPFILE Included: Modification time: 12-AUG-11
SPFILE db_unique_name: OIMDB
Control File Included: Ckp SCN: 5627525 Ckp time: 12-AUG-11
BS Key Type LV Size Device Type Elapsed Time Completion Time
11 Full 1.33G DISK 00:00:26 16-AUG-11
BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20110816T094954
Piece Name: D:\APP\999-ILYASOV\FLASH_RECOVERY_AREA\OIMDB\BACKUPSET\2011_08_16\O1_MF_NNNDF_TAG20110816T094954_74N183D7_.BKP
List of Datafiles in backup set 11
File LV Type Ckp SCN Ckp Time Name
1 Full 6118204 16-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\SYSTEM01.DBF
2 Full 6118204 16-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\SYSAUX01.DBF
3 Full 6118204 16-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\UNDOTBS01.DBF
4 Full 6118204 16-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\USERS01.DBF
5 Full 6118204 16-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\DEV_OIMLOB.DBF
6 Full 6118204 16-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\DEV_IASSDPM.DBF
7 Full 6118204 16-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\DEV_MDS.DBF
8 Full 6118204 16-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\DEV_SOAINFRA.DBF
9 Full 6118204 16-AUG-11 D:\APP\999-ILYASOV\ORADATA\OIMDB\DEV_OIM.DBF
BS Key Type LV Size Device Type Elapsed Time Completion Time
12 Full 9.36M DISK 00:00:01 16-AUG-11
BP Key: 12 Status: AVAILABLE Compressed: NO Tag: TAG20110816T094954
Piece Name: D:\APP\999-ILYASOV\FLASH_RECOVERY_AREA\OIMDB\BACKUPSET\2011_08_16\O1_MF_NCSNF_TAG20110816T094954_74N197JO_.BKP
SPFILE Included: Modification time: 16-AUG-11
SPFILE db_unique_name: OIMDB
Control File Included: Ckp SCN: 6118204 Ckp time: 16-AUG-11How to reset database to right incarnation.?
Maybe you are looking for
-
'thin' fonts on an external monitor
Hi, I am using an x200 with an external LG monitor 1680 x 1050, 32bit with 120DPI font. The text seems very 'thin / weak' and is a challenge to read. Is there away of 'blackening' the text to make it nore legible ?
-
I get - chosen to open a default.aspx - when I try to open a website
When I open a website I get "you have chosen to open default.aspx which is a aspx.File from www.coldwatercreek.com. What should firefox do with this file. This happened after the update to 4.0. I can open the site in Internet Explorer.
-
Hello, I have a problem on my netbook. All system "freeze" on disconnecting my wifi connection... lately also my wifi connection is not as stable as used to be. uname -a Linux crom 2.6.37-ARCH #1 SMP PREEMPT Fri Feb 11 09:29:49 CET 2011 x86_64 Intel(
-
Extracting Data From HR InfoTypes
Hi Experts, I am implementing HR(Personnal Administation) module. Here I need to extract data using InfoTypes. So can any body pls help me How to create Generic Datasource with InfoTypes? Hoe to Extract Data using HR InfoTypes? If any body having any
-
Image turns negative when cropping.
When I try to crop in CS6 the image turns negative until I finish the crop when it goes back to positive. Anything I can do to stop this?