Friday, October 28, 2011

Friday Fun Component XI

Here we go again...
I'm really busy these days which is the reason why the blog was not updated for such a long time but...it's friday again which means time for some fun...
Two days ago Geertjan Wielenga from the NetBeans team at Oracle contacted me and asked for a StickyNote component that he would like to use in the NetBeans platform (see the result here).
Well i liked the idea and i really like NetBeans which pushed me even a bit more to create the component.
Long story short...here it is...




As you could see it's really just a simple sticky note. It contains a JEditorPane that is editable which means you could put the sticky note somewhere and start typing. 
First i thought it would make sense to add a scrolling behaviour to the component too but a real sticky note also has no scrolling right... :)
The component comes with two kinds of fonts, the standard font which is Verdana and a handwriting font (which is default). But you can use whatever font you like by setting the customFont(java.awt.Font) and setCustomFontEnabled(true) methods. You might also want to change the color of the note which could be done by using the setNoteColor(java.awt.Color) method. So the result could look like these...




If you took a look at Geertjans blogpost and read the sticky notes on the screenshot you will find something like "Maybe add a  pin to note"...so why not adding a pin to the note just for the fun of it...




You could enable/disable the pin by using setPushPinVisible(true/false).


So here is the source (as NetBeans project) and a binary version that you could use directly...





That's it for today, so enjoy your weekend and keep coding...



5 Kommentare:

  1. Just... Amazing! I love it!

    ReplyDelete
  2. Woa! very cool, i would liked too the idea of do it... Exelent work, as always.

    ReplyDelete
  3. Recently, I read your presentation from JavaOne 2011 and I would like to know if you have step by step by step guide on how to convert a PSD file to java code?

    This is great by the way... Keep up the good work.

    ReplyDelete
  4. hello, thank you for such interesting post.
    I am new here, I tried to compile it and then run it (show it) in an appication but I dont know how.
    I tried to initialize it but nothing happened.

    thank you in advance

    ReplyDelete
  5. Hi Nick,
    The easiest approach would be using NetBeans where you could simply drag'n drop the StickyNote.java file on an existing JFrame in the GUI builder (that's the way i created the screenshots above). Otherwise you could also manualy add it to a JFrame or JPanel and it should work.
    Cheers,
    Gerrit

    ReplyDelete