This may be a total newb question, but Is it possible to create a JInternalFrame class with additional public functions that can be called from the desktop?
Here is some snippets of the code.
This is the Internal Frame with the public functions added after the constructor.
public class Search_Ifr extends javax.swing.JInternalFrame { /** * Creates new form Search_Ifr */ public Search_Ifr() { initComponents(); } public void setTabPaneIndex(int tabIndex){ this.tpnSearch.setSelectedIndex(tabIndex); } public void setTabPaneIndex(String tabName){ for (int i=0; i < this.tpnSearch.getTabCount(); i++){ if(tabName.equals(this.tpnSearch.getTitleAt(i))){ this.tpnSearch.setSelectedIndex(i); break; } } } }
This is where I am calling the function from the desktop.
private void findCustomerMenuItemActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: JInternalFrame ifrSearch = new Search_Ifr(); ifrSearch.setVisible(true); //rootPaneCheckingEnabled ifrSearch.setTabPaneIndex("tabCust"); this.desktopPane.add(ifrSearch); try { ifrSearch.setSelected(true); } catch (java.beans.PropertyVetoException e) {} }
The line " ifrSearch.setTabPaneIndex("tabCust");" is throwing a compile error that the method is not found.
Any help would be greatly appreciated.