Browse Source

poprawiona obsługa przycisków w UI

master
Piotr Dergun 10 years ago
parent
commit
5e8decaaf1
3 changed files with 9 additions and 3 deletions
  1. BIN
      cookbook.db
  2. +1
    -1
      src/main/java/db/Cookbook.java
  3. +8
    -2
      src/main/java/ksiazka/kucharska/FrmMain.java

BIN
cookbook.db View File


+ 1
- 1
src/main/java/db/Cookbook.java View File

@ -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;

+ 8
- 2
src/main/java/ksiazka/kucharska/FrmMain.java View File

@ -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)

Loading…
Cancel
Save