Here I intend to show you a sample program which demonstrates how to get the values edited by user in JTable. This is accomplished by using the CellEditorListener Interface. Note the Table Header, Column values, the font type and font size is set custom.This sample program also has the ability to retrieve data from the cell, by mentioning the row and column.
Have a look on these API's that I have used specific for getting the results I just mentioned above
1) javax.swing.event.CellEditorListener
2) javax.swing.event.ChangeEvent
3) javax.swing.table.TableCellEditor
4) javax.swing.table.JTableHeader
Click here to view the code : JTableDemo (2)
Sample screenshots while executing the program
Thursday, April 3, 2008
JTable : Adding Cell Listeners, Getting cell values
Tuesday, April 1, 2008
JTableDemo : How to add rows to JTable, How to create a JTable by specifying Table Headers and Row Values.
The basic use of JTable is presenting Table, i.e, rows of column centric data to the user.
Here is a program that uses JTable to present such a sample data. Also provision for adding data/rows randomly.
The major Swing API's used for this pupose are
1) javax.swing.JTable
2) javax.swing.table.DefaultTableModel
There are more uses for this swing API, other than just presnting data.
Click Here to view the code
The figure is screenshot when the code mentioned here executes
Tuesday, March 25, 2008
Setting the Background Image on JFrame
To set the background image on JFrame, there is no such direct methods as setBackground(). So we have to build our own interfaces to do that. Here is an example which uses the JPanel swing component to set the Background Image.
Click here to view the code
or
Click here : JFrameBackgroundImage
Fig : shows the screen when you run the above code. you need to have an image named "image.jpg" for the background image to be placed in the same directory/folder where the class file resides.
Thursday, March 20, 2008

A simple program illustrating how to create a swing type frame and how to draw a string above it.
Sample Screen Shot
Click here to view the code
JFC Swing
FC is short for Java Foundation Classes, which encompass a group of features for building graphical user interfaces (GUIs) and adding rich graphics functionality and interactivity to Java applications.
"Swing" was the code name of the project that developed the new components. Although unofficial, it's frequently used to refer to the new components and related API. "Swing" is immortalized in the package names for the Swing API, which begin with javax.swing.
Friday, March 30, 2007
Simple Browser
Here is a simple program that demonstrates how to build a simple browser.
Note that this browser code doesn't handles any CSS or JavaScript/Scripts
are not supported.
Click here to view the code
Print Dialog, File Dialog, Panel & Tabs Nesting
This sample program demonstrates how to use a print dialog, file dialog.
Also illustrated the nesting of panels and tabs.
Here you can also see how the page setup is done.
Click here to view code
Monday, March 26, 2007
JComboBoxDemo with AutoFill Option
This program demonstrates the use of JComboBox
and how to automatically fill the contents based on
the key typed by the user.
Click Here to view the code

Friday, March 23, 2007
JTreeDemo with TreeSelectionListener
This program demonstrates the usage of JTree and How to implement and use
the javax.swing.event.TreeSelectionListener interface.
The images provided shows how it will look when executed the code. Please go through the code and comment you doubts/suggestions here. Click here to view the code
Wednesday, March 21, 2007
Right click (Popup Menu), and Clipboard

This program demonstrates how to process right click to show popupmenu and how to process
the clipboard(cut, copy, paste) with the system clipboard (only string/text formats are supported
by this program)
To view the sample program click here
Titlebar Icon of a JFrame
This program demonstrates How to change the icon at the titlebar of a JFrame.
First you have to get the image object from the specified url, then by using setIconImage(url) of JFrame you can set the titlebar icon.
Click Here to view the code![]()
