poprawiona obsługa przycisków w UI
This commit is contained in:
BIN
cookbook.db
Normal file
BIN
cookbook.db
Normal file
Binary file not shown.
@@ -9,7 +9,7 @@ import db.Recipe;
|
|||||||
public class Cookbook {
|
public class Cookbook {
|
||||||
|
|
||||||
public static final String DRIVER = "org.sqlite.JDBC";
|
public static final String DRIVER = "org.sqlite.JDBC";
|
||||||
public static final String DB_URL = "jdbc:sqlite:cookbook";
|
public static final String DB_URL = "jdbc:sqlite:cookbook.db";
|
||||||
|
|
||||||
private Connection conn;
|
private Connection conn;
|
||||||
private Statement stat;
|
private Statement stat;
|
||||||
|
|||||||
@@ -58,7 +58,10 @@ public class FrmMain extends JFrame {
|
|||||||
private JButton btnLoadImg;
|
private JButton btnLoadImg;
|
||||||
public static JLabel lblRecipeTitle;
|
public static JLabel lblRecipeTitle;
|
||||||
private static DefaultListModel recipesListModel;
|
private static DefaultListModel recipesListModel;
|
||||||
|
private JLabel imgRecipe;
|
||||||
|
private JFileChooser fcImg;
|
||||||
|
private ImageIcon imgDefaultRecipe;
|
||||||
|
private JList recipesList;
|
||||||
|
|
||||||
void DeactivateAddMenu() {
|
void DeactivateAddMenu() {
|
||||||
btnCancel.setVisible(false);
|
btnCancel.setVisible(false);
|
||||||
@@ -71,6 +74,7 @@ public class FrmMain extends JFrame {
|
|||||||
txtIngredients.setEditable(false);
|
txtIngredients.setEditable(false);
|
||||||
txtTags.setEditable(false);
|
txtTags.setEditable(false);
|
||||||
lblRecipeTitle.setVisible(true);
|
lblRecipeTitle.setVisible(true);
|
||||||
|
recipesList.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivateAddMenu() {
|
void ActivateAddMenu() {
|
||||||
@@ -84,6 +88,8 @@ public class FrmMain extends JFrame {
|
|||||||
txtIngredients.setEditable(true);
|
txtIngredients.setEditable(true);
|
||||||
txtTags.setEditable(true);
|
txtTags.setEditable(true);
|
||||||
lblRecipeTitle.setVisible(false);
|
lblRecipeTitle.setVisible(false);
|
||||||
|
recipesList.setEnabled(false);
|
||||||
|
|
||||||
|
|
||||||
//czyszczenie pól formularza
|
//czyszczenie pól formularza
|
||||||
txtDescription.setText("");
|
txtDescription.setText("");
|
||||||
@@ -145,7 +151,7 @@ public class FrmMain extends JFrame {
|
|||||||
panel.add(btnSearch, gbc_btnSearch);
|
panel.add(btnSearch, gbc_btnSearch);
|
||||||
|
|
||||||
recipesListModel = new DefaultListModel();
|
recipesListModel = new DefaultListModel();
|
||||||
final JList recipesList = new JList(recipesListModel);
|
recipesList = new JList(recipesListModel);
|
||||||
recipesList.addListSelectionListener(new ListSelectionListener() {
|
recipesList.addListSelectionListener(new ListSelectionListener() {
|
||||||
public void valueChanged(ListSelectionEvent e){
|
public void valueChanged(ListSelectionEvent e){
|
||||||
if(recipesList.getSelectedIndex() != -1)
|
if(recipesList.getSelectedIndex() != -1)
|
||||||
|
|||||||
Reference in New Issue
Block a user