Ever need to make an image blink continuously to signal for some kind of incoming activity? Well....I'm going to share a simple sample on how to do that.
import java.awt.Graphics; |
The concept of this BlinkingLabel class is to pass in a secondary image along with another JLayeredPane object which is the main container for the original image. That is to say we are actually making use of the 2 images one of which shows the original state and the other is actually the lighted up state. Upon instantiating an object with this class, the secondary image will be toggled on and off with a variable of 400 milliseconds. You can tweak this setting if you wish it to be faster or slower.
Of course this is just one of the ways to make an image blink repeatedly. I'm sure there are other methods like overriding the paintComponent method or something.
If you've enjoyed this article, drop me a comment!
I was meddling with some of the blog sites and I saw they have this customized RSS icon at some corner of the site. I thought to myself ...why not? If you are close follower of my blog, you would have noticed the addition of the black cowboy hat that lingers at the top right corner of my blog site. On it is a signature RSS logo which was tied to this white ribbon around the hat. So.... for those of you who shares the same thought for the moment, I'm going to provide a guide on how to add that personal touch to that site of yours.
GUIDE
Firstly you got to get a custom RSS icon which at least you fancy. If you got no idea where to get it, you could try here.
Step 2
Look around your site's template design to source for a suitable location for the placement of the custom rss logo.
Step 3
Upload the picture to some online photo hosting sites like photobucket. Create an account if you do not have one, upload the picture and get the URL which points directly to the image. (Eg. http://myrsslogo.jpg)
Step 4
Use the following code block to insert the image link in your desired location. Insert the URL of the picture where you uploaded in Step 3, and replace the code at "YOUR IMAGE URL" with the URL you've got.
<a href="YOUR FEED ADDRESS URL" target="_blank"> <img src="YOUR IMAGE URL" border="0" /> </a> |
Also remember to link your rss logo image to your feed address URL which should be replace at "YOUR FEED ADDRESS URL".
You should see your custom logo up and running. Congrats!! IF your logo is in a odd shape like mine, you might want to customized the hyperlink to the shape of your image. That way, your hyperlink only works within the shape of the image. I used Microsoft Frontpage to generate the what you call the "Image Map" that bounds the region of the hyperlink.
Step 5(Optional)
Open the image with Microsoft Frontpage. Insert-> Picture -> From File
Step 6
Select an image map tool which is either rectangle, circle or polygon. The best tool which suits your needs of course to draw the outline of the image. Finish the outline and choose a destination for the hyperlink.
Step 7
The code generated will be something like this:
<map name='Map0'> <area coords='24, 61, 28, 40, 35, 30, 43, 26, 54, 24, 64, 24, 73, 26, 83, 24, 96, 28, 100, 41, 104, 49, 102, 55, 119, 53, 125, 35, 127, 60, 127, 69, 126, 76, 119, 82, 107, 87, 96, 91, 31, 96, 20, 99, 54, 104, 45, 107, 35, 108, 25, 108, 15, 104, 9, 104, 1, 100, 0, 86, 1, 78, 54, 71, 13, 63' href='YOUR FEED ADDRESS URL' shape='polygon' target='_blank'/> </map> <img alt='RSS Black Hat' border='0' src='YOUR IMAGE URL' usemap='#Map0'/> |
Copy the code and paste it in your site. Save and now your hyperlink is customized!
That's all for today's quickie.
Create your own media player with Java Media Framework(JMF)
Posted by Fast Fire Fish in java, programming
For those who are working with Java, you might be interested with Java's capability of playing media files with its Java Media Framework(JMF). Today I'm going to share a simple guide to get this working.
Steps
1)Get the installation software from Sun's website here.
2)You might need to restart your machine as one of my friends had this problem and it was resolved after that.
3)Copy and paste the code from here
4)If you do not have a sample mpeg file, you might want to download it here. Save the file to some location in your harddisk and remember where u save it.
5)Compile and launch the code with assuming you already have the standard jdk package installed. Select the mpeg file from the location where it is stored and it should start the video playing.
That's it! I hope I made it simpler if you are looking for a crash course.
For a more detailed explanation of the codes, I believe the source has already explained in great detail.
Its been a while ever since my last posting, I've explored into the reigns of JQuery. I'm not an expert but I did toyed around with it for a while and got something to work. Been rather busy lately, and I believe there are still many wonderful applications that I would love to share with u using JQuery. For now,the demonstrations that I'm going to show u is something like a fading effect that u normally see in websites like photobucket.com whereby during a slide show, the photo fades as it traverse through the album.
Here: Photo Fader



