projekt gotowy :)
This commit is contained in:
parent
0d3d99d8ce
commit
94ac1d5e0e
BIN
biblioteka.db
BIN
biblioteka.db
Binary file not shown.
@ -234,6 +234,7 @@ public class AlbumFieldPattern extends javax.swing.JFrame {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
d.closeConnection();
|
||||
dispose();
|
||||
}//GEN-LAST:event_SaveChangesActionPerformed
|
||||
|
||||
|
@ -138,9 +138,6 @@
|
||||
<Font name="Tahoma" size="14" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bookTitleActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="BookFieldPattern_bookTitle"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
@ -167,9 +164,6 @@
|
||||
<Font name="Tahoma" size="14" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="authorSurnameActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="authorsurname">
|
||||
<Properties>
|
||||
@ -229,7 +223,6 @@
|
||||
<Events>
|
||||
<EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="ISBNFocusGained"/>
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="ISBNFocusLost"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ISBNActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lcategory">
|
||||
|
@ -128,11 +128,6 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
||||
Title.setText("Tytuł:");
|
||||
|
||||
bookTitle.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||
bookTitle.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
bookTitleActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
authorname.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||
authorname.setText("Imię autora:");
|
||||
@ -140,11 +135,6 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
||||
authorName.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||
|
||||
authorSurname.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||
authorSurname.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
authorSurnameActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
authorsurname.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||
authorsurname.setText("Nazwisko autora:");
|
||||
@ -174,11 +164,6 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
||||
ISBNFocusLost(evt);
|
||||
}
|
||||
});
|
||||
ISBN.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
ISBNActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
lcategory.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
|
||||
lcategory.setText("Kategoria:");
|
||||
@ -324,29 +309,18 @@ public class BookFieldPattern extends javax.swing.JFrame {
|
||||
Book b = new Book(0, bookTitle.getText(), authorName.getText(), authorSurname.getText(), year.getText(), ISBN.getText(), publishing.getText(), Category.getSelectedItem().toString());
|
||||
this.search(b);
|
||||
} else if (this.update) {
|
||||
Book b = new Book(Integer.parseInt(idValue.getText()), bookTitle.getText(), authorName.getText(), authorSurname.getText(), year.getText(), ISBN.getText(), publishing.getText(), Category.getSelectedItem().toString());
|
||||
try {
|
||||
Book b = new Book(Integer.parseInt(idValue.getText()), bookTitle.getText(), authorName.getText(), authorSurname.getText(), year.getText(), ISBN.getText(), publishing.getText(), Category.getSelectedItem().toString());
|
||||
d.updateQ(b);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
d.closeConnection();
|
||||
dispose();
|
||||
}//GEN-LAST:event_SaveChangesActionPerformed
|
||||
|
||||
private void authorSurnameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_authorSurnameActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_authorSurnameActionPerformed
|
||||
|
||||
private void bookTitleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bookTitleActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_bookTitleActionPerformed
|
||||
|
||||
private void ISBNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ISBNActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_ISBNActionPerformed
|
||||
|
||||
private void ISBNFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ISBNFocusGained
|
||||
jLabel1.setVisible(true);
|
||||
}//GEN-LAST:event_ISBNFocusGained
|
||||
|
@ -131,10 +131,15 @@ public class Database {
|
||||
|
||||
}
|
||||
|
||||
public List<Book> selectBooks() {
|
||||
public List<Book> selectBooks(String...ownQuery) {
|
||||
List<Book> books = new ArrayList<Book>();
|
||||
try {
|
||||
ResultSet result = stat.executeQuery("SELECT * FROM books");
|
||||
ResultSet result;
|
||||
if (ownQuery[0].length() > 0) {
|
||||
result = stat.executeQuery(ownQuery[0]);
|
||||
} else {
|
||||
result = stat.executeQuery("SELECT * FROM books ORDER BY name");
|
||||
}
|
||||
int id;
|
||||
String name, authorName, authorSurname, isbn, category, publishing, year;
|
||||
while (result.next()) {
|
||||
@ -216,10 +221,15 @@ public class Database {
|
||||
return books;
|
||||
}
|
||||
|
||||
public List<Album> selectAlbums() {
|
||||
public List<Album> selectAlbums(String... ownQuery) {
|
||||
List<Album> albums = new ArrayList<Album>();
|
||||
try {
|
||||
ResultSet result = stat.executeQuery("SELECT * FROM albums");
|
||||
ResultSet result;
|
||||
if (ownQuery[0].length() > 0) {
|
||||
result = stat.executeQuery(ownQuery[0]);
|
||||
} else {
|
||||
result = stat.executeQuery("SELECT * FROM albums ORDER BY name");
|
||||
}
|
||||
int id;
|
||||
String name, musican, category, year;
|
||||
while (result.next()) {
|
||||
@ -232,6 +242,7 @@ public class Database {
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
JOptionPane.showMessageDialog(null, "Błąd przy odczycie z bazy.", "Error:", JOptionPane.INFORMATION_MESSAGE);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return albums;
|
||||
}
|
||||
@ -286,10 +297,15 @@ public class Database {
|
||||
return albums;
|
||||
}
|
||||
|
||||
public List<Movie> selectMovies() {
|
||||
public List<Movie> selectMovies(String... ownQuery) {
|
||||
List<Movie> movies = new ArrayList<Movie>();
|
||||
try {
|
||||
ResultSet result = stat.executeQuery("SELECT * FROM movies");
|
||||
ResultSet result;
|
||||
if (ownQuery[0].length() > 0) {
|
||||
result = stat.executeQuery(ownQuery[0]);
|
||||
} else {
|
||||
result = stat.executeQuery("SELECT * FROM movies ORDER BY name;");
|
||||
}
|
||||
int id;
|
||||
String name, category, director, year;
|
||||
while (result.next()) {
|
||||
|
@ -34,28 +34,28 @@
|
||||
<Component id="programTitle" pref="817" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="359" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jToggleButton1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="359" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="searchButtonsPanel" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="searchButtonsPanel" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="141" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
@ -63,17 +63,15 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
|
||||
<Component id="programTitle" min="-2" pref="38" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="searchButtonsPanel" min="-2" pref="87" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="jPanel2" max="32767" attributes="0"/>
|
||||
<Component id="jPanel1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="jToggleButton1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -83,7 +81,7 @@
|
||||
<Component class="javax.swing.JLabel" name="programTitle">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="24" style="3"/>
|
||||
<Font name="Tahoma" size="24" style="2"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="Library Manager 2016"/>
|
||||
@ -103,28 +101,27 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="194" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="bBook" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="bMovie" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="bAlbum" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="radioBSearch" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="133" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="radioBAdd" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="radioBEdit" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="radioBDelete" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="78" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="radioBDelete" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="182" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -181,9 +178,6 @@
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Dodawanie"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioBAddActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="radioBEdit">
|
||||
<Properties>
|
||||
@ -192,9 +186,6 @@
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Modyfikacja"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioBEditActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="radioBDelete">
|
||||
<Properties>
|
||||
@ -203,9 +194,6 @@
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Usuwanie"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioBDeleteActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="radioBSearch">
|
||||
<Properties>
|
||||
@ -248,9 +236,9 @@
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="newestMovie1" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="newestBook1" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="newestAlbum1" alignment="0" min="-2" pref="139" max="-2" attributes="0"/>
|
||||
<Component id="oldestMovie" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="oldestBook" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="oldestAlbum" alignment="0" min="-2" pref="139" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="67" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
@ -262,11 +250,11 @@
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="newestBook1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="oldestBook" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="newestMovie1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="oldestMovie" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="newestAlbum1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="oldestAlbum" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
@ -319,31 +307,49 @@
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Najnowsza książka"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="newestBookActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="newestMovie">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Najnowszy film"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="newestMovieActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="newestAlbum">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Najnowszy album"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="newestAlbumActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="newestBook1">
|
||||
<Component class="javax.swing.JButton" name="oldestBook">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Najnowsza książka"/>
|
||||
<Property name="text" type="java.lang.String" value="Najstarsza książka"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="oldestBookActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="newestMovie1">
|
||||
<Component class="javax.swing.JButton" name="oldestMovie">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Najnowszy film"/>
|
||||
<Property name="text" type="java.lang.String" value="Najstarszy film"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="oldestMovieActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="newestAlbum1">
|
||||
<Component class="javax.swing.JButton" name="oldestAlbum">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Najnowszy album"/>
|
||||
<Property name="text" type="java.lang.String" value="Najstarszy album"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="oldestAlbumActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
@ -467,10 +473,5 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JToggleButton" name="jToggleButton1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Własne zapytanie SELECT"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -50,9 +50,9 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
newestBook = new javax.swing.JButton();
|
||||
newestMovie = new javax.swing.JButton();
|
||||
newestAlbum = new javax.swing.JButton();
|
||||
newestBook1 = new javax.swing.JButton();
|
||||
newestMovie1 = new javax.swing.JButton();
|
||||
newestAlbum1 = new javax.swing.JButton();
|
||||
oldestBook = new javax.swing.JButton();
|
||||
oldestMovie = new javax.swing.JButton();
|
||||
oldestAlbum = new javax.swing.JButton();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
@ -61,11 +61,10 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
numberOfAlbums = new javax.swing.JLabel();
|
||||
numberOfMovies = new javax.swing.JLabel();
|
||||
refreshNumbersOfItems = new javax.swing.JButton();
|
||||
jToggleButton1 = new javax.swing.JToggleButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
|
||||
programTitle.setFont(new java.awt.Font("Tahoma", 3, 24)); // NOI18N
|
||||
programTitle.setFont(new java.awt.Font("Tahoma", 2, 24)); // NOI18N
|
||||
programTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
programTitle.setText("Library Manager 2016");
|
||||
|
||||
@ -94,27 +93,12 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
|
||||
mode.add(radioBAdd);
|
||||
radioBAdd.setText("Dodawanie");
|
||||
radioBAdd.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
radioBAddActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
mode.add(radioBEdit);
|
||||
radioBEdit.setText("Modyfikacja");
|
||||
radioBEdit.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
radioBEditActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
mode.add(radioBDelete);
|
||||
radioBDelete.setText("Usuwanie");
|
||||
radioBDelete.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
radioBDeleteActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
mode.add(radioBSearch);
|
||||
radioBSearch.setSelected(true);
|
||||
@ -129,25 +113,24 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
searchButtonsPanel.setLayout(searchButtonsPanelLayout);
|
||||
searchButtonsPanelLayout.setHorizontalGroup(
|
||||
searchButtonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(searchButtonsPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(searchButtonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, searchButtonsPanelLayout.createSequentialGroup()
|
||||
.addContainerGap(194, Short.MAX_VALUE)
|
||||
.addGroup(searchButtonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(searchButtonsPanelLayout.createSequentialGroup()
|
||||
.addComponent(bBook)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(bMovie)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(bAlbum)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(bAlbum))
|
||||
.addGroup(searchButtonsPanelLayout.createSequentialGroup()
|
||||
.addComponent(radioBSearch)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 133, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(radioBAdd)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(radioBEdit)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(radioBDelete)
|
||||
.addGap(78, 78, 78))))
|
||||
.addComponent(radioBEdit)))
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(radioBDelete)
|
||||
.addGap(182, 182, 182))
|
||||
);
|
||||
searchButtonsPanelLayout.setVerticalGroup(
|
||||
searchButtonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@ -190,16 +173,46 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
});
|
||||
|
||||
newestBook.setText("Najnowsza książka");
|
||||
newestBook.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
newestBookActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
newestMovie.setText("Najnowszy film");
|
||||
newestMovie.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
newestMovieActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
newestAlbum.setText("Najnowszy album");
|
||||
newestAlbum.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
newestAlbumActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
newestBook1.setText("Najnowsza książka");
|
||||
oldestBook.setText("Najstarsza książka");
|
||||
oldestBook.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
oldestBookActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
newestMovie1.setText("Najnowszy film");
|
||||
oldestMovie.setText("Najstarszy film");
|
||||
oldestMovie.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
oldestMovieActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
newestAlbum1.setText("Najnowszy album");
|
||||
oldestAlbum.setText("Najstarszy album");
|
||||
oldestAlbum.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
oldestAlbumActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
@ -218,9 +231,9 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
.addComponent(newestAlbum, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(34, 34, 34)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(newestMovie1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(newestBook1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(newestAlbum1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(oldestMovie, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(oldestBook, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(oldestAlbum, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(67, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
@ -229,11 +242,11 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(newestBook1)
|
||||
.addComponent(oldestBook)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(newestMovie1)
|
||||
.addComponent(oldestMovie)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(newestAlbum1))
|
||||
.addComponent(oldestAlbum))
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(newestBook)
|
||||
@ -317,8 +330,6 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
.addComponent(refreshNumbersOfItems))
|
||||
);
|
||||
|
||||
jToggleButton1.setText("Własne zapytanie SELECT");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@ -329,37 +340,34 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
.addContainerGap()
|
||||
.addComponent(programTitle, javax.swing.GroupLayout.DEFAULT_SIZE, 817, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(359, 359, 359)
|
||||
.addComponent(jLabel1))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(19, 19, 19)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jToggleButton1)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addGap(359, 359, 359)
|
||||
.addComponent(jLabel1))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(19, 19, 19)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(searchButtonsPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(searchButtonsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(141, 141, 141))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(24, 24, 24)
|
||||
.addComponent(programTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(searchButtonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jToggleButton1)
|
||||
.addGap(1, 1, 1)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
@ -382,7 +390,7 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
b.setVisible(true);
|
||||
b.delete = true;
|
||||
}
|
||||
if (radioBDelete.getModel().isSelected()) {
|
||||
if (radioBDelete.getModel().isSelected()) {
|
||||
MovieFieldPattern b = new MovieFieldPattern();
|
||||
b.setVisible(true);
|
||||
b.delete = true;
|
||||
@ -413,18 +421,10 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
}
|
||||
}//GEN-LAST:event_bAlbumActionPerformed
|
||||
|
||||
private void radioBEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioBEditActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_radioBEditActionPerformed
|
||||
|
||||
private void radioBSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioBSearchActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_radioBSearchActionPerformed
|
||||
|
||||
private void radioBAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioBAddActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_radioBAddActionPerformed
|
||||
|
||||
private void bBookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bBookActionPerformed
|
||||
if (radioBAdd.getModel().isSelected()) {
|
||||
BookFieldPattern b = new BookFieldPattern(true);
|
||||
@ -441,7 +441,7 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
b.setVisible(true);
|
||||
b.search = true;
|
||||
}
|
||||
if (radioBDelete.getModel().isSelected()) {
|
||||
if (radioBDelete.getModel().isSelected()) {
|
||||
BookFieldPattern b = new BookFieldPattern();
|
||||
b.setVisible(true);
|
||||
b.delete = true;
|
||||
@ -449,15 +449,10 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
|
||||
}//GEN-LAST:event_bBookActionPerformed
|
||||
|
||||
private void radioBDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioBDeleteActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_radioBDeleteActionPerformed
|
||||
|
||||
private void allBooksShowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allBooksShowActionPerformed
|
||||
try {
|
||||
List<Book> books = new LinkedList<>();
|
||||
books = d.selectBooks();
|
||||
Object[][] data = d.convertToTable(books);
|
||||
Object[][] data = d.convertToTable(d.selectBooks(""));
|
||||
String[] columnNames = {"ID",
|
||||
"Tytuł",
|
||||
"Imię Autora",
|
||||
@ -476,8 +471,7 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
private void allMovieShowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allMovieShowActionPerformed
|
||||
try {
|
||||
List<Movie> movies = new LinkedList<>();
|
||||
movies = d.selectMovies();
|
||||
Object[][] data = d.convertToTable(movies);
|
||||
Object[][] data = d.convertToTable(d.selectMovies(""));
|
||||
String[] columnNames = {
|
||||
"ID",
|
||||
"Tytuł",
|
||||
@ -492,11 +486,9 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
}//GEN-LAST:event_allMovieShowActionPerformed
|
||||
|
||||
private void allAlbumsShowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allAlbumsShowActionPerformed
|
||||
|
||||
try {
|
||||
List<Album> albums = new LinkedList<>();
|
||||
albums = d.selectAlbums();
|
||||
Object[][] data = d.convertToTable(albums);
|
||||
Object[][] data = d.convertToTable(d.selectAlbums(""));
|
||||
String[] columnNames = {
|
||||
"ID",
|
||||
"Tytuł",
|
||||
@ -509,7 +501,6 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
//nothing to do here
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_allAlbumsShowActionPerformed
|
||||
|
||||
private void refreshNumbersOfItemsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshNumbersOfItemsActionPerformed
|
||||
@ -523,6 +514,116 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
numberOfMovies.setText(n);
|
||||
}//GEN-LAST:event_refreshNumbersOfItemsActionPerformed
|
||||
|
||||
private void newestBookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newestBookActionPerformed
|
||||
try {
|
||||
List<Book> books = new LinkedList<>();
|
||||
Object[][] data = d.convertToTable(d.selectBooks("SELECT id, name, author_name, author_surname, MAX(year) AS year, isbn, publishing, category FROM books ORDER BY name;"));
|
||||
String[] columnNames = {"ID",
|
||||
"Tytuł",
|
||||
"Imię Autora",
|
||||
"Nazwisko Autora",
|
||||
"Rok",
|
||||
"ISBN",
|
||||
"Wydawnictwo",
|
||||
"Kategoria"};
|
||||
ListResult table = new ListResult(data, columnNames, "book");
|
||||
table.setVisible(true);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
//nothing to do here
|
||||
}
|
||||
}//GEN-LAST:event_newestBookActionPerformed
|
||||
|
||||
private void newestMovieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newestMovieActionPerformed
|
||||
try {
|
||||
List<Movie> movies = new LinkedList<>();
|
||||
movies = d.selectMovies("SELECT id, name, director, MAX(year) AS year, category FROM movies;");
|
||||
Object[][] data = d.convertToTable(movies);
|
||||
String[] columnNames = {
|
||||
"ID",
|
||||
"Tytuł",
|
||||
"Reżyser",
|
||||
"Rok",
|
||||
"Kategoria"};
|
||||
ListResult table = new ListResult(data, columnNames, "movie");
|
||||
table.setVisible(true);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
//nothing to do here
|
||||
}
|
||||
}//GEN-LAST:event_newestMovieActionPerformed
|
||||
|
||||
private void oldestBookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_oldestBookActionPerformed
|
||||
try {
|
||||
List<Book> books = new LinkedList<>();
|
||||
Object[][] data = d.convertToTable(d.selectBooks("SELECT id, name, author_name, author_surname, MIN(year) AS year, isbn, publishing, category FROM books ORDER BY name;"));
|
||||
String[] columnNames = {"ID",
|
||||
"Tytuł",
|
||||
"Imię Autora",
|
||||
"Nazwisko Autora",
|
||||
"Rok",
|
||||
"ISBN",
|
||||
"Wydawnictwo",
|
||||
"Kategoria"};
|
||||
ListResult table = new ListResult(data, columnNames, "book");
|
||||
table.setVisible(true);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
//nothing to do here
|
||||
}
|
||||
}//GEN-LAST:event_oldestBookActionPerformed
|
||||
|
||||
private void oldestMovieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_oldestMovieActionPerformed
|
||||
try {
|
||||
List<Movie> movies = new LinkedList<>();
|
||||
movies = d.selectMovies("SELECT id, name, director, MIN(year) AS year, category FROM movies;");
|
||||
Object[][] data = d.convertToTable(movies);
|
||||
String[] columnNames = {
|
||||
"ID",
|
||||
"Tytuł",
|
||||
"Reżyser",
|
||||
"Rok",
|
||||
"Kategoria"};
|
||||
ListResult table = new ListResult(data, columnNames, "movie");
|
||||
table.setVisible(true);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
//nothing to do here
|
||||
} // TODO add your handling code here:
|
||||
}//GEN-LAST:event_oldestMovieActionPerformed
|
||||
|
||||
private void newestAlbumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newestAlbumActionPerformed
|
||||
try {
|
||||
List<Album> albums = new LinkedList<>();
|
||||
Object[][] data = d.convertToTable(d.selectAlbums("SELECT id, name, musican, MAX(year) AS year, category FROM albums ORDER BY name;"));
|
||||
String[] columnNames = {
|
||||
"ID",
|
||||
"Tytuł",
|
||||
"Muzyk/Zespół",
|
||||
"Rok",
|
||||
"Kategoria"};
|
||||
ListResult table = new ListResult(data, columnNames, "album");
|
||||
|
||||
table.setVisible(true);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
//nothing to do here
|
||||
}
|
||||
}//GEN-LAST:event_newestAlbumActionPerformed
|
||||
|
||||
private void oldestAlbumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_oldestAlbumActionPerformed
|
||||
try {
|
||||
List<Album> albums = new LinkedList<>();
|
||||
Object[][] data = d.convertToTable(d.selectAlbums("SELECT id, name, musican, MIN(year) AS year, category FROM albums ORDER BY name;"));
|
||||
String[] columnNames = {
|
||||
"ID",
|
||||
"Tytuł",
|
||||
"Muzyk/Zespół",
|
||||
"Rok",
|
||||
"Kategoria"};
|
||||
ListResult table = new ListResult(data, columnNames, "album");
|
||||
|
||||
table.setVisible(true);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
//nothing to do here
|
||||
} // TODO add your handling code here:
|
||||
}//GEN-LAST:event_oldestAlbumActionPerformed
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
@ -570,17 +671,16 @@ public class MainMenu extends javax.swing.JFrame {
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JToggleButton jToggleButton1;
|
||||
private javax.swing.ButtonGroup mode;
|
||||
private javax.swing.JButton newestAlbum;
|
||||
private javax.swing.JButton newestAlbum1;
|
||||
private javax.swing.JButton newestBook;
|
||||
private javax.swing.JButton newestBook1;
|
||||
private javax.swing.JButton newestMovie;
|
||||
private javax.swing.JButton newestMovie1;
|
||||
private javax.swing.JLabel numberOfAlbums;
|
||||
public javax.swing.JLabel numberOfBooks;
|
||||
private javax.swing.JLabel numberOfMovies;
|
||||
private javax.swing.JButton oldestAlbum;
|
||||
private javax.swing.JButton oldestBook;
|
||||
private javax.swing.JButton oldestMovie;
|
||||
private javax.swing.JLabel programTitle;
|
||||
private javax.swing.JRadioButton radioBAdd;
|
||||
private javax.swing.JRadioButton radioBDelete;
|
||||
|
@ -229,6 +229,7 @@ public class MovieFieldPattern extends javax.swing.JFrame {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
d.closeConnection();
|
||||
dispose();
|
||||
}//GEN-LAST:event_SaveChangesActionPerformed
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user