JFileChooser didn't display well, when calling it for the second time

Hello seniors & friends

I written a cell editor for JTable. its work nice when i click the cell and select a file, its work well. Then again i click the cell in the column, this time it wont display the JFileChooser dialog correctly. it will display like a Jframe becomes visible without initializing its size with setBounds or pack().

This is the code for TableCellEditor

class FileTableCellEditorextends AbstractCellEditorimplements TableCellEditor

{

private JFileChooser fileChooser;

private JPanel panel;

private JFrame owner;

public FileTableCellEditor(JFrame own)

{

owner = own;

panel =new JPanel();

fileChooser =new JFileChooser();

}

public Component getTableCellEditorComponent(JTable table,

Object value,boolean isSelected,int row,int column)

{

return panel;

}

publicboolean shouldSelectCell(EventObject anEvent)

{

int result = fileChooser.showOpenDialog(owner);

System.out.println("Printed after disposing File Dialog." + result + JFileChooser.ERROR_OPTION);

if (result == JFileChooser.APPROVE_OPTION)

{

stopCellEditing();

}

else

{

cancelCellEditing();

}

returntrue;

}

publicvoid cancelCellEditing()

{

fileChooser.setVisible(false);

super.cancelCellEditing();

}

publicboolean stopCellEditing()

{

fileChooser.setVisible(false);

super.stopCellEditing();

returntrue;

}

public Object getCellEditorValue()

{

return fileChooser.getSelectedFile();

}

}

Thanks for all

[3217 byte] By [PremKumarUa] at [2007-11-27 6:15:31]
# 1
Remove the following line from you code wherever it appears (twice):fileChooser.setVisible(false);Once you click on the ApproveButton or the CancelButton then it is going to "hide." There is no need to call the setVisible(false) method.
Navy_Codera at 2007-7-12 17:26:14 > top of Java-index,Java Essentials,New To Java...
# 2
Thanks my Friend. i tried it but still its not working
PremKumarUa at 2007-7-12 17:26:14 > top of Java-index,Java Essentials,New To Java...