zmiana koncepcji - wszystko na jednej formatce
This commit is contained in:
@@ -16,8 +16,6 @@ public class App
|
||||
try {
|
||||
System.out.println( "tworzę fMain..." );
|
||||
FrmMain fMain = new FrmMain();
|
||||
System.out.println("tworzę fAdd...");
|
||||
FrmAdd fAdd = new FrmAdd();
|
||||
fMain.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
package ksiazka.kucharska;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextPane;
|
||||
import javax.swing.border.LineBorder;
|
||||
import java.awt.SystemColor;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JButton;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
public class FrmAdd extends JFrame {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -9040508421093717296L;
|
||||
private JPanel contentPane;
|
||||
private JTextField txtTitle;
|
||||
private JTextField txtTags;
|
||||
|
||||
|
||||
/**
|
||||
* Create the frame.
|
||||
*/
|
||||
public FrmAdd() {
|
||||
setResizable(false);
|
||||
setTitle("Dodaj przepis");
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setBounds(100, 100, 576, 526);
|
||||
contentPane = new JPanel();
|
||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
setContentPane(contentPane);
|
||||
contentPane.setLayout(null);
|
||||
|
||||
JLabel lblTitle = new JLabel("Nazwa przepisu:");
|
||||
lblTitle.setBounds(22, 12, 119, 19);
|
||||
contentPane.add(lblTitle);
|
||||
|
||||
JLabel lblIngredients = new JLabel("Składniki (jeden na linię):");
|
||||
lblIngredients.setBounds(22, 44, 186, 19);
|
||||
contentPane.add(lblIngredients);
|
||||
|
||||
JLabel lblDescription = new JLabel("Opis przygotowania:");
|
||||
lblDescription.setBounds(22, 208, 158, 15);
|
||||
contentPane.add(lblDescription);
|
||||
|
||||
JLabel lblOptionalImg = new JLabel("Opcjonalna grafika:");
|
||||
lblOptionalImg.setBounds(397, 62, 149, 23);
|
||||
contentPane.add(lblOptionalImg);
|
||||
|
||||
JLabel lblTags = new JLabel("Tagi (oddziel spacją):");
|
||||
lblTags.setBounds(22, 443, 158, 15);
|
||||
contentPane.add(lblTags);
|
||||
|
||||
JTextPane txtIngredients = new JTextPane();
|
||||
txtIngredients.setEditable(false);
|
||||
txtIngredients.setBounds(22, 70, 324, 126);
|
||||
contentPane.add(txtIngredients);
|
||||
|
||||
JLabel imgRecipe = new JLabel("");
|
||||
imgRecipe.setBorder(new LineBorder(SystemColor.textHighlightText));
|
||||
imgRecipe.setBounds(382, 97, 164, 126);
|
||||
contentPane.add(imgRecipe);
|
||||
|
||||
JTextPane txtDescription = new JTextPane();
|
||||
txtDescription.setEditable(false);
|
||||
txtDescription.setBounds(22, 235, 324, 196);
|
||||
contentPane.add(txtDescription);
|
||||
|
||||
txtTitle = new JTextField();
|
||||
txtTitle.setBounds(159, 12, 187, 19);
|
||||
contentPane.add(txtTitle);
|
||||
txtTitle.setColumns(10);
|
||||
|
||||
txtTags = new JTextField();
|
||||
txtTags.setColumns(10);
|
||||
txtTags.setBounds(22, 465, 324, 19);
|
||||
contentPane.add(txtTags);
|
||||
|
||||
JButton btnLoad = new JButton("Wczytaj");
|
||||
btnLoad.setBounds(417, 247, 102, 25);
|
||||
contentPane.add(btnLoad);
|
||||
|
||||
JButton btnSave = new JButton("Zapisz");
|
||||
btnSave.setBounds(417, 406, 102, 25);
|
||||
contentPane.add(btnSave);
|
||||
|
||||
JButton btnCancel = new JButton("Anuluj");
|
||||
btnCancel.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setVisible(false);
|
||||
}
|
||||
});
|
||||
btnCancel.setBounds(417, 438, 102, 25);
|
||||
contentPane.add(btnCancel);
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,43 @@ public class FrmMain extends JFrame {
|
||||
private static final long serialVersionUID = 2634383304749703669L;
|
||||
private JPanel contentPane;
|
||||
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.
|
||||
@@ -38,7 +75,7 @@ public class FrmMain extends JFrame {
|
||||
setResizable(false);
|
||||
setTitle("Książka Kucharska v1.0");
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setBounds(100, 100, 800, 500);
|
||||
setBounds(100, 100, 800, 549);
|
||||
contentPane = new JPanel();
|
||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
contentPane.setLayout(new BorderLayout(0, 0));
|
||||
@@ -69,7 +106,7 @@ public class FrmMain extends JFrame {
|
||||
panel.add(txtSearch, gbc_txtSearch);
|
||||
txtSearch.setColumns(10);
|
||||
|
||||
JButton btnSearch = new JButton("Szukaj");
|
||||
btnSearch = new JButton("Szukaj");
|
||||
GridBagConstraints gbc_btnSearch = new GridBagConstraints();
|
||||
gbc_btnSearch.anchor = GridBagConstraints.NORTH;
|
||||
gbc_btnSearch.fill = GridBagConstraints.HORIZONTAL;
|
||||
@@ -98,31 +135,48 @@ public class FrmMain extends JFrame {
|
||||
panel.add(panel_1, gbc_panel_1);
|
||||
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);
|
||||
|
||||
JButton btnDelRecipe = new JButton("Usuń");
|
||||
btnDelRecipe = new JButton("Usuń");
|
||||
panel_1.add(btnDelRecipe);
|
||||
|
||||
JPanel panel_2 = new JPanel();
|
||||
splitPane.setRightComponent(panel_2);
|
||||
panel_2.setLayout(null);
|
||||
|
||||
JTextPane txtIngredients = new JTextPane();
|
||||
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 txtDescription = new JTextPane();
|
||||
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.setBounds(12, 12, 442, 22);
|
||||
panel_2.add(lblRecipeTitle);
|
||||
@@ -139,5 +193,31 @@ public class FrmMain extends JFrame {
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user