import java.awt.BorderLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JToolBar;
public class VerticalToolbar {
public static void main(String[] args) {
JToolBar toolbar = new JToolBar(JToolBar.VERTICAL);
JButton selectb = new JButton(new ImageIcon("select.gif"));
JButton freehandb = new JButton(new ImageIcon("freehand.gif"));
JButton shapeedb = new JButton(new ImageIcon("shapeed.gif"));
JButton penb = new JButton(new ImageIcon("pen.gif"));
toolbar.add(selectb);
toolbar.add(freehandb);
toolbar.add(shapeedb);
toolbar.add(penb);
JFrame f = new JFrame();
f.add(toolbar, BorderLayout.WEST);
f.setSize(250, 350);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
}
|