Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
Hi everyone,

I am just ten (10) days old in Java programming though I have knowledge of VB.Net.

Please I'll be very glad if I can get assistance in the following area:

1. How to close a JFrame form (i.e. in .Net the code is me.close or end)

2. How to use MDI form in Java

3. Which object can be used to accept date value just like we have datepicker in .Net or in the alternative what code can one use with JTextField object to accept date values.

Thanks
Posted
Comments
H.Brydon 14-Apr-13 22:42pm    
Two things here:
(1) You have asked 3 questions. The nature of the system is to ask one fairly well formed question, with considerable background information supporting your query, which should generally be somewhat complex, requiring more than a 10 word answer. Your questions really just somewhat accomplish the latter.
(2) The questions that you have asked are very simple in nature, showing little or no research into the issues on your own. The expectation here is that questions asked be complex enough that Google doesn't know the answer. ... and Google is very smart. This forum is not for asking questions about how to turn on your computer or how to do the basics of something which is described in (say) the product directions.

If you want to close your JFrame, you just need to call:
Java
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //your main class must extend JFrame
//or use this otherwise
yourFrame.setDefaultCloseOperation(JFram.EXIT_ON_CLOSE);


This ensures that when you press "X" button on your frame, it will close like any other frame.

And as for using date values in java, look into this class:
Java
java.util.Date


Best regards.
 
Share this answer
 
v2
Comments
Filipe Marques 8-May-13 4:28am    
Be careful. If you use this.setDefaultCloseOperation yours clase must be extend to JFrame, otherwise you must do tourFrame.setDefaultCloseOperation. If he wants exit of his program during the execution of something, you have System.exit(yourCode).
Filipe
nameJulian 8-May-13 7:35am    
Indeed...very good remark Filipe Marques. Thank you.
Filipe Marques 8-May-13 8:35am    
Thanks Julian ;)
1. search for it - common problem.
2. There is no MDI. You can use Swing, SWT, JFace or another GUI. That's one of the big advantages of Java. I recommend Swing for the beginning.
3. there are widgets for that depending on the GUI you're using.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900