Creative Zii EGG on its way
Nokia N900
Mimoco is back with more Star Wars thumb drives
Nokia Booklet 3G is really real, as seen on camera
Update: Nokia might be mum on the issue, but Intel tells Pocket-lint that it's got the 1.6GHz Intel Atom Z530 chipset, which isn't exactly known for its HD video prowess but can technically do up to 720p. No word on any other technology that make the HDMI port more logical, but if there is was, it's probably not coming fromBroadcom -- both companies have denied involvement with the Booklet.
Autonomous Fire Guard Concept
Casio’s Latest EX-Z33 10.1MP Digicam
Here is the latest addition to the Casio digital camera series. The Casio EX-Z33 is an entry-level camera that boasts a 10.1MP CMOS sensor with a 3x optical zoom lens, a highly visible 2.5 inch widescreen display, Automatic face recognition, Best Shot function, and Auto Shutter mode. The camera provides YouTube Capture Mode, which records and saves movies at the ideal settings for YouTube. Recorded video can be easily uploaded to site using the special included computer software.
AOC 2436Vw 24-Inch Eco-Friendly LCD Monitor
Logitech rolls out the Performance Mouse MX and the Anywhere Mouse MX
These mice include Logitech’s Darkfield Laser Tracking Technology that allows users to use these mice almost anywhere. These mice offer users complete control of their digital world. The hyper-fast scrolling feature makes navigating through long documents quick and easy. The click-to-click mode of these mice offers more precision while navigating lists, photos and slide shows.
The Logitech Performance Mouse MX is a full-sized mouse that features a flexible micro-USB charging system. This system allows users to charge their mouse through the computer or a wall outlet. The mouse features four customizable thumb buttons that allow users to easily switch applications and zoom in and out of web pages.
“Laptops have gained popularity in the last several years because of the freedom they afford – people today want to be able to connect to their digital world anytime, anywhere. However, until now, no mouse has been able to match that flexibility,” said Rory Dooley, Logitech’s senior vice president and general manager of the Control Devices business unit. “Thanks to Logitech Darkfield, whether you’re checking the morning news from the granite counter top in your kitchen or at work manipulating a spreadsheet from your glass desk, you can be confident that your Logitech mouse will be up to the task.”
The Logitech Anywhere Mouse MX is a small portable laptop mouse that works virtually anywhere. Along with being easily portable, this mouse is designed to comfortably fit into the contours of the user’s hand. The mouse also features back and forward buttons within the reach of the thumb. Both these mice include the Logitech Unifying receiver that allows users to plug up to five other compatible Logitech devices.
Sony's PlayStation 3 Slim stand gets pictured... all $24 of it
Apple sells 25% of music in the US, none of which is AC/DC
NPD finds featurephones account for 72% of new handset sales in the US
Date combo box
import java.awt.event.*;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import javax.swing.*;
import javax.swing.event.PopupMenuListener;
import javax.swing.event.PopupMenuEvent;
import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.basic.ComboPopup;
import javax.swing.plaf.metal.MetalComboBoxUI;
import javax.swing.border.Border;
import javax.swing.border.EtchedBorder;
import javax.swing.border.EmptyBorder;
import com.sun.java.swing.plaf.motif.MotifComboBoxUI;
import com.sun.java.swing.plaf.windows.WindowsComboBoxUI;
public class DateComboBox extends JComboBox {
protected SimpleDateFormat dateFormat = new SimpleDateFormat("MMM d, yyyy");
public void setDateFormat(SimpleDateFormat dateFormat) {
this.dateFormat = dateFormat;
}
public void setSelectedItem(Object item) {
// Could put extra logic here or in renderer when item is instanceof Date, Calendar, or String
// Dont keep a list ... just the currently selected item
removeAllItems(); // hides the popup if visible
addItem(item);
super.setSelectedItem(item);
}
public void updateUI() {
ComboBoxUI cui = (ComboBoxUI) UIManager.getUI(this);
if (cui instanceof MetalComboBoxUI) {
cui = new MetalDateComboBoxUI();
} else if (cui instanceof MotifComboBoxUI) {
cui = new MotifDateComboBoxUI();
} else if (cui instanceof WindowsComboBoxUI) {
cui = new WindowsDateComboBoxUI();
}
setUI(cui);
}
class MetalDateComboBoxUI extends MetalComboBoxUI {
protected ComboPopup createPopup() {
return new DatePopup( comboBox );
}
}
class WindowsDateComboBoxUI extends WindowsComboBoxUI {
protected ComboPopup createPopup() {
return new DatePopup( comboBox );
}
}
class MotifDateComboBoxUI extends MotifComboBoxUI {
protected ComboPopup createPopup() {
return new DatePopup( comboBox );
}
}
class DatePopup implements ComboPopup, MouseMotionListener,
MouseListener, KeyListener, PopupMenuListener {
protected JComboBox comboBox;
protected Calendar calendar;
protected JPopupMenu popup;
protected JLabel monthLabel;
protected JPanel days = null;
protected SimpleDateFormat monthFormat = new SimpleDateFormat("MMM yyyy");
protected Color selectedBackground;
protected Color selectedForeground;
protected Color background;
protected Color foreground;
public DatePopup(JComboBox comboBox) {
this.comboBox = comboBox;
calendar = Calendar.getInstance();
//String[] dts = {dt};
int yr = calendar.get(Calendar.YEAR);
int mn = calendar.get(Calendar.MONTH);
int dts = calendar.get(Calendar.DATE);
String dt = dts+"/"+mn+"/"+yr;
comboBox.addItem(dt);
// check Look and Feel
background = UIManager.getColor("ComboBox.background");
foreground = UIManager.getColor("ComboBox.foreground");
selectedBackground = UIManager.getColor("ComboBox.selectionBackground");
selectedForeground = UIManager.getColor("ComboBox.selectionForeground");
initializePopup();
}
public void show() {
try {
// if setSelectedItem() was called with a valid date, adjust the calendar
calendar.setTime( dateFormat.parse( comboBox.getSelectedItem().toString() ) );
} catch (Exception e) {}
updatePopup();
popup.show(comboBox, 0, comboBox.getHeight());
}
public void hide() {
popup.setVisible(false);
}
protected JList list = new JList();
public JList getList() {
return list;
}
public MouseListener getMouseListener() {
return this;
}
public MouseMotionListener getMouseMotionListener() {
return this;
}
public KeyListener getKeyListener() {
return this;
}
public boolean isVisible() {
return popup.isVisible();
}
public void uninstallingUI() {
popup.removePopupMenuListener(this);
}
public void mousePressed( MouseEvent e ) {}
public void mouseReleased( MouseEvent e ) {}
// something else registered for MousePressed
public void mouseClicked(MouseEvent e) {
if ( !SwingUtilities.isLeftMouseButton(e) )
return;
if ( !comboBox.isEnabled() )
return;
if ( comboBox.isEditable() ) {
comboBox.getEditor().getEditorComponent().requestFocus();
} else {
comboBox.requestFocus();
}
togglePopup();
}
protected boolean mouseInside = false;
public void mouseEntered(MouseEvent e) {
mouseInside = true;
}
public void mouseExited(MouseEvent e) {
mouseInside = false;
}
// MouseMotionListener
public void mouseDragged(MouseEvent e) {}
public void mouseMoved(MouseEvent e) {}
// KeyListener
public void keyPressed(KeyEvent e) {}
public void keyTyped(KeyEvent e) {}
public void keyReleased( KeyEvent e ) {
if ( e.getKeyCode() == KeyEvent.VK_SPACE ||
e.getKeyCode() == KeyEvent.VK_ENTER ) {
togglePopup();
}
}
public void popupMenuCanceled(PopupMenuEvent e) {}
protected boolean hideNext = false;
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
hideNext = mouseInside;
}
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {}
protected void togglePopup() {
if ( isVisible() || hideNext ) {
hide();
} else {
show();
}
hideNext = false;
}
// Note *** did not use JButton because Popup closes when pressed
protected JLabel createUpdateButton(final int field, final int amount) {
final JLabel label = new JLabel();
final Border selectedBorder = new EtchedBorder();
final Border unselectedBorder = new EmptyBorder(selectedBorder.getBorderInsets(new JLabel()));
label.setBorder(unselectedBorder);
label.setForeground(foreground);
label.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
calendar.add(field, amount);
updatePopup();
}
public void mouseEntered(MouseEvent e) {
label.setBorder(selectedBorder);
}
public void mouseExited(MouseEvent e) {
label.setBorder(unselectedBorder);
}
});
return label;
}
protected void initializePopup() {
JPanel header = new JPanel(); // used Box, but it wasn't Opaque
header.setLayout(new BoxLayout(header, BoxLayout.X_AXIS));
header.setBackground(background);
header.setOpaque(true);
JLabel label;
label = createUpdateButton(Calendar.YEAR, -1);
label.setText("<<");
label.setToolTipText("Previous Year");
header.add(Box.createHorizontalStrut(12));
header.add(label);
header.add(Box.createHorizontalStrut(12));
label = createUpdateButton(Calendar.MONTH, -1);
label.setText("<");
label.setToolTipText("Previous Month");
header.add(label);
monthLabel = new JLabel("", JLabel.CENTER);
monthLabel.setForeground(foreground);
header.add(Box.createHorizontalGlue());
header.add(monthLabel);
header.add(Box.createHorizontalGlue());
label = createUpdateButton(Calendar.MONTH, 1);
label.setText(">");
label.setToolTipText("Next Month");
header.add(label);
label = createUpdateButton(Calendar.YEAR, 1);
label.setText(">>");
label.setToolTipText("Next Year");
header.add(Box.createHorizontalStrut(12));
header.add(label);
header.add(Box.createHorizontalStrut(12));
popup = new JPopupMenu();
popup.setBorder(BorderFactory.createLineBorder(Color.black));
popup.setLayout(new BorderLayout());
popup.setBackground(background);
popup.addPopupMenuListener(this);
popup.add(BorderLayout.NORTH, header);
}
// update the Popup when either the month or the year of the calendar has been changed
protected void updatePopup() {
monthLabel.setText( monthFormat.format(calendar.getTime()) );
if (days != null) {
popup.remove(days);
}
days = new JPanel(new GridLayout(0, 7));
days.setBackground(background);
days.setOpaque(true);
Calendar setupCalendar = (Calendar) calendar.clone();
setupCalendar.set(Calendar.DAY_OF_WEEK, setupCalendar.getFirstDayOfWeek());
for (int i = 0; i < 7; i++) {
int dayInt = setupCalendar.get(Calendar.DAY_OF_WEEK);
JLabel label = new JLabel();
label.setHorizontalAlignment(JLabel.CENTER);
label.setForeground(foreground);
if (dayInt == Calendar.SUNDAY) {
label.setText("Sun");
} else if (dayInt == Calendar.MONDAY) {
label.setText("Mon");
} else if (dayInt == Calendar.TUESDAY) {
label.setText("Tue");
} else if (dayInt == Calendar.WEDNESDAY) {
label.setText("Wed");
} else if (dayInt == Calendar.THURSDAY) {
label.setText("Thu");
} else if (dayInt == Calendar.FRIDAY) {
label.setText("Fri");
} else if (dayInt == Calendar.SATURDAY){
label.setText("Sat");
}
days.add(label);
setupCalendar.roll(Calendar.DAY_OF_WEEK, true);
}
setupCalendar = (Calendar) calendar.clone();
setupCalendar.set(Calendar.DAY_OF_MONTH, 1);
int first = setupCalendar.get(Calendar.DAY_OF_WEEK);
for (int i = 0; i < (first - 1); i++) {
days.add(new JLabel(""));
}
for (int i = 1; i <= setupCalendar.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {
final int day = i;
final JLabel label = new JLabel(String.valueOf(day));
label.setHorizontalAlignment(JLabel.CENTER);
label.setForeground(foreground);
label.addMouseListener(new MouseListener() {
public void mousePressed(MouseEvent e) {}
public void mouseClicked(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {
label.setOpaque(false);
label.setBackground(background);
label.setForeground(foreground);
calendar.set(Calendar.DAY_OF_MONTH, day);
comboBox.setSelectedItem(dateFormat.format(calendar.getTime()));
hide();
comboBox.requestFocus();
}
public void mouseEntered(MouseEvent e) {
label.setOpaque(true);
label.setBackground(selectedBackground);
label.setForeground(selectedForeground);
}
public void mouseExited(MouseEvent e) {
label.setOpaque(false);
label.setBackground(background);
label.setForeground(foreground);
}
});
days.add(label);
}
popup.add(BorderLayout.CENTER, days);
popup.pack();
}
}
public static void main(String args[])
{
JFrame f = new JFrame();
Container c = f.getContentPane();
c.setLayout(new FlowLayout());
c.add(new JLabel("Date:"));
DateComboBox dcb = new DateComboBox();
c.add(dcb);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
f.setSize(200, 100);
f.show();
}
}
CallableStatement
class CallableDemo
{
public static void main(String s[])
{
try{
String name="sun";
String pwd="ktm";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:dsn7");
CallableStatement st=con.prepareCall("{call pselect1(?,?)}");
st.setString(1,"vinu");
st.registerOutParameter(2,Types.VARCHAR);
st.executeUpdate();
String status=st.getString(2);
System.out.println(status);
//con.close();
}catch(Exception e){System.out.println(e);}
}
}
BufferedOutputStream
public class BufferedOut
{
public static void main(String args[])throws IOException
{
String str="India is my Countery";
byte buffer[]=str.getBytes();
FileOutputStream fs=new FileOutputStream("ss.text");
BufferedOutputStream br=new BufferedOutputStream(fs);
try
{
br.write(buffer,0,str.length());
br.flush();
}
catch(IOException e)
{
System.out.println(e);
}
}
}
Batch execution
class BatchDemo
{
public static void main(String s2[])
{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:syam");
Statement st=con.createStatement();
String str1="insert into login values('s','g')";
st.addBatch(str1);
String str2="insert into login values('q','w')";
st.addBatch(str2);
st.executeBatch();
}catch(Exception e){System.out.println(e);}
}
}
Autocommit
class AutoCommitDemo
{
public static void main(String s2[])
{
Connection con=null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:syam");
con.setAutoCommit(false);
Statement st=con.createStatement();
st.executeUpdate("insert into student values(1,'veena')");
st.executeUpdate("insert into mark values(1,50)");
con.commit();
}catch(Exception e1){
try{
con.rollback();
}catch(Exception e2){System.out.println(e2);}
}
finally{
try{
con.setAutoCommit(true);
}catch(Exception e2){System.out.println(e2);}
}
}
}
Acer reportedly set to launch three touch-enabled, Windows 7-based devices
Atree J100 gets lost in the forest of Korean PMPs
RIM working on Bluetooth watch, other spellbinding accessories?
'Sources' say no Apple tablet until 2010
How to convert a java file folder in to jar
To compile this programme yourself, make sure;
all the source code is in the same folder
all the images are in a folder called images
type in a DOS window, javac *.java to compile all the source code
type jar -cvfm chess.jar manifest.txt *.class images/*.gif
that will put all the files in an executable jar file
Command for opening a JAR File
E:/syam>jar -xvf sample.jar