Blink your image in Java  

Posted by Fast Fire Fish in ,

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;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.image.BufferedImage;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;


public class BlinkingLabel extends JLabel implements Runnable{

private boolean show=false,blink=true;
private Icon iconImg;
private JLayeredPane parent;

public BlinkingLabel(Icon icon, JLayeredPane pane)
{
super(icon);
this.iconImg = icon;
this.parent = pane;

this.setVisible(true);
new Thread(this).start();

}

public void run() {
while (blink) {
show=!show;

if(show)
parent.moveToFront(this);
else
parent.moveToBack(this);

repaint();
try { Thread.sleep(400); } catch (Exception e) { }
}
}

public boolean isBlink() {
return blink;
}

public void setBlink(boolean blink) {
this.blink = blink;
}

}

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!

Read More...


Bookmark this post:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

How to insert a Custom RSS Icon  

Posted by Fast Fire Fish in

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

Step 1
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.

Read More...


Bookmark this post:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Hello!!!!!!!!!!!! Firefox Lovers...  

Posted by Fast Fire Fish in

I assume you are at least a little bit curious about what I have to share about this add-on. Yes it is an add-on. U heard me. Alright let's spill the beans. Straight to the point.

 QUESTION
But whats the hit about this one in a million add-on?



Let's take a sneak...how about browsing images like this....

Cooliris Snap



Alright I can see you really want to find out more? This is an online 3D image viewer. You can search for images using your favorite search engine(Google, flickr etc) and have the 3D viewer display the images you in a cool and stylish fashion!
Keyboard navigation keys allow traversal through the photos one by one. Alright enough with the details, I'll let you have the honor of uncovering the rest.

But meanwhile lets keep those curiosity in suspension for just a little while with another picture.


Cooliris Snap2


Alright alright. I heard you. You just want to know this thing so badly now huh? Its named as the Cooliris (formerly known as the PicLens).

Hope you've enjoyed my recommendation. Tell me if you do find it useful! For now...go get it tiger!


Read More...


Bookmark this post:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Don't you just love Nintendo Wii?  

Posted by Fast Fire Fish in ,

Don't you just love what technology has changed our lives? Maybe not all, but most of it, I do. For those gamers out there, specifically Nintendo Wii lovers or owners, are u really sure you know what appears to be packed and hidden in
Nintendo Wii? Well... let's find out!



Pretty impressive if you asked me. Well who stole the limelight this time? It appears that the big guy(Nintendo Wii console) is not real deal after all. It is the REMOTE that allows such a high end solution to be available at a cheap cost.

This video was sort of inspiration too as people's thoughts' are often bounded by the box. Sometimes we just got to think of out of usual and make miracles happen. Easier said than done I know, but don't give up, one day it might be your turn.

Read More...


Bookmark this post:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Can't wake up early? Yes u can!!!  

Posted by Fast Fire Fish in

Waking up early either for work, during your weekends or even during your free time can be a challenge for most people. At least for me. Maybe its just me, however, during the days that I do actually manage to get my lazy bum off the bed EARLY, indeed I will feel fresher and also be more competent in carrying out task. Some may nod their head and agrees with what I have to say. Sounds good but hard to do? Maybe the tips that I'm going to share will have a life impact on the rest of our life. If you really wanna become an early riser, READ ON!



8 Steps to Rising Early

Early Riser Step 1: Stop blaming yourself.
Stop giving excuses of why u can't do it. Don't blame it on your genes, health, the things you ate last night or whatever u can think of!? It has nothing to do with why u need more sleep!

Early Riser Step 2: Get plenty of fresh air.
The first thing you have to do when you wake up is to breathe in fresh air! Stop going back to your bed for 1 more minute of lazing around and go for fresh air instead!

Early Riser Step 3: Don't eat before you sleep.
The last thing that goes to your mouth should be 3 hours before you sleep.

Early Riser Step 4: Don't use the snooze button.
According to research, it is harder to wake up after using your snooze button than waking up when the alarm first goes off!

