próby z oknem wyników
This commit is contained in:
parent
c8484bb75b
commit
98fa27dd1b
@ -1,4 +1,4 @@
|
|||||||
#Mon, 30 May 2016 12:41:20 +0200
|
#Mon, 06 Jun 2016 11:21:26 +0200
|
||||||
|
|
||||||
|
|
||||||
D\:\\PROJEKT\\Library=
|
D\:\\PROJEKT\\Library=
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -43,7 +43,10 @@
|
|||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="allBooksShow" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="searchButtonsPanel" min="-2" max="-2" attributes="0"/>
|
<Component id="searchButtonsPanel" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
<EmptySpace pref="21" max="32767" attributes="0"/>
|
<EmptySpace pref="21" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
@ -57,7 +60,9 @@
|
|||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="searchButtonsPanel" min="-2" pref="87" max="-2" attributes="0"/>
|
<Component id="searchButtonsPanel" min="-2" pref="87" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="0" pref="282" max="32767" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="allBooksShow" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace min="0" pref="250" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
@ -214,5 +219,13 @@
|
|||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
<Component class="javax.swing.JButton" name="allBooksShow">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Wszyskie książki"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="allBooksShowActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
BIN
dist/Library.jar
vendored
BIN
dist/Library.jar
vendored
Binary file not shown.
@ -4,9 +4,16 @@
|
|||||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||||
<group>
|
<group>
|
||||||
<file>file:/D:/PROJEKT/Library/src/library/MovieFieldPattern.java</file>
|
<file>file:/D:/PROJEKT/Library/src/library/MovieFieldPattern.java</file>
|
||||||
<file>file:/D:/PROJEKT/Library/src/library/MainMenu.java</file>
|
|
||||||
<file>file:/D:/PROJEKT/Library/src/library/BookFieldPattern.java</file>
|
<file>file:/D:/PROJEKT/Library/src/library/BookFieldPattern.java</file>
|
||||||
<file>file:/D:/PROJEKT/Library/src/library/WelcomeLogon.java</file>
|
<file>file:/D:/PROJEKT/Library/src/library/MainMenu.java</file>
|
||||||
|
<file>file:/D:/PROJEKT/Library/src/library/Item.java</file>
|
||||||
|
<file>file:/D:/PROJEKT/Library/src/library/Validation.java</file>
|
||||||
|
<file>file:/D:/PROJEKT/Library/src/library/Album.java</file>
|
||||||
|
<file>file:/D:/PROJEKT/Library/src/library/AlbumFieldPattern.java</file>
|
||||||
|
<file>file:/D:/PROJEKT/Library/src/library/Book.java</file>
|
||||||
|
<file>file:/D:/PROJEKT/Library/src/library/Movie.java</file>
|
||||||
|
<file>file:/D:/PROJEKT/Library/src/library/Database.java</file>
|
||||||
|
<file>file:/D:/PROJEKT/Library/src/library/ListResult.java</file>
|
||||||
</group>
|
</group>
|
||||||
</open-files>
|
</open-files>
|
||||||
</project-private>
|
</project-private>
|
||||||
|
@ -26,7 +26,7 @@ public class Book extends Item{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertToDB(){
|
public void insertToDB(){
|
||||||
String query = "INSERT INTO books VALUES(NULL, '" +this.getName() + "', '" + this.getAuthorName() + "', '" + this.getAuthorSurname() + "', '"+ this.getPublishing() + "', '"+ this.getYear() + "', '"+ this.getISBN() + "', '"+ this.getCategory() + "');";
|
db.insertBookQ(this);
|
||||||
};
|
};
|
||||||
@Override
|
@Override
|
||||||
public void delFromDB(){
|
public void delFromDB(){
|
||||||
@ -65,4 +65,6 @@ public String getISBN(){
|
|||||||
return this.publishing;
|
return this.publishing;
|
||||||
}
|
}
|
||||||
private String authorName, authorSurname, publishing, ISBN;
|
private String authorName, authorSurname, publishing, ISBN;
|
||||||
|
private Database db = new Database();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
package library;
|
package library;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
@ -15,6 +16,7 @@ import javax.swing.JOptionPane;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Agnieszka
|
* @author Agnieszka
|
||||||
|
* insert, delete i update do przeniesienia tutaj (9metod)
|
||||||
*/
|
*/
|
||||||
public class Database {
|
public class Database {
|
||||||
|
|
||||||
@ -58,6 +60,38 @@ public class Database {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertBookQ(Book b){
|
||||||
|
try {
|
||||||
|
PreparedStatement prepStmt = conn.prepareStatement(
|
||||||
|
"INSERT INTO books VALUES (NULL, ?, ?, ?, ?, ?, ?, ?);");
|
||||||
|
prepStmt.setString(1, b.getName());
|
||||||
|
prepStmt.setString(2, b.getAuthorName());
|
||||||
|
prepStmt.setString(3, b.getAuthorSurname());
|
||||||
|
prepStmt.setString(4, b.getPublishing());
|
||||||
|
prepStmt.setInt(5, b.getYear());
|
||||||
|
prepStmt.setString(6, b.getISBN());
|
||||||
|
prepStmt.setString(7, b.getCategory());
|
||||||
|
|
||||||
|
prepStmt.execute();
|
||||||
|
|
||||||
|
/* 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());
|
||||||
|
prepStmt.setString(2, b.getAuthorName());
|
||||||
|
prepStmt.setString(3, b.getAuthorSurname());
|
||||||
|
prepStmt.setString(4, b.getPublishing());
|
||||||
|
prepStmt.setInt(5, b.getYear());
|
||||||
|
prepStmt.setString(6, b.getISBN());
|
||||||
|
prepStmt.setString(7, b.getCategory());
|
||||||
|
|
||||||
|
ResultSet rs = stat.executeQuery(sel);
|
||||||
|
b = new Book(rs.getInt("id"), rs.getString("name"), rs.getString("author_name"), rs.getString("suthor_surname"), rs.getInt("year"), rs.getString("isbn"), rs.getString("publishing"), rs.getString("category"));
|
||||||
|
*/
|
||||||
|
} catch (SQLException e) {
|
||||||
|
JOptionPane.showMessageDialog(null, "Błąd przy dodawaniu do bazy", "Error:", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public List<Book> selectBooks() {
|
public List<Book> selectBooks() {
|
||||||
List<Book> books = new LinkedList<Book>();
|
List<Book> books = new LinkedList<Book>();
|
||||||
|
@ -43,7 +43,10 @@
|
|||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="allBooksShow" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="searchButtonsPanel" min="-2" max="-2" attributes="0"/>
|
<Component id="searchButtonsPanel" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
<EmptySpace pref="21" max="32767" attributes="0"/>
|
<EmptySpace pref="21" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
@ -57,7 +60,9 @@
|
|||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="searchButtonsPanel" min="-2" pref="87" max="-2" attributes="0"/>
|
<Component id="searchButtonsPanel" min="-2" pref="87" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="0" pref="282" max="32767" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="allBooksShow" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace min="0" pref="250" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
@ -214,5 +219,13 @@
|
|||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
<Component class="javax.swing.JButton" name="allBooksShow">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Wszyskie książki"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="allBooksShowActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -41,6 +41,7 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
radioBSearch = new javax.swing.JRadioButton();
|
radioBSearch = new javax.swing.JRadioButton();
|
||||||
bUser = new javax.swing.JButton();
|
bUser = new javax.swing.JButton();
|
||||||
radioBDelete1 = new javax.swing.JRadioButton();
|
radioBDelete1 = new javax.swing.JRadioButton();
|
||||||
|
allBooksShow = new javax.swing.JButton();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
@ -154,6 +155,13 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
.addGap(83, 83, 83))
|
.addGap(83, 83, 83))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
allBooksShow.setText("Wszyskie książki");
|
||||||
|
allBooksShow.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
allBooksShowActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
@ -170,7 +178,9 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGap(26, 26, 26)
|
.addGap(26, 26, 26)
|
||||||
.addComponent(searchButtonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(allBooksShow)
|
||||||
|
.addComponent(searchButtonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addContainerGap(21, Short.MAX_VALUE))
|
.addContainerGap(21, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
@ -182,7 +192,9 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
.addComponent(jLabel1)
|
.addComponent(jLabel1)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(searchButtonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(searchButtonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(0, 282, Short.MAX_VALUE))
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(allBooksShow)
|
||||||
|
.addGap(0, 250, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
@ -264,6 +276,11 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
// TODO add your handling code here:
|
// TODO add your handling code here:
|
||||||
}//GEN-LAST:event_radioBDelete1ActionPerformed
|
}//GEN-LAST:event_radioBDelete1ActionPerformed
|
||||||
|
|
||||||
|
private void allBooksShowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allBooksShowActionPerformed
|
||||||
|
ListResult l = new ListResult();
|
||||||
|
l.setVisible(true);
|
||||||
|
}//GEN-LAST:event_allBooksShowActionPerformed
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param args the command line arguments
|
* @param args the command line arguments
|
||||||
*/
|
*/
|
||||||
@ -299,6 +316,7 @@ public class MainMenu extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JButton allBooksShow;
|
||||||
private javax.swing.JButton bAlbum;
|
private javax.swing.JButton bAlbum;
|
||||||
private javax.swing.JButton bBook;
|
private javax.swing.JButton bBook;
|
||||||
private javax.swing.JButton bMovie;
|
private javax.swing.JButton bMovie;
|
||||||
|
Loading…
Reference in New Issue
Block a user