Sunday, January 13, 2013

JToolBar Example In Java.♥

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

public class fine6{
  public static void main(String[] args) {
  JFrame frame = new JFrame("toolbar");
  JToolBar toolbar = new JToolBar("Toolbar", JToolBar.HORIZONTAL);
  JButton c = new JButton(new ImageIcon("1.jpg"));
  toolbar.add(c);
  JButton co = new JButton(new ImageIcon("2.jpg"));
  toolbar.add(co);
  JButton pa= new JButton(new ImageIcon("3.jpg"));
  toolbar.add(pa);
  frame.getContentPane().add(toolbar,BorderLayout.NORTH);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setLocation(100,100);
  frame.setSize(500,400);
  frame.setVisible(true);
  }
}

OUTPUT :

No comments: