|
@ -19,6 +19,8 @@ import javax.swing.JLabel; |
|
|
import java.awt.Font; |
|
|
import java.awt.Font; |
|
|
import javax.swing.border.LineBorder; |
|
|
import javax.swing.border.LineBorder; |
|
|
import java.awt.SystemColor; |
|
|
import java.awt.SystemColor; |
|
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
|
|
|
|
public class FrmMain extends JFrame { |
|
|
public class FrmMain extends JFrame { |
|
|
|
|
|
|
|
@ -27,7 +29,44 @@ public class FrmMain extends JFrame { |
|
|
*/ |
|
|
*/ |
|
|
private static final long serialVersionUID = 2634383304749703669L; |
|
|
private static final long serialVersionUID = 2634383304749703669L; |
|
|
private JPanel contentPane; |
|
|
private JPanel contentPane; |
|
|
private JTextField txtWpiszTytutagi; |
|
|
|
|
|
|
|
|
private JTextField txtSearch; |
|
|
|
|
|
private JTextField txtEdTitle; |
|
|
|
|
|
private JTextField txtTags; |
|
|
|
|
|
private JButton btnSave; |
|
|
|
|
|
private JButton btnCancel; |
|
|
|
|
|
private JTextPane txtIngredients; |
|
|
|
|
|
private JTextPane txtDescription; |
|
|
|
|
|
private JButton btnAddRecipe; |
|
|
|
|
|
private JButton btnSearch; |
|
|
|
|
|
private JButton btnDelRecipe; |
|
|
|
|
|
private JButton btnLoadImg; |
|
|
|
|
|
private JLabel lblRecipeTitle; |
|
|
|
|
|
|
|
|
|
|
|
void DeactivateAddMenu() { |
|
|
|
|
|
btnCancel.setVisible(false); |
|
|
|
|
|
btnDelRecipe.setEnabled(true); |
|
|
|
|
|
btnLoadImg.setVisible(false); |
|
|
|
|
|
btnSearch.setEnabled(true); |
|
|
|
|
|
btnSave.setVisible(false); |
|
|
|
|
|
txtDescription.setEditable(false); |
|
|
|
|
|
txtEdTitle.setVisible(false); |
|
|
|
|
|
txtIngredients.setEditable(false); |
|
|
|
|
|
txtTags.setEditable(false); |
|
|
|
|
|
lblRecipeTitle.setVisible(true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ActivateAddMenu() { |
|
|
|
|
|
btnCancel.setVisible(true); |
|
|
|
|
|
btnDelRecipe.setEnabled(false); |
|
|
|
|
|
btnLoadImg.setVisible(true); |
|
|
|
|
|
btnSearch.setEnabled(false); |
|
|
|
|
|
btnSave.setVisible(true); |
|
|
|
|
|
txtDescription.setEditable(true); |
|
|
|
|
|
txtEdTitle.setVisible(true); |
|
|
|
|
|
txtIngredients.setEditable(true); |
|
|
|
|
|
txtTags.setEditable(true); |
|
|
|
|
|
lblRecipeTitle.setVisible(false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Create the frame. |
|
|
* Create the frame. |
|
@ -36,7 +75,7 @@ public class FrmMain extends JFrame { |
|
|
setResizable(false); |
|
|
setResizable(false); |
|
|
setTitle("Książka Kucharska v1.0"); |
|
|
setTitle("Książka Kucharska v1.0"); |
|
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
|
setBounds(100, 100, 800, 500); |
|
|
|
|
|
|
|
|
setBounds(100, 100, 800, 549); |
|
|
contentPane = new JPanel(); |
|
|
contentPane = new JPanel(); |
|
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
|
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
|
|
contentPane.setLayout(new BorderLayout(0, 0)); |
|
|
contentPane.setLayout(new BorderLayout(0, 0)); |
|
@ -57,17 +96,17 @@ public class FrmMain extends JFrame { |
|
|
gbl_panel.rowWeights = new double[]{0.0, 1.0, 0.0}; |
|
|
gbl_panel.rowWeights = new double[]{0.0, 1.0, 0.0}; |
|
|
panel.setLayout(gbl_panel); |
|
|
panel.setLayout(gbl_panel); |
|
|
|
|
|
|
|
|
txtWpiszTytutagi = new JTextField(); |
|
|
|
|
|
txtWpiszTytutagi.setText("wpisz tytuł/tagi..."); |
|
|
|
|
|
GridBagConstraints gbc_txtWpiszTytutagi = new GridBagConstraints(); |
|
|
|
|
|
gbc_txtWpiszTytutagi.insets = new Insets(0, 0, 5, 5); |
|
|
|
|
|
gbc_txtWpiszTytutagi.fill = GridBagConstraints.HORIZONTAL; |
|
|
|
|
|
gbc_txtWpiszTytutagi.gridx = 0; |
|
|
|
|
|
gbc_txtWpiszTytutagi.gridy = 0; |
|
|
|
|
|
panel.add(txtWpiszTytutagi, gbc_txtWpiszTytutagi); |
|
|
|
|
|
txtWpiszTytutagi.setColumns(10); |
|
|
|
|
|
|
|
|
|
|
|
JButton btnSearch = new JButton("Szukaj"); |
|
|
|
|
|
|
|
|
txtSearch = new JTextField(); |
|
|
|
|
|
txtSearch.setText("wpisz tytuł/tagi..."); |
|
|
|
|
|
GridBagConstraints gbc_txtSearch = new GridBagConstraints(); |
|
|
|
|
|
gbc_txtSearch.insets = new Insets(0, 0, 5, 5); |
|
|
|
|
|
gbc_txtSearch.fill = GridBagConstraints.HORIZONTAL; |
|
|
|
|
|
gbc_txtSearch.gridx = 0; |
|
|
|
|
|
gbc_txtSearch.gridy = 0; |
|
|
|
|
|
panel.add(txtSearch, gbc_txtSearch); |
|
|
|
|
|
txtSearch.setColumns(10); |
|
|
|
|
|
|
|
|
|
|
|
btnSearch = new JButton("Szukaj"); |
|
|
GridBagConstraints gbc_btnSearch = new GridBagConstraints(); |
|
|
GridBagConstraints gbc_btnSearch = new GridBagConstraints(); |
|
|
gbc_btnSearch.anchor = GridBagConstraints.NORTH; |
|
|
gbc_btnSearch.anchor = GridBagConstraints.NORTH; |
|
|
gbc_btnSearch.fill = GridBagConstraints.HORIZONTAL; |
|
|
gbc_btnSearch.fill = GridBagConstraints.HORIZONTAL; |
|
@ -96,27 +135,48 @@ public class FrmMain extends JFrame { |
|
|
panel.add(panel_1, gbc_panel_1); |
|
|
panel.add(panel_1, gbc_panel_1); |
|
|
panel_1.setLayout(new GridLayout(0, 2, 0, 0)); |
|
|
panel_1.setLayout(new GridLayout(0, 2, 0, 0)); |
|
|
|
|
|
|
|
|
JButton btnAddRecipe = new JButton("Dodaj"); |
|
|
|
|
|
|
|
|
btnAddRecipe = new JButton("Dodaj"); |
|
|
|
|
|
btnAddRecipe.addActionListener(new ActionListener() { |
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
ActivateAddMenu(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
panel_1.add(btnAddRecipe); |
|
|
panel_1.add(btnAddRecipe); |
|
|
|
|
|
|
|
|
JButton btnDelRecipe = new JButton("Usuń"); |
|
|
|
|
|
|
|
|
btnDelRecipe = new JButton("Usuń"); |
|
|
panel_1.add(btnDelRecipe); |
|
|
panel_1.add(btnDelRecipe); |
|
|
|
|
|
|
|
|
JPanel panel_2 = new JPanel(); |
|
|
JPanel panel_2 = new JPanel(); |
|
|
splitPane.setRightComponent(panel_2); |
|
|
splitPane.setRightComponent(panel_2); |
|
|
panel_2.setLayout(null); |
|
|
panel_2.setLayout(null); |
|
|
|
|
|
|
|
|
JTextPane textPane = new JTextPane(); |
|
|
|
|
|
textPane.setEditable(false); |
|
|
|
|
|
textPane.setBounds(26, 88, 228, 126); |
|
|
|
|
|
panel_2.add(textPane); |
|
|
|
|
|
|
|
|
btnSave = new JButton("Zapisz"); |
|
|
|
|
|
btnSave.addActionListener(new ActionListener() { |
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
DeactivateAddMenu(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
btnSave.setVisible(false); |
|
|
|
|
|
btnSave.setBounds(319, 12, 117, 25); |
|
|
|
|
|
panel_2.add(btnSave); |
|
|
|
|
|
|
|
|
|
|
|
txtEdTitle = new JTextField(); |
|
|
|
|
|
txtEdTitle.setVisible(false); |
|
|
|
|
|
txtEdTitle.setBounds(12, 15, 295, 19); |
|
|
|
|
|
panel_2.add(txtEdTitle); |
|
|
|
|
|
txtEdTitle.setColumns(10); |
|
|
|
|
|
|
|
|
|
|
|
txtIngredients = new JTextPane(); |
|
|
|
|
|
txtIngredients.setEditable(false); |
|
|
|
|
|
txtIngredients.setBounds(26, 88, 228, 126); |
|
|
|
|
|
panel_2.add(txtIngredients); |
|
|
|
|
|
|
|
|
JTextPane textPane_1 = new JTextPane(); |
|
|
|
|
|
textPane_1.setEditable(false); |
|
|
|
|
|
textPane_1.setBounds(26, 254, 410, 196); |
|
|
|
|
|
panel_2.add(textPane_1); |
|
|
|
|
|
|
|
|
txtDescription = new JTextPane(); |
|
|
|
|
|
txtDescription.setEditable(false); |
|
|
|
|
|
txtDescription.setBounds(26, 254, 410, 196); |
|
|
|
|
|
panel_2.add(txtDescription); |
|
|
|
|
|
|
|
|
JLabel lblRecipeTitle = new JLabel("Nazwa przepisu"); |
|
|
|
|
|
|
|
|
lblRecipeTitle = new JLabel("Nazwa przepisu"); |
|
|
lblRecipeTitle.setFont(new Font("Dialog", Font.BOLD, 18)); |
|
|
lblRecipeTitle.setFont(new Font("Dialog", Font.BOLD, 18)); |
|
|
lblRecipeTitle.setBounds(12, 12, 442, 22); |
|
|
lblRecipeTitle.setBounds(12, 12, 442, 22); |
|
|
panel_2.add(lblRecipeTitle); |
|
|
panel_2.add(lblRecipeTitle); |
|
@ -129,9 +189,35 @@ public class FrmMain extends JFrame { |
|
|
lblDescription.setBounds(26, 227, 152, 15); |
|
|
lblDescription.setBounds(26, 227, 152, 15); |
|
|
panel_2.add(lblDescription); |
|
|
panel_2.add(lblDescription); |
|
|
|
|
|
|
|
|
JLabel lblNewLabel_3 = new JLabel(""); |
|
|
|
|
|
lblNewLabel_3.setBorder(new LineBorder(SystemColor.textHighlightText)); |
|
|
|
|
|
lblNewLabel_3.setBounds(272, 88, 164, 126); |
|
|
|
|
|
panel_2.add(lblNewLabel_3); |
|
|
|
|
|
|
|
|
JLabel imgRecipe = new JLabel(""); |
|
|
|
|
|
imgRecipe.setBorder(new LineBorder(SystemColor.textHighlightText)); |
|
|
|
|
|
imgRecipe.setBounds(272, 88, 164, 126); |
|
|
|
|
|
panel_2.add(imgRecipe); |
|
|
|
|
|
|
|
|
|
|
|
btnLoadImg = new JButton("Wczytaj"); |
|
|
|
|
|
btnLoadImg.setVisible(false); |
|
|
|
|
|
btnLoadImg.setBounds(304, 217, 102, 25); |
|
|
|
|
|
panel_2.add(btnLoadImg); |
|
|
|
|
|
|
|
|
|
|
|
txtTags = new JTextField(); |
|
|
|
|
|
txtTags.setEditable(false); |
|
|
|
|
|
txtTags.setBounds(26, 480, 410, 19); |
|
|
|
|
|
panel_2.add(txtTags); |
|
|
|
|
|
txtTags.setColumns(10); |
|
|
|
|
|
|
|
|
|
|
|
JLabel lblTags = new JLabel("Tagi:"); |
|
|
|
|
|
lblTags.setBounds(26, 462, 70, 15); |
|
|
|
|
|
panel_2.add(lblTags); |
|
|
|
|
|
|
|
|
|
|
|
btnCancel = new JButton("Anuluj"); |
|
|
|
|
|
btnCancel.addActionListener(new ActionListener() { |
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
DeactivateAddMenu(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
btnCancel.setVisible(false); |
|
|
|
|
|
btnCancel.setBounds(319, 46, 117, 25); |
|
|
|
|
|
panel_2.add(btnCancel); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |