Now when I want to refer back to a togglebutton that has already been added to the toolbar, i can get the button back as a Component... now, how do i cast the Component back into my custom made class so that I can access all it's methods etc.?
for example:
public class inputWindowButton extends javax.swing.JToggleButton {
private inputWindow myInputWindow;
public inputWindowButton(inputWindow associatedInputWindow) {
myInputWindow = associatedInputWindow;
this.setText(myInputWindow.getWindowName());
}
public void focusWindow() { myInputWindow.focusWindow(); }
public void minimiseWindow() { myInputWindow.minimiseWindow(); }
}
then:
so once i add one of these to my JToolBar, then try to refer back to it, i have to do something along the lines of:
Component toolBarComps[] = aJToolBar.getComponents();
which returns an array of the components on the toolbar. so how do i cast toolBarComps[x] back into an inputWindowButton?