public class POSToolBar extends JFrame {
/**
* Launch the application.
*/
private BrowserToolBar toolBar;
public POSToolBar() {
super("POS");
Container content = getContentPane();
content.setBackground(Color.white);
toolBar = new BrowserToolBar();
content.add(toolBar, BorderLayout.NORTH);
pack();
setVisible(true);
}
}
The above code generates a tool bar for me. Now I want to use this Tool Bar on every other swing page. I inherit/extends this class and use frame.add(new POSToolbar()) but it shows me an exception ‘java.lang.IllegalArgumentException: adding a window to a container’
How can I add this tool bar on my other swing pages ?
It must extend JToolBar not a JFrame if you want to use it in other classes.