Hi!

I created JToolBar, but it is always attached to JPanel. If I run my api, then I can drag and drop JToolBar in order to separate it from JPanel. I want to programmatically make JToolBar to look as a separate window (e.g. as a toolbar in Photoshop). Does anybody know how to do this?

public class myToolbar extends JToolBar {
    public myToolbar() {
        setName("My Toolbar");
        setBackground(new Color(245, 245, 245));
        setOrientation(1);
        setBorderPainted(false);
        setFloatable(true);
        setOpaque(true);
    }
}

Recommended Answers

All 2 Replies

Create another JPanel, and add the toolbar to that JPanel. And think of that new panel as a toolbar.

Thanks!

I found out that JFrame could do this job.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.