diff --git a/build/classes/library/Album.class b/build/classes/library/Album.class
index ad04557..0f4eeca 100644
Binary files a/build/classes/library/Album.class and b/build/classes/library/Album.class differ
diff --git a/build/classes/library/Book.class b/build/classes/library/Book.class
index c3b3a8b..46c8077 100644
Binary files a/build/classes/library/Book.class and b/build/classes/library/Book.class differ
diff --git a/build/classes/library/Movie.class b/build/classes/library/Movie.class
index 88c05b9..4254a6f 100644
Binary files a/build/classes/library/Movie.class and b/build/classes/library/Movie.class differ
diff --git a/build/classes/library/MovieFieldPattern$1.class b/build/classes/library/MovieFieldPattern$1.class
index 5195324..98f9393 100644
Binary files a/build/classes/library/MovieFieldPattern$1.class and b/build/classes/library/MovieFieldPattern$1.class differ
diff --git a/build/classes/library/MovieFieldPattern$2.class b/build/classes/library/MovieFieldPattern$2.class
index a030694..6be2ba3 100644
Binary files a/build/classes/library/MovieFieldPattern$2.class and b/build/classes/library/MovieFieldPattern$2.class differ
diff --git a/build/classes/library/MovieFieldPattern$4.class b/build/classes/library/MovieFieldPattern$4.class
index 4f676df..afb88a0 100644
Binary files a/build/classes/library/MovieFieldPattern$4.class and b/build/classes/library/MovieFieldPattern$4.class differ
diff --git a/build/classes/library/MovieFieldPattern$5.class b/build/classes/library/MovieFieldPattern$5.class
deleted file mode 100644
index cedab83..0000000
Binary files a/build/classes/library/MovieFieldPattern$5.class and /dev/null differ
diff --git a/build/classes/library/MovieFieldPattern.class b/build/classes/library/MovieFieldPattern.class
index b43f85f..625e0bb 100644
Binary files a/build/classes/library/MovieFieldPattern.class and b/build/classes/library/MovieFieldPattern.class differ
diff --git a/build/classes/library/MovieFieldPattern.form b/build/classes/library/MovieFieldPattern.form
index 837f72d..8f266ba 100644
--- a/build/classes/library/MovieFieldPattern.form
+++ b/build/classes/library/MovieFieldPattern.form
@@ -42,12 +42,10 @@
-
-
@@ -73,11 +71,6 @@
-
-
-
-
-
@@ -125,24 +118,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/library/Album.java b/src/library/Album.java
index 2b313eb..7e75e2f 100644
--- a/src/library/Album.java
+++ b/src/library/Album.java
@@ -25,7 +25,7 @@ public class Album extends Item {
};
@Override
public void delFromDB(){
- String query = "DELETE FROM albums WHERE id=" + this.getId() + ";";
+
};
@Override
public void editInDB(){
diff --git a/src/library/Book.java b/src/library/Book.java
index b844c8e..ce8ca50 100644
--- a/src/library/Book.java
+++ b/src/library/Book.java
@@ -11,6 +11,9 @@ package library;
*/
public class Book extends Item {
+ private String authorName, authorSurname, publishing, ISBN;
+ private Database d = new Database();
+
Book() {
//nothing to do
}
@@ -31,24 +34,17 @@ public class Book extends Item {
d.insertBookQ(this);
}
- ;
-@Override
+ @Override
public void delFromDB() {
- String query = "DELETE FROM books WHERE id=" + this.getId() + ";";
+
}
- ;
-@Override
+ @Override
public void editInDB() {
}
- ;
- /*public void insertQuery(){
- System.out.println("INSERT INTO books VALUES('NULL', '" +name + "', '" + authorName + "', '" + authorSurname + "', '"+ publishing + "', '"+ year + "', '"+ ISBN + "', '"+ category + "');");
- }*/
-
-public void setPublishing(String s) {
+ public void setPublishing(String s) {
this.publishing = s;
}
@@ -79,7 +75,5 @@ public void setPublishing(String s) {
public String getISBN() {
return this.ISBN;
}
- private String authorName, authorSurname, publishing, ISBN;
- private Database d = new Database();
}
diff --git a/src/library/Database.java b/src/library/Database.java
index 304b2d7..23242d8 100644
--- a/src/library/Database.java
+++ b/src/library/Database.java
@@ -85,9 +85,8 @@ public class Database {
prepStmt.setInt(5, b.getYear());
prepStmt.setString(6, b.getISBN());
prepStmt.setString(7, b.getCategory());
-
prepStmt.execute();
-
+ JOptionPane.showMessageDialog(null, "Dodano poprawnie.", "Informacja:", JOptionPane.INFORMATION_MESSAGE);
/* String sel = "SELECT * FROM books WHERE name LIKE ? AND author_name LIKE ? AND author_surname LIKE ? AND publishing LIKE ? AND year = ? AND isbn LIKE ? AND category LIKE ? ;";
PreparedStatement prepStmt2 = conn.prepareStatement(sel);
prepStmt.setString(1, b.getName());
@@ -115,14 +114,14 @@ public class Database {
prepStmt.setString(2, a.getMusican());
prepStmt.setInt(3, a.getYear());
prepStmt.setString(4, a.getCategory());
-
prepStmt.execute();
+ JOptionPane.showMessageDialog(null, "Dodano poprawnie.", "Informacja:", JOptionPane.INFORMATION_MESSAGE);
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Błąd przy dodawaniu do bazy", "Error:", JOptionPane.INFORMATION_MESSAGE);
}
}
-
+
public void insertMovieQ(Movie m) {
try {
PreparedStatement prepStmt = conn.prepareStatement(
@@ -132,6 +131,7 @@ public class Database {
prepStmt.setInt(3, m.getYear());
prepStmt.setString(4, m.getCategory());
prepStmt.execute();
+ JOptionPane.showMessageDialog(null, "Dodano poprawnie.", "Informacja:", JOptionPane.INFORMATION_MESSAGE);
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Błąd przy dodawaniu do bazy", "Error:", JOptionPane.INFORMATION_MESSAGE);
}
diff --git a/src/library/Movie.java b/src/library/Movie.java
index 11d9ece..0e3b92a 100644
--- a/src/library/Movie.java
+++ b/src/library/Movie.java
@@ -15,43 +15,44 @@ import javax.swing.JOptionPane;
*
* @author Agnieszka
*/
-public class Movie extends Item{
+public class Movie extends Item {
+
public Connection conn;
public Statement stat;
private String director;
private Database d = new Database();
-
- Movie(){
+
+ Movie() {
//nothing to do there
}
-
- Movie(int id, String n, String d, int y, String c){
+
+ Movie(int id, String n, String d, int y, String c) {
this.setId(id);
this.setName(n);
this.director = d;
this.setYear(y);
this.setCategory(c);
-
}
-@Override
-public void insertToDB(){
- d.insertMovieQ(this);
-};
-public String getDirector(){
- return this.director;
-}
-@Override
-public void delFromDB(){
+ @Override
+ public void insertToDB() {
+ d.insertMovieQ(this);
+ }
+
+ @Override
+ public void delFromDB() {
String query = "DELETE FROM books WHERE id=" + this.getId() + ";";
-};
+ }
-@Override
-public void editInDB(){
-
-};
+ @Override
+ public void editInDB() {
+ }
+
+ public String getDirector() {
+ return this.director;
+ }
}
- /*public void insertQuery(){
+/*public void insertQuery(){
System.out.println("INSERT INTO books VALUES('NULL', '" +name + "', '" + authorName + "', '" + authorSurname + "', '"+ publishing + "', '"+ year + "', '"+ ISBN + "', '"+ category + "');");
}*/
diff --git a/src/library/MovieFieldPattern.form b/src/library/MovieFieldPattern.form
index 837f72d..8f266ba 100644
--- a/src/library/MovieFieldPattern.form
+++ b/src/library/MovieFieldPattern.form
@@ -42,12 +42,10 @@
-
-
@@ -73,11 +71,6 @@
-
-
-
-
-
@@ -125,24 +118,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/library/MovieFieldPattern.java b/src/library/MovieFieldPattern.java
index 18acabf..727b77b 100644
--- a/src/library/MovieFieldPattern.java
+++ b/src/library/MovieFieldPattern.java
@@ -42,8 +42,6 @@ public class MovieFieldPattern extends javax.swing.JFrame {
movieTitle = new javax.swing.JTextField();
directorrname = new javax.swing.JLabel();
director = new javax.swing.JTextField();
- script = new javax.swing.JTextField();
- authorsurname = new javax.swing.JLabel();
lyear = new javax.swing.JLabel();
year = new javax.swing.JTextField();
lcategory = new javax.swing.JLabel();
@@ -63,16 +61,6 @@ public class MovieFieldPattern extends javax.swing.JFrame {
director.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- script.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- script.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- scriptActionPerformed(evt);
- }
- });
-
- authorsurname.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- authorsurname.setText("Scenariusz:");
-
lyear.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
lyear.setText("Rok:");
@@ -124,12 +112,10 @@ public class MovieFieldPattern extends javax.swing.JFrame {
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(lcategory, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(lyear, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
- .addComponent(authorsurname, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(lyear, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE))
.addGap(17, 17, 17)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(year, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(script, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Category, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(SaveChanges, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(21, Short.MAX_VALUE))
@@ -148,10 +134,6 @@ public class MovieFieldPattern extends javax.swing.JFrame {
.addComponent(directorrname)
.addComponent(director, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(authorsurname)
- .addComponent(script, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lyear)
.addComponent(year, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
@@ -177,7 +159,8 @@ public class MovieFieldPattern extends javax.swing.JFrame {
private void SaveChangesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveChangesActionPerformed
if (this.add) {
- JOptionPane.showMessageDialog(null, "DODAJ");
+ Movie m = new Movie(0, movieTitle.getText(), director.getText(), Integer.parseInt(year.getText()), Category.getSelectedItem().toString() );
+ m.insertToDB();
} else if (this.edit) {
JOptionPane.showMessageDialog(null, "EDYTUJ");
} else if (this.delete) {
@@ -186,10 +169,6 @@ public class MovieFieldPattern extends javax.swing.JFrame {
dispose();
}//GEN-LAST:event_SaveChangesActionPerformed
- private void scriptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_scriptActionPerformed
- // TODO add your handling code here:
- }//GEN-LAST:event_scriptActionPerformed
-
private void yearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yearActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_yearActionPerformed
@@ -235,14 +214,12 @@ public class MovieFieldPattern extends javax.swing.JFrame {
private javax.swing.JComboBox Category;
private javax.swing.JButton SaveChanges;
private javax.swing.JLabel Title;
- private javax.swing.JLabel authorsurname;
private javax.swing.JTextField director;
private javax.swing.JLabel directorrname;
private javax.swing.JLabel lcategory;
private javax.swing.JLabel lyear;
private javax.swing.JLabel mainlabel;
private javax.swing.JTextField movieTitle;
- private javax.swing.JTextField script;
private javax.swing.JTextField year;
// End of variables declaration//GEN-END:variables
}