package ksiazka.kucharska;
|
|
|
|
import java.awt.Dimension;
|
|
import java.awt.EventQueue;
|
|
import java.awt.Toolkit;
|
|
|
|
import javax.swing.JFrame;
|
|
import java.awt.BorderLayout;
|
|
import javax.swing.BoxLayout;
|
|
import javax.swing.JDialog;
|
|
import javax.swing.JMenuBar;
|
|
import javax.swing.JMenu;
|
|
import javax.swing.JMenuItem;
|
|
import javax.swing.JSeparator;
|
|
|
|
import ksiazka.kucharska.FrmAbout;
|
|
import java.awt.event.ActionListener;
|
|
import java.awt.event.ActionEvent;
|
|
|
|
public class FrmMain extends JDialog {
|
|
|
|
private JFrame frmKsikaKucharskaV;
|
|
private static FrmAbout dialog = new FrmAbout();
|
|
|
|
/**
|
|
* Launch the application.
|
|
*/
|
|
public static void main(String[] args) {
|
|
EventQueue.invokeLater(new Runnable() {
|
|
public void run() {
|
|
try {
|
|
FrmMain window = new FrmMain();
|
|
window.frmKsikaKucharskaV.setVisible(true);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
});
|
|
|
|
try {
|
|
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
|
dialog.setVisible(false);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Create the application.
|
|
*/
|
|
public FrmMain() {
|
|
initialize();
|
|
}
|
|
|
|
/**
|
|
* Initialize the contents of the frame.
|
|
*/
|
|
private void initialize() {
|
|
frmKsikaKucharskaV = new JFrame();
|
|
frmKsikaKucharskaV.setTitle("Książka Kucharska v1.0");
|
|
frmKsikaKucharskaV.setBounds(100, 100, 450, 300);
|
|
frmKsikaKucharskaV.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
frmKsikaKucharskaV.getContentPane().setLayout(new BoxLayout(frmKsikaKucharskaV.getContentPane(), BoxLayout.X_AXIS));
|
|
|
|
JMenuBar menuBar = new JMenuBar();
|
|
frmKsikaKucharskaV.setJMenuBar(menuBar);
|
|
|
|
JMenu mnNewMenu = new JMenu("Menu");
|
|
menuBar.add(mnNewMenu);
|
|
|
|
JMenuItem mntmDodajPrzepis = new JMenuItem("Dodaj przepis");
|
|
mnNewMenu.add(mntmDodajPrzepis);
|
|
|
|
JMenuItem mntmNewMenuItem = new JMenuItem("Wyszukaj");
|
|
mnNewMenu.add(mntmNewMenuItem);
|
|
|
|
JSeparator separator = new JSeparator();
|
|
mnNewMenu.add(separator);
|
|
|
|
JMenuItem mntmNewMenuItem_1 = new JMenuItem("Zakończ");
|
|
mntmNewMenuItem_1.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
System.exit(0);
|
|
}
|
|
});
|
|
mnNewMenu.add(mntmNewMenuItem_1);
|
|
|
|
JMenu mnNewMenu_1 = new JMenu("Pomoc");
|
|
menuBar.add(mnNewMenu_1);
|
|
|
|
JMenuItem mntmOProgramie = new JMenuItem("O Programie");
|
|
mntmOProgramie.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
|
int x = (screenSize.width - dialog.getWidth()) / 2;
|
|
int y = (screenSize.height - dialog.getHeight()) / 2;
|
|
dialog.setLocation(x, y);
|
|
dialog.setVisible(true);
|
|
}
|
|
});
|
|
mnNewMenu_1.add(mntmOProgramie);
|
|
}
|
|
|
|
}
|