Early Riser Step 5: Put flowers in your bedroom.
It has been proven that people who woke up sleeping in a room full of flowers seem to be happier? (I'm gonna pass on this one :p)

Early Riser Step 6: Brighten up your walls.
Bright wall colors has been proven to activate energy cells!

Early Riser Step 7: Stretch.
Give your body 5-15 minutes of stretching, it might work wonders for u.

Early Riser Step 8: Start the day with a smile.
The physical act of smiling actually produces endorphins which in fact gives you energy and drive. So smile your day away! (*Important* Be careful to do it discretely or people might steer clear from u!)

That's a quickie! I'm not saying I have done all that...but err....lets just say we all work hard together to achieve a more healthier life.

Taken from: How to become an Early Riser



Read More...


Bookmark this post:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

The Top Commentators Widget for Blogger  

Posted by Fast Fire Fish in

Today I've added another new widget to my sidebars. As the title suggest, yes it is called the "Top Commentator" widget. I guess it is pretty self explanatory from the look of the name. Though it is not the first widget I've added to my list, I thought I should start sharing my widgets with the rest of the community.

WHY THIS WIDGET?



The reason why I recommend this widget is that it provides ease of adding it to blogger and I thought it will be great to recognize and appreciate your readers.



Ready to do it? Lets roll!

 
So...this widget basically allows you to customize the way you want it, for example the number of top commentators that you wish to see be it 5 or 10(There can be other numbers not just these 2 but I haven't tried the limitations). The title can also be changed to something else other than the default "Top Commentators". The last thing is to filter off your own nick. You don't want your own nick to be listed on that list do you?

While every information has been filled, just click on the "Add Widget to My blog" button and it will automatically direct the page to the blogger site where you have to log in if you haven't done so. Just put it at the position where u want it on your page and u will be good to go!




Read More...


Bookmark this post:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Create your own media player with Java Media Framework(JMF)  

Posted by Fast Fire Fish in ,

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.

Read More...


Bookmark this post:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Hate your iTunes? Maybe you should hack it......  

Posted by Fast Fire Fish in

Hey its been a while since my last entry. But anyway I was toying around with my iTunes. I know its not such a great player and there are tons of more fantastic players out there. The reason I started using it is because I had an ipod mini back and thought iTunes would "probably" be the best man to interface with the syncing of songs. I'm not a fussy person when it comes to media song player so just stick on for the sake of familiarity.

TODAY, I'm going to share with you a hack on iTunes. Guess it always started with the problem huh?

Problem: How do I delete duplicated songs in bulk?


Resolution
The key word would be "bulk" as highlighted in red. For a few songs you might want to do it the manual way of using iTunes existing "Show Duplicates" function to manually delete the songs. However, you could better automate things the way it wasn't.

Steps

1) Get iTunes Library Updater

2) Do the usual installation and start up the interface.
( click on start->programs->ITLU->ITLU(GUI) )

3) Configure how you would like like the updater to sync your files and remove invalid entries which appears as a sickening exclamation mark whenever iTunes couldn't find the location of the file. DONE!


Guess what? You can even have your library updated and keep in sync if ever a new media file were to be added to your library. I duno for you, but it sure solves my problem. For more advance scheduling of automated library sync using the iTunes Library Updater, you could refer to the source which can also be found at the end of the post. Its not that hard since to schedule it to update your library on a regular basis. If you encounter any problem, I'll try my best to help. cheers!


Source: Deleting Duplicate Songs in iTunes

Read More...


Bookmark this post:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Ready, Aim, SHOOT!  

Posted by Fast Fire Fish in

What's the first thing on your mind? Hopefully not something out of the way :p. U know what I'm talkin about. Well finally after years of yearning to own a my very own digital camera(camera phone's not counted), I finally brought myself to do it at the Singapore's very own "Comex IT Fair"! Of course not wholeheartedly as I was "forced"(in a good way) to buy something so as to claim back part of the cost. Thats beside the case.

I'm going to showcase some of my opening shots here which I have taken very unprofessionally. I didn't even start reading my user manual before I took the shots as I was unable to withstand the temptation of my Fujifilm Finepix F50fd. I won't even go into why I bought this camera and not others and the fact is that it is not according to planned. Enough said: here's my unprofessional random shots....brace yourself and enjoy(hopefully).







Exactly the same except without flash

Now for some macro shots!






And wrapping things up with a nice relaxing sunset...ahhhh~~~





Hope thats not too bad for a start

Read More...


Bookmark this post:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Drink Driving or Drink Flying?  

Posted by Fast Fire Fish in

Whats wrong with super heros nowadays. It seems that they r breaking the laws more than helping out. Don't get what I'm sayin..? See for yourself!




Ouch! ***BUSTED***

Read More...


Bookmark this post:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Ever desire to create your own graffiti?  

Posted by Fast Fire Fish in

How you wish you could create those fanciful graffitis that you see on the walls of some god forsaken alleys. Well...if you do, this website provides you a decent tools to get things going just a little bit closer....erm except on the walls of course. I find that the tools and sprays are pretty realistic in a sense that if you hold on to the spray button, the paint will appear getting denser on the targeted area of impact. Below is an image created by one of my friends from the very website that I am recommending u today.




Can you guess what he is drawing? He is trying to mimic a portrait of "The Crow".
Have a go, try it! Who knows you might have some hidden talent within :P

Graffiti Customizer!

Read More...


Bookmark this post:
StumpleUpon Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Your Ad Here