Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Swing / AWT / SWT
toolbar in internalframe
iyappan sankaran
Ranch Hand
Posts: 58
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i have a main frame which interms contain many internal frames
i want to add menubar as well as toolbar in the main frame .how to do it?
Craig Wood
Ranch Hand
Posts: 1535
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
import java.awt.*; import javax.swing.*; public class DesktopTest { public DesktopTest() { JMenu menu = new JMenu("menu"); menu.add(new JMenuItem("item 1")); menu.add(new JMenuItem("item 2")); JMenuBar menuBar = new JMenuBar(); menuBar.add(menu); JToolBar toolBar = new JToolBar(); toolBar.add(new JButton("button 1")); toolBar.add(new JButton("button 2")); JPanel north = new JPanel(new BorderLayout()); north.add(toolBar, "North"); JInternalFrame iframe = new JInternalFrame("iframe", true, true, true, true); iframe.setSize(300,300); iframe.setLocation(50,50); iframe.setVisible(true); JDesktopPane desktop = new JDesktopPane(); desktop.add(iframe); JFrame f = new JFrame(); f.setJMenuBar(menuBar); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(north, "North"); f.getContentPane().add(desktop); f.setSize(500,500); f.setLocation(200,200); f.setVisible(true); } public static void main(String[] args) { new DesktopTest(); } }
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Frame shrinks on some machines
binding swing components
Nested windows
Toolbar next to menu?
Menu+Tool
More...