java - JCalender not showing day number -
i using below library jcalender, date picker gui can put netbeans pallet.
date date = showdatechooser.getdate(); dateformat dateformat1 = new simpledateformat("e"); string day = dateformat1.format(date); dateformat dateformat2 = new simpledateformat("yyyy/mm/dd"); string showdate = dateformat2.format(date);
since neither linked to, nor named jcalendar
implementation using, assume jcalendar kai tödter. - @ least can tell screenshot.
using component simple, example should do:
import java.awt.eventqueue; import javax.swing.jframe; import com.toedter.calendar.jcalendar; public class demo { private jframe frame; public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { demo window = new demo(); window.frame.setvisible(true); } catch (exception e) { e.printstacktrace(); } } }); } public demo() { initialize(); } private void initialize() { frame = new jframe(); frame.setbounds(100, 100, 450, 300); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.getcontentpane().setlayout(null); jcalendar calendar = new jcalendar(); calendar.setbounds(20, 20, 200, 20); frame.getcontentpane().add(calendar); } }
unfortunately, did not provide code use initialization of component. can call jcalendar
constructor either without parameters, passing date
object, calendar
object, locale
object or various combinations of before mentioned.
here complete list of valid constructors:
public jcalendar() public jcalendar(date date) public jcalendar(calendar calendar) public jcalendar(locale locale) public jcalendar(date date, locale locale) public jcalendar(date date, boolean monthspinner) public jcalendar(locale locale, boolean monthspinner) public jcalendar(boolean monthspinner) public jcalendar(date date, locale locale, boolean monthspinner, boolean weekofyearvisible)
to determine user's selection, can call getcalendar()
or getdate()
. set initial date, use setcalendar()
or setdate()
respectively. hope gets started. if have problems, feel free edit question or leave comment.
also, did check sample project contained in jcalendar zip file?
Comments
Post a Comment