Issue regarding adding Container on very Swing Page

public class POSToolBar extends JFrame {

 * Launch the application.
private BrowserToolBar toolBar;

public POSToolBar() {
    Container content = getContentPane();
    toolBar = new BrowserToolBar();
    content.add(toolBar, BorderLayout.NORTH);

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.

import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.*;

public class TestApplication extends JFrame {
    public static void main(String [] a){
        TestApplication ta = new TestApplication();
        TBar t = new TBar();
        ta.setLayout(new BorderLayout());
        ta.setPreferredSize(new Dimension(400,300));

class TBar extends JToolBar{
    JButton b = new JButton("Hello");

    public TBar(){

Need Your Help

Pointer of byte array

pointers vb6 casting

So, I'm basically looking to know how to turn this

Deconstructing/Hacking NodeJs

javascript node.js operating-system

I am trying to understand Node internal workings and am at a point where I am not able to piece together how Node, which is written in js, hooks/binds into the low level system calls written in C/C...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.