Saturday, March 3, 2007

Tiffany Granath Husband And Son



ejmplo the use of a JToolBar. Place a toolbar in your java programs. You usually add a ImageIcon (icon) representing the action the button.

For example to insert an image on the Save button use:
ImagenGuardar = new ImageIcon ImageIcon ("guardar.gif");
BGuardar.setIcon(ImagenGuardar);
import javax.swing.*;

class Menu extends JFrame {
//Toolbar
JToolBar TBarra=new JToolBar();
JButton BNuevo=new JButton("N");
JButton BAbrir=new JButton("A");
   JButton BCopiar=new JButton("C"); 
JButton BCortar=new JButton("C");
JButton BPegar=new JButton("P");
JButton BGuardar=new JButton("G");
public Menu() {

//ToolBar
TBarra.add(BNuevo);
TBarra.add(BAbrir);
TBarra.add(BGuardar);
TBarra.addSeparator();
TBarra.add(BCopiar);
TBarra.add (BCortar)
TBarra.add (SGA);
BGuardar.setToolTipText ("Save");
BNuevo.setToolTipText ("New");
BAbrir.setToolTipText ("Open");
BCopiar.setToolTipText (copy);
BCortar.setToolTipText (BCortar ");
BPegar.setToolTipText (" Paste ");


add (TBarra," North ");

TBarra.setFloatable (false);
setTitle ( "Examples JPopupMenu");
setSize (800.600);
setVisible (true);}


public static void main (String [] args) {
new Menu ();}




}


JPopupMenu

0 comments:

Post a Comment