Kamesh Loganathan

Greenhorn
+ Follow
since Jan 21, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kamesh Loganathan

Hi,
I am creating a table in SWT and for some reason there is an extra column in the table. When I get the number of columns it doesnt account for the extra column.... Is there someway of gettin rid of the the extra column.

Thanks&Regards,
Kamesh
16 years ago
Hi,
That is correct, there are a couple of free api's to interact will excel or com in general. POI, IBM java-com bridge etc. Jintegra can be used to interact with any com component, although it has to be bought. If you are looking at just adding a column into the spread sheet the best way to do it is write a comma seperated format file and rename the file to .xls. This is simple and fast to do.
Hi,
I am not sure why this is happening in your application but in genral this happens in swing when there is a dead lock. Since swing is event driven, if for some reason there is an event that triggers another and that inturn triggers the first one, then you end up with Stack overflow exception. Hope this helps.
17 years ago
Hi,
Another way of doing it is registering the tab key to an action for the table.

Maybe this snippet may help.


Action focusNextRow = new AbstractAction()
{
public void actionPerformed(ActionEvent e)
{
int nextRow = servicesTable.getSelectedRow()+ 1;
if (servicesTable.getSelectedRow() != (servicesTable.getRowCount() - 1))
{
servicesTable.changeSelection(
nextRow,
2,
false,
false);
servicesTable.editCellAt(nextRow, 2);
// Defect : 5859
// Exception Ctrl/Enter used on Ser. to be Est Tab
// User can using ctrl/Enter on the on on-editable cells in
// the table.
// servicesTable.getEditorComponent().requestFocus();
TableCellEditor tableCellEditor = servicesTable.getCellEditor(nextRow,2);
Component component = tableCellEditor.
getTableCellEditorComponent(servicesTable, servicesTable.getValueAt(nextRow,2),
true, nextRow, 2);
}
}
};

servicesTable.getInputMap(1).put( KeyStroke.getKeyStroke
(KeyEvent.VK_ENTER, InputEvent.CTRL_MASK), "focusNextRow");
servicesTable.getActionMap().put("focusNextRow", focusNextRow);
17 years ago
Hi,
The Jtable has a method called changeSelection that will get called if a tab is pressed on any cell. Over ride this appropriately.
17 years ago
Hi,
JTable has a method called isCellEditable(), override it to return true for the cells that you want to edit.

All the Best!!!
17 years ago
Hi,
It is true that in general there is no need to do cloning in swings but there might be wierd cases for instance in trees we might want to do a copy paste action. In such cases we have to clone the user object associated with the node or create a new one. Since the user object might be a complex data structure written by us, we might want to define a clone method in it to save time.

There are a set of rules that have to be followed while performing cloning. We shouldnt jusr over ride the method clone and create a new object inside it and set the values in the old one to the new one. Please refer to the java spec before overriding this method.

All the best!!!
17 years ago
Generally we use the singleton design pattern for factory classes, manager classes and classes for which we want only once instance in the whole application. It generally comes in very handy in Java swing programming.
Hi Pal,
I think the best way to do this is using win32 API's.
If you are bent on using java, write a dll and call it
from java.
18 years ago
Hi Pal,
I think u have to set
JAVA_HOME to c:\java\bin
path to c:\java\bin
and
classpath to c:\java\bin

It should work
18 years ago
Hi,
You have something called as ObjectInputStream, u can read a object using this. The analog for writing is ObjectOutputStream.Hopefully this would help.
18 years ago
Hi Pal,
You can use the Hibernate Synchronizer plugin for eclipse to generate the
hbm xml's by just providing the parameters needed to connect to the database.
Hi,
I think that a more refined way of doing this is to use the html:cancel button, no java script and check for iscancelled in the action and fwd appropriately to the previous page.

Using javascripts history looks to be crude to me.
Correct me if i am wrong.
18 years ago
Hi Pal,
U can have as many struts-configs as u want but each one would represent a
module. Look at heading 5.3 on this link http://struts.apache.org/struts-doc-1.2.7/userGuide/configuration.html
18 years ago
Hi Pal,
If u get a message saying command not recognised when u type javac
then u have to set the PATH variable to the bin folder of java.

Letz say u have java in C:

then use set path=c:\j2sdk1.4.2\bin;.;%path%

After this set the classpath to the jars and try compiling.It should work
18 years ago