我刚接触Java Swing。我想设计一个JToolBar
,并将其放置在JPanel
的中心。这是否可行?
javax.swing.JPanel pane = new javax.swing.JPanel();
BorderLayout border = new BorderLayout();
pane.setLayout(border);
JToolBar toolBar = new JToolBar();
pane.add(toolBar,BorderLayout.CENTER);
javax.swing.JButton button1 = new javax.swing.JButton("Click Me");
toolBar.add(button1);