Yuk Nge-BLOG

Saturday, July 08, 2006

hey... this is Swingx!!!

I was so amazed with SwingX. SwingX is extended capabilities for Swing. I think people who love Swing programming will try SwingX. Try this program :

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

import org.jdesktop.swingx.JXDatePicker;

public class DatePickerDemo extends JFrame{

public DatePickerDemo(){
super("Date Picker Demo");

final JXDatePicker dp = new JXDatePicker();
final JTextField jtf = new JTextField(20);
JButton jb = new JButton("Get Date");
jb.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
jtf.setText(""+dp.getDate());
}
});

getContentPane().setLayout(new FlowLayout());
getContentPane().add(dp);
getContentPane().add(jb);
getContentPane().add(jtf);

setSize(300,100);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}

public static void main(String[] args) {
new DatePickerDemo();
}
}

WOW !!! its amazing !!! I can create a date picker with a few lines of code !!!!

Wanna try????

0 Comments:

Post a Comment

<< Home