Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Next step in developing a calendar component  RSS feed

 
David Garratt
Ranch Hand
Posts: 216
Eclipse IDE Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My ultiimate objecttve is to replace the rather basic plain jspinner controls I am using for date / time entry on my input forms. I have created a class called JCalendar which extends JPanel and has all the necessary functionality to display the date and time. Image attached. What I'm hoping someone can help me with is the next step. I'm not sure if I want to subclass the existing jspinner and add another button to the right which will invoke my panel, or just go for a simple read only display of the date time with a button next to it which will invoke my code.

I have to admit that creating a date time component is not my ultimate goal, but I've not found an open souce date and time one, only commercial. So far it's only taken me a couple of days to get the calendar logic right, but I've not delved into creating my own controls before and I was hoping for a an example of something similar which I can use as a head start.

Bits which may or may not be difficult are when the panel overlaps the edge of the frame and does not fit on the desktoppane - dunno - just thinking out loud.

Any links to resources which you think may point me in the right direction would be great.

Thanks

Dave
2010-05-29_201704.gif
[Thumbnail for 2010-05-29_201704.gif]
2010-05-29_201515.gif
[Thumbnail for 2010-05-29_201515.gif]
 
Dave Lorde
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't quite see what your question is here... can you be more specific?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I'm not sure if I want to subclass the existing jspinner and add another button to the right which will invoke my panel,

unless you want to use the spinner buttons to increment/decrement the spinner value without your panel showing,
you could remove the existing listeners from the spinner buttons, then use those buttons to trigger your panel showing,
instead of adding another button.

the above may depend on the L&F used.


> Bits which may or may not be difficult are when the panel overlaps the edge of the frame and does not fit on the desktoppane

I would have thought your panel would show in a popup, and java would/should/possibly does (?) handle that situation.


another possibility is to use a JComboBox with its built-in popup
a simple example is here
http://www.java.happycodings.com/Java_Swing/code15.html
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...but I've not found an open souce date and time one, only commercial..

http://www.toedter.com/en/jcalendar/index.html
 
David Garratt
Ranch Hand
Posts: 216
Eclipse IDE Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you everyone. I will study the examples and adapt for my needs.

Appreciated.

Dave
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!