commit bc4274c825b8cc51c6ae121c85415e92e4832f64 Author: PioDer Date: Thu May 15 19:15:28 2014 +0200 initial import diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..fb565a5 --- /dev/null +++ b/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..756c108 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + ksiazka-kucharska + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7341ab1 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/bin/ksiazka/kucharska/FrmAbout$1.class b/bin/ksiazka/kucharska/FrmAbout$1.class new file mode 100644 index 0000000..d51b0de Binary files /dev/null and b/bin/ksiazka/kucharska/FrmAbout$1.class differ diff --git a/bin/ksiazka/kucharska/FrmAbout.class b/bin/ksiazka/kucharska/FrmAbout.class new file mode 100644 index 0000000..b34af5f Binary files /dev/null and b/bin/ksiazka/kucharska/FrmAbout.class differ diff --git a/bin/ksiazka/kucharska/FrmMain$1.class b/bin/ksiazka/kucharska/FrmMain$1.class new file mode 100644 index 0000000..3472fa5 Binary files /dev/null and b/bin/ksiazka/kucharska/FrmMain$1.class differ diff --git a/bin/ksiazka/kucharska/FrmMain$2.class b/bin/ksiazka/kucharska/FrmMain$2.class new file mode 100644 index 0000000..d50b709 Binary files /dev/null and b/bin/ksiazka/kucharska/FrmMain$2.class differ diff --git a/bin/ksiazka/kucharska/FrmMain$3.class b/bin/ksiazka/kucharska/FrmMain$3.class new file mode 100644 index 0000000..126e10b Binary files /dev/null and b/bin/ksiazka/kucharska/FrmMain$3.class differ diff --git a/bin/ksiazka/kucharska/FrmMain.class b/bin/ksiazka/kucharska/FrmMain.class new file mode 100644 index 0000000..6038e60 Binary files /dev/null and b/bin/ksiazka/kucharska/FrmMain.class differ diff --git a/src/ksiazka/kucharska/FrmAbout.java b/src/ksiazka/kucharska/FrmAbout.java new file mode 100644 index 0000000..0849cf9 --- /dev/null +++ b/src/ksiazka/kucharska/FrmAbout.java @@ -0,0 +1,85 @@ +package ksiazka.kucharska; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import javax.swing.JLabel; +import java.awt.Font; +import javax.swing.JTextPane; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; + +public class FrmAbout extends JDialog { + + private final JPanel contentPanel = new JPanel(); + private JTextPane txtpnKsidddka; + private JLabel lblNewLabel; + + /** + * Create the dialog. + */ + public FrmAbout() { + setResizable(false); + setTitle("O Programie"); + setBounds(100, 100, 442, 197); + getContentPane().setLayout(new BorderLayout()); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + { + txtpnKsidddka = new JTextPane(); + txtpnKsidddka.setAutoscrolls(false); + txtpnKsidddka.setBorder(null); + txtpnKsidddka.setEditable(false); + txtpnKsidddka.setText("Książka kucharska napisana jako forma zaliczenia przedmiotu Java.\n2014 (c) Barblade & PioDer"); + } + { + lblNewLabel = new JLabel("Książka Kucharska v1.0"); + lblNewLabel.setFont(new Font("Dialog", Font.BOLD, 18)); + } + GroupLayout gl_contentPanel = new GroupLayout(contentPanel); + gl_contentPanel.setHorizontalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addGap(98) + .addComponent(lblNewLabel) + .addContainerGap(99, Short.MAX_VALUE)) + .addGroup(Alignment.TRAILING, gl_contentPanel.createSequentialGroup() + .addGap(62) + .addComponent(txtpnKsidddka, 0, 0, Short.MAX_VALUE) + .addGap(49)) + ); + gl_contentPanel.setVerticalGroup( + gl_contentPanel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_contentPanel.createSequentialGroup() + .addContainerGap() + .addComponent(lblNewLabel) + .addGap(18) + .addComponent(txtpnKsidddka, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addContainerGap(126, Short.MAX_VALUE)) + ); + contentPanel.setLayout(gl_contentPanel); + { + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + JButton okButton = new JButton("OK"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + setVisible(false); + } + }); + buttonPane.add(okButton); + okButton.setActionCommand("OK"); + getRootPane().setDefaultButton(okButton); + } + } + } + +} diff --git a/src/ksiazka/kucharska/FrmMain.java b/src/ksiazka/kucharska/FrmMain.java new file mode 100644 index 0000000..4df19aa --- /dev/null +++ b/src/ksiazka/kucharska/FrmMain.java @@ -0,0 +1,104 @@ +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); + } + +}