Baza działa

This commit is contained in:
Agnieszka Janicka 2016-06-06 12:32:35 +02:00
parent 98fa27dd1b
commit ab0325b065
15 changed files with 172 additions and 5 deletions

Binary file not shown.

View File

@ -10,7 +10,6 @@
<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>

View File

@ -30,11 +30,13 @@ dist.jar=${dist.dir}/Library.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.sqlite-jdbc-3.8.11.2.jar=sqlite-jdbc-3.8.11.2.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=
javac.classpath=\
${file.reference.sqlite-jdbc-3.8.11.2.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

View File

@ -32,7 +32,7 @@ public class Database {
} catch (ClassNotFoundException e) {
System.err.println("Brak sterownika JDBC");
e.printStackTrace();
}
}
try {
conn = DriverManager.getConnection(DB_URL);

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="341" max="-2" attributes="0"/>
<Component id="mainlabel" min="-2" pref="289" max="-2" attributes="0"/>
<EmptySpace pref="344" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="mainlabel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="265" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="mainlabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="18" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Tabela danych"/>
</Properties>
</Component>
</SubComponents>
</Form>

103
src/library/ListResult.java Normal file
View File

@ -0,0 +1,103 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package library;
import java.util.LinkedList;
import java.util.List;
/**
*
* @author Agnieszka
*/
public class ListResult extends javax.swing.JFrame {
/**
* Creates new form NewJFrame
*/
public ListResult() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
mainlabel = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
mainlabel.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
mainlabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
mainlabel.setText("Tabela danych");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(341, 341, 341)
.addComponent(mainlabel, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(344, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(mainlabel)
.addContainerGap(265, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ListResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ListResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ListResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ListResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ListResult().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel mainlabel;
// End of variables declaration//GEN-END:variables
}

View File

@ -5,6 +5,8 @@
*/
package library;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JOptionPane;
/**
@ -277,8 +279,15 @@ public class MainMenu extends javax.swing.JFrame {
}//GEN-LAST:event_radioBDelete1ActionPerformed
private void allBooksShowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allBooksShowActionPerformed
ListResult l = new ListResult();
l.setVisible(true);
ListResult n = new ListResult();
n.setVisible(true);
Database d = new Database();
List<Book> books = new LinkedList<>();
books = d.selectBooks();
System.out.println("Lista książek:");
for(Book k: books)
System.out.println(k);
}//GEN-LAST:event_allBooksShowActionPerformed
/**