| @ -1,85 +0,0 @@ | |||||
| 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); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -1,104 +0,0 @@ | |||||
| 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); | |||||
| } | |||||
| } | |||||