Saturday, April 21, 2007

Transparancy Secret Of Yahoo Widget Engine Revealed

Well recently I moved one of my yahoo widgets to a new location and guess what i noticed! It revealed the yahoo widget's transparency secret...It uses the same old method that we use in java,the robot method("The method that most of the people did not like")!! and thats the truth here are the sequence of images:

1) before I hit the start button
2)I hit the start button
3)Upon press the start button again(notice that the captured image of the menu bar on the upper left widget):
4)After refreshing:
Should I conclude that the robot method is not that bad after all!huh?

Sunday, April 15, 2007

Make The Swing Fly

Recently this thing struck my head that i can make my JFrame(Swing components)"Fly In" when the application is started and fly out when the quit button is hit and ended up with the following code.Use it and add a better entrance and exit effect to your applications!!!!!
I'll be adding it to NYouTube.

Enjoy!
:-)


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test extends JFrame {

JFrame f;
JButton jb;
Dimension t;
public Test(){
f=new JFrame("Flying window");
jb=new JButton("Quit");
//Get the screen size
t=Toolkit.getDefaultToolkit().getScreenSize();
jb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
//The Fly Out effect
for(int i=t.width/2;i>=0;i-=2)
{
f.setLocation(i,i);
f.repaint();

}
System.exit(0);
}
});

f.getContentPane().add(jb);
f.pack();
f.setSize(100,100);
f.setDefaultCloseOperation(3);
f.setVisible(true);
//The Fly In effect
for(int i=0;i<=t.width/2;i+=2)
{
f.setLocation(i,i);
f.repaint();

}

}
public static void main(String[] s)
{
new Test();
}

}