I will rewrite my question and I will try to make it clearer:
1) I have an application running that has a MDI with a main menu.
When I select one of the menu options a window is display with a
table retrieving information from a database. This works perfectly.
2) This window with the information is created using the next clases:
- JInternalFrame
- JPanel
- JTable
3) I inherited a new class from JTable called StreamTable. This class
has a method SaveAs(File). and now all the windows that display
reports are created using:
- JInternalFrame
- JPanel
- StreamTable
4) I added a new "Save to File" option to the main menu.
5) When the application is runnig and I click in "save to file" and a
report window is open, the next code is executed:
//get the frame in focus
JInternalFrame jif = mainFrame.getFrameInFocus();
if (jif != null) {
final JFileChooser fc = new JFileChooser();
int returnVal = fc.showSaveDialog(mainFrame);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
//????I want to call the SaveAs method here. ???
System.out.println("Saving: " + file.getName() + "." + "\n");
} else {
System.out.println("Save command cancelled by user." + "\n");
}
}
6)Question: What code exist in java to call a method that is in a
different component?
Like jif.JPanel.StreamTable.SaveAs(file).
HOw can access that method from the code above in (5)?
Thanks
Jes
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing