On 7 mar, 22:47, "Daniel" <xxpinoybloo...@gmail.com> wrote:
> Hi again,
> Another problem. Whenever I try creating this menu using symbols, I
> get errors. Do I have trouble with declaring character variables? I
> don't know. If you have any input or know EXACTLY how to do this,
> please let me know! Thanks group.
>
> !!!!
>
> Write a program that displays a 5-option menu. The menu options should
> be *, /, +, -, and . After the user selects the operation, the program
> should prompt the user for two double values. The appropriate
> calculation is executed and the answer is assigned to a variable. A
> message that looks something like the following is printed -- "5 * 6 =
> 30". The program should repeat until the user selects quit.
"Whenever I try creating this menu using symbols"
To create the menus:
---------------
package javaapplication2;
import javax.swing.*;
/**
*
* @author gethostbyname
*/
public class Menus {
public Menus() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
JFrame janela = new JFrame();
JMenuBar menuBar = new JMenuBar();
// Menu
JMenu menuPrincipal = new JMenu("Operações");
menuBar.add(menuPrincipal);
//Items do Menu criado acima
JMenuItem m_itemSom = new JMenuItem("+");
menuPrincipal.add(m_itemSom);
JMenuItem m_itemSub = new JMenuItem("-");
menuPrincipal.add(m_itemSub);
JMenuItem m_itemDiv = new JMenuItem("/");
menuPrincipal.add(m_itemDiv);
JMenuItem m_itemMult = new JMenuItem("*");
menuPrincipal.add(m_itemMult);
//
janela.setJMenuBar(menuBar);
//Mostrar janela
janela.setSize(500,500);
janela.setVisible(true);
janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLO SE);
// Read
http://java.sun.com/docs/books/tutor...ents/menu.html
}
}
---------------
I usually create them using NetBeans
gethostbyname