You are on page 1of 2

package kalculator;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JDesktopPane;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;

public class menu extends JFrame {

private JPanel contentPane;


private JMenuItem mntmStandart;
private JDesktopPane desktopPane;
private JMenuItem mntmStatistific;

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
menu frame = new menu();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the frame.
*/
public menu() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);

JMenuBar menuBar = new JMenuBar();


setJMenuBar(menuBar);

JMenu mnKalkulator = new JMenu("kalkulator");


menuBar.add(mnKalkulator);

contentPane = new JPanel();


contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);

JDesktopPane desktopPane = new JDesktopPane();


desktopPane.setBackground(new Color(240, 248, 255));
contentPane.add(desktopPane, BorderLayout.CENTER);

mntmStandart = new JMenuItem("Standart");


mntmStandart.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
standart kal = new standart();
kal.setVisible(true);
desktopPane.add(kal);
}
});
mnKalkulator.add(mntmStandart);

mntmStatistific = new JMenuItem("Statistific");


mntmStatistific.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
statistific kal = new statistific();
kal.setVisible(true);
desktopPane.add(kal);
}
});
mnKalkulator.add(mntmStatistific);

}
}

You might also like