Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ji;
- import java.awt.EventQueue;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.JFrame;
- import javax.swing.JMenu;
- import javax.swing.JMenuBar;
- import javax.swing.JOptionPane;
- //import java.awt.Scrollbar;
- import javax.swing.JTable;
- public class menuNew implements ActionListener{
- private JFrame frame;
- private JTable table;
- JMenuBar menu= new JMenuBar();
- JMenu calculadora, suma,resta, multiplicar;
- int t;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- menuNew window = new menuNew();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public menuNew() {
- initialize();
- }
- private void initialize() {
- CrearMenu();
- frame = new JFrame("calculadora");
- frame.setBounds(100, 100, 200, 300);
- frame.setJMenuBar(menu);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().setLayout(null);
- table = new JTable();
- table.setBounds(173, 216, -159, -156);
- frame.getContentPane().add(table);
- }
- private void CrearMenu() {
- // TODO Auto-generated method stub
- calculadora =new JMenu("calcular");
- menu.add(calculadora);
- //suma
- suma =new JMenu("Sumar");
- suma.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- }
- });
- calculadora.add(suma);
- suma.add("sumar dos numeros");
- suma.add("sumar tres numeros");
- //resta
- resta =new JMenu("Restar");
- calculadora.add(resta);
- resta.add("restar dos numero negativo");
- resta.add("restar dos numero positivo");
- //mu
- multiplicar =new JMenu("Multiplicar");
- calculadora.add(multiplicar);
- multiplicar.add("multiplicar dos numeros");
- multiplicar.add("multiplicar tres numeros");
- }
- @Override
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
- }
- protected float[] cargaNumeros(int i) {
- // TODO Auto-generated method stub
- float nums[]= new float[t];
- for (int i1=0; i1 < nums.length ;i1++ ) {
- nums[i1]=Float.parseFloat(JOptionPane.showInputDialog("Ingrese un numero: "));
- }
- return nums;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement