Guest User

Untitled

a guest
Dec 10th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. if(dcs1.getDate().toString().isEmpty()){
  2. lblOk.setText("Empty");
  3. }else{
  4. Date d = dcs1.getDate();
  5. DateFormat df = new SimpleDateFormat("MM-dd-yyyy");
  6. String t = df.format(d);
  7. lblOk.setText(t);
  8. }
  9. JLabel lblOk;
  10. JDateChooser dcs1;
  11.  
  12. Date date;
  13. date = JDateChooser.getDate();
  14.  
  15. if (date == null)
  16. {
  17. JOptionPane.showMessageDialog(null, "Choose Date from Right Box.", "Error", JOptionPane.ERROR_MESSAGE);
  18. JDateChooser.grabFocus();
  19. return false;
  20. }
  21.  
  22. String s = ((JTextField)dateChooser.getDateEditor().getUiComponent()).getText();
  23. if (s.equals("") {
  24. JOptionPane.showMessageDialog(null, "Please type birthday", "Warning!", JOptionPane.ERROR_MESSAGE);
  25. }
  26.  
  27. if (jDateChooserBirthDate.getDate() == null) {
  28. JOptionPane.showMessageDialog(null, "Please type birthday", "Warning!", JOptionPane.ERROR_MESSAGE);
  29. }
  30.  
  31. if(jDateChooser1.getDate() == null){
  32. JOptionPane.showMessageDialog(this, "Date not selected","No selection",JOptionPane.INFORMATION_MESSAGE);
  33. jDateChooser1.requestFocusInWindow();
  34. }
  35.  
  36. String test = dateChooserID.getText();
  37. if(!test.equals("")){
  38. //DO WHATEVER YOU WANT (DATE IS SELECTED IN THIS CASE);
  39. }
  40. else{
  41. JOptionPane.showMessageDialog(this, "date not choosen");
  42. }
Add Comment
Please, Sign In to add comment