@@ -0,0 +1,127 @@ | |||||
<?xml version="1.0" encoding="UTF-8" ?> | |||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> | |||||
<Properties> | |||||
<Property name="defaultCloseOperation" type="int" value="2"/> | |||||
</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 max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<Component id="saveBtn" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace pref="68" max="32767" attributes="0"/> | |||||
<Component id="cancelBtn" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<Group type="102" attributes="0"> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Component id="titleLbl" alignment="0" min="-2" max="-2" attributes="0"/> | |||||
<Component id="idLbl" alignment="0" min="-2" max="-2" attributes="0"/> | |||||
<Component id="statusLbl" alignment="0" min="-2" max="-2" attributes="0"/> | |||||
<Component id="dueDateLbl" alignment="0" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> | |||||
</Group> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<Component id="nameLbl" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Component id="nameTxtField" max="32767" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
<EmptySpace max="-2" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
</DimensionLayout> | |||||
<DimensionLayout dim="1"> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<EmptySpace max="-2" attributes="0"/> | |||||
<Component id="titleLbl" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="separate" max="-2" attributes="0"/> | |||||
<Component id="idLbl" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Component id="statusLbl" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Component id="dueDateLbl" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="nameLbl" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="nameTxtField" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace pref="18" max="32767" attributes="0"/> | |||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="saveBtn" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="cancelBtn" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace max="-2" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
</DimensionLayout> | |||||
</Layout> | |||||
<SubComponents> | |||||
<Component class="javax.swing.JLabel" name="titleLbl"> | |||||
<Properties> | |||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | |||||
<Font name="Lucida Grande" size="18" style="0"/> | |||||
</Property> | |||||
<Property name="text" type="java.lang.String" value="Edit Book"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="idLbl"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="ID :"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="nameLbl"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Name :"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JTextField" name="nameTxtField"> | |||||
</Component> | |||||
<Component class="javax.swing.JButton" name="saveBtn"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Save"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="saveBtnActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
<Component class="javax.swing.JButton" name="cancelBtn"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Cancel"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelBtnActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="statusLbl"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Status :"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="dueDateLbl"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Due Date :"/> | |||||
</Properties> | |||||
</Component> | |||||
</SubComponents> | |||||
</Form> |
@@ -0,0 +1,152 @@ | |||||
package libsys; | |||||
public class EditBookDialog extends javax.swing.JDialog { | |||||
public EditBookDialog(java.awt.Frame parent, boolean modal, Book book) { | |||||
super(parent, modal); | |||||
initComponents(); | |||||
this.book = book; | |||||
init(); | |||||
} | |||||
@SuppressWarnings("unchecked") | |||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |||||
private void initComponents() { | |||||
titleLbl = new javax.swing.JLabel(); | |||||
idLbl = new javax.swing.JLabel(); | |||||
nameLbl = new javax.swing.JLabel(); | |||||
nameTxtField = new javax.swing.JTextField(); | |||||
saveBtn = new javax.swing.JButton(); | |||||
cancelBtn = new javax.swing.JButton(); | |||||
statusLbl = new javax.swing.JLabel(); | |||||
dueDateLbl = new javax.swing.JLabel(); | |||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | |||||
titleLbl.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N | |||||
titleLbl.setText("Edit Book"); | |||||
idLbl.setText("ID :"); | |||||
nameLbl.setText("Name :"); | |||||
saveBtn.setText("Save"); | |||||
saveBtn.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
saveBtnActionPerformed(evt); | |||||
} | |||||
}); | |||||
cancelBtn.setText("Cancel"); | |||||
cancelBtn.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
cancelBtnActionPerformed(evt); | |||||
} | |||||
}); | |||||
statusLbl.setText("Status :"); | |||||
dueDateLbl.setText("Due Date :"); | |||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |||||
getContentPane().setLayout(layout); | |||||
layout.setHorizontalGroup( | |||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addContainerGap() | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addComponent(saveBtn) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 68, Short.MAX_VALUE) | |||||
.addComponent(cancelBtn)) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addComponent(titleLbl) | |||||
.addComponent(idLbl) | |||||
.addComponent(statusLbl) | |||||
.addComponent(dueDateLbl)) | |||||
.addGap(0, 0, Short.MAX_VALUE)) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addComponent(nameLbl) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addComponent(nameTxtField))) | |||||
.addContainerGap()) | |||||
); | |||||
layout.setVerticalGroup( | |||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addContainerGap() | |||||
.addComponent(titleLbl) | |||||
.addGap(18, 18, 18) | |||||
.addComponent(idLbl) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addComponent(statusLbl) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addComponent(dueDateLbl) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(nameLbl) | |||||
.addComponent(nameTxtField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(saveBtn) | |||||
.addComponent(cancelBtn)) | |||||
.addContainerGap()) | |||||
); | |||||
pack(); | |||||
}// </editor-fold>//GEN-END:initComponents | |||||
private void cancelBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelBtnActionPerformed | |||||
doClose(false); | |||||
}//GEN-LAST:event_cancelBtnActionPerformed | |||||
private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBtnActionPerformed | |||||
doClose(true); | |||||
}//GEN-LAST:event_saveBtnActionPerformed | |||||
private void init() | |||||
{ | |||||
idLbl.setText("ID : " + (book.getId())); | |||||
dueDateLbl.setText("Due date : " + book.getDueDate()[0] + "/" + book.getDueDate()[1] + "/" + book.getDueDate()[2]); | |||||
statusLbl.setText("Status : " + book.getStatus()); | |||||
nameTxtField.setText(book.getTitle()); | |||||
} | |||||
private void doClose(boolean toReturn) | |||||
{ | |||||
if (toReturn) | |||||
{ | |||||
returnStatus = toReturn; | |||||
newName = nameTxtField.getText(); | |||||
} | |||||
setVisible(false); | |||||
dispose(); | |||||
} | |||||
public String getNewName() | |||||
{ | |||||
return newName; | |||||
} | |||||
public boolean getReturnStatus() | |||||
{ | |||||
return returnStatus; | |||||
} | |||||
// Variables declaration - do not modify//GEN-BEGIN:variables | |||||
private javax.swing.JButton cancelBtn; | |||||
private javax.swing.JLabel dueDateLbl; | |||||
private javax.swing.JLabel idLbl; | |||||
private javax.swing.JLabel nameLbl; | |||||
private javax.swing.JTextField nameTxtField; | |||||
private javax.swing.JButton saveBtn; | |||||
private javax.swing.JLabel statusLbl; | |||||
private javax.swing.JLabel titleLbl; | |||||
// End of variables declaration//GEN-END:variables | |||||
private Book book; | |||||
private String newName; | |||||
private boolean returnStatus = false; | |||||
} |
@@ -0,0 +1,147 @@ | |||||
<?xml version="1.0" encoding="UTF-8" ?> | |||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> | |||||
<Properties> | |||||
<Property name="defaultCloseOperation" type="int" value="2"/> | |||||
</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 max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<Component id="nameLbl" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Component id="nameTxtField" max="32767" attributes="0"/> | |||||
</Group> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<Component id="limitLbl" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Component id="limitTxtField" max="32767" attributes="0"/> | |||||
</Group> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<Component id="saveBtn" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace pref="68" max="32767" attributes="0"/> | |||||
<Component id="cancelBtn" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<Group type="102" attributes="0"> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Component id="booksLbl" alignment="0" min="-2" max="-2" attributes="0"/> | |||||
<Component id="titleLbl" alignment="0" min="-2" max="-2" attributes="0"/> | |||||
<Component id="idLbl" alignment="0" min="-2" max="-2" attributes="0"/> | |||||
<Component id="errorLbl" alignment="0" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
<EmptySpace max="-2" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
</DimensionLayout> | |||||
<DimensionLayout dim="1"> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<EmptySpace max="-2" attributes="0"/> | |||||
<Component id="titleLbl" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="separate" max="-2" attributes="0"/> | |||||
<Component id="idLbl" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Component id="booksLbl" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="nameLbl" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="nameTxtField" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="limitLbl" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="limitTxtField" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace pref="12" max="32767" attributes="0"/> | |||||
<Component id="errorLbl" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="saveBtn" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="cancelBtn" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace max="-2" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
</DimensionLayout> | |||||
</Layout> | |||||
<SubComponents> | |||||
<Component class="javax.swing.JLabel" name="titleLbl"> | |||||
<Properties> | |||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | |||||
<Font name="Lucida Grande" size="18" style="0"/> | |||||
</Property> | |||||
<Property name="text" type="java.lang.String" value="Edit User"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="idLbl"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="ID :"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="booksLbl"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Books :"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="nameLbl"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Name :"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JTextField" name="nameTxtField"> | |||||
</Component> | |||||
<Component class="javax.swing.JTextField" name="limitTxtField"> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="limitLbl"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Limit :"/> | |||||
</Properties> | |||||
</Component> | |||||
<Component class="javax.swing.JButton" name="saveBtn"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Save"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="saveBtnActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
<Component class="javax.swing.JButton" name="cancelBtn"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Cancel"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelBtnActionPerformed"/> | |||||
</Events> | |||||
</Component> | |||||
<Component class="javax.swing.JLabel" name="errorLbl"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Limit must be a number!"/> | |||||
</Properties> | |||||
<AuxValues> | |||||
<AuxValue name="JavaCodeGenerator_InitCodePre" type="java.lang.String" value="errorLbl.setVisible(false);"/> | |||||
</AuxValues> | |||||
</Component> | |||||
</SubComponents> | |||||
</Form> |
@@ -0,0 +1,198 @@ | |||||
package libsys; | |||||
public class EditUserDialog extends javax.swing.JDialog { | |||||
/** | |||||
* Creates new form EditUserDialog | |||||
*/ | |||||
public EditUserDialog(java.awt.Frame parent, boolean modal, User user, BookFactory books) { | |||||
super(parent, modal); | |||||
this.user = user; | |||||
this.books = books; | |||||
initComponents(); | |||||
init(); | |||||
} | |||||
/** | |||||
* 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() { | |||||
titleLbl = new javax.swing.JLabel(); | |||||
idLbl = new javax.swing.JLabel(); | |||||
booksLbl = new javax.swing.JLabel(); | |||||
nameLbl = new javax.swing.JLabel(); | |||||
nameTxtField = new javax.swing.JTextField(); | |||||
limitTxtField = new javax.swing.JTextField(); | |||||
limitLbl = new javax.swing.JLabel(); | |||||
saveBtn = new javax.swing.JButton(); | |||||
cancelBtn = new javax.swing.JButton(); | |||||
errorLbl = new javax.swing.JLabel(); | |||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | |||||
titleLbl.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N | |||||
titleLbl.setText("Edit User"); | |||||
idLbl.setText("ID :"); | |||||
booksLbl.setText("Books :"); | |||||
nameLbl.setText("Name :"); | |||||
limitLbl.setText("Limit :"); | |||||
saveBtn.setText("Save"); | |||||
saveBtn.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
saveBtnActionPerformed(evt); | |||||
} | |||||
}); | |||||
cancelBtn.setText("Cancel"); | |||||
cancelBtn.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
cancelBtnActionPerformed(evt); | |||||
} | |||||
}); | |||||
errorLbl.setVisible(false); | |||||
errorLbl.setText("Limit must be a number!"); | |||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |||||
getContentPane().setLayout(layout); | |||||
layout.setHorizontalGroup( | |||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addContainerGap() | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addComponent(nameLbl) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addComponent(nameTxtField)) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addComponent(limitLbl) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addComponent(limitTxtField)) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addComponent(saveBtn) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 68, Short.MAX_VALUE) | |||||
.addComponent(cancelBtn)) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addComponent(booksLbl) | |||||
.addComponent(titleLbl) | |||||
.addComponent(idLbl) | |||||
.addComponent(errorLbl)) | |||||
.addGap(0, 0, Short.MAX_VALUE))) | |||||
.addContainerGap()) | |||||
); | |||||
layout.setVerticalGroup( | |||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(layout.createSequentialGroup() | |||||
.addContainerGap() | |||||
.addComponent(titleLbl) | |||||
.addGap(18, 18, 18) | |||||
.addComponent(idLbl) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addComponent(booksLbl) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(nameLbl) | |||||
.addComponent(nameTxtField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(limitLbl) | |||||
.addComponent(limitTxtField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE) | |||||
.addComponent(errorLbl) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(saveBtn) | |||||
.addComponent(cancelBtn)) | |||||
.addContainerGap()) | |||||
); | |||||
pack(); | |||||
}// </editor-fold>//GEN-END:initComponents | |||||
private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBtnActionPerformed | |||||
doClose(true); | |||||
}//GEN-LAST:event_saveBtnActionPerformed | |||||
private void cancelBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelBtnActionPerformed | |||||
doClose(false); | |||||
}//GEN-LAST:event_cancelBtnActionPerformed | |||||
private void init() | |||||
{ | |||||
idLbl.setText("ID : " + (user.getId())); | |||||
String bookString = "Books : "; | |||||
int [] bookIds = user.bookStatus(); | |||||
for (int i = 0; i < bookIds.length; i++) | |||||
{ | |||||
bookString += (books.getBook(bookIds[i]) + " "); | |||||
} | |||||
booksLbl.setText(bookString); | |||||
limitTxtField.setText(String.valueOf(user.getLimit())); | |||||
nameTxtField.setText(user.getName()); | |||||
} | |||||
private void doClose(boolean toReturn) | |||||
{ | |||||
if (toReturn) | |||||
{ | |||||
try | |||||
{ | |||||
newLimit = Integer.parseInt(limitTxtField.getText()); | |||||
} | |||||
catch (Exception e) | |||||
{ | |||||
errorLbl.setVisible(true); | |||||
return; | |||||
} | |||||
returnStatus = toReturn; | |||||
newName = nameTxtField.getText(); | |||||
} | |||||
setVisible(false); | |||||
dispose(); | |||||
} | |||||
public boolean getReturnStatus() | |||||
{ | |||||
return returnStatus; | |||||
} | |||||
public String getNewName() | |||||
{ | |||||
return newName; | |||||
} | |||||
public int getNewLimit() | |||||
{ | |||||
return newLimit; | |||||
} | |||||
// Variables declaration - do not modify//GEN-BEGIN:variables | |||||
private javax.swing.JLabel booksLbl; | |||||
private javax.swing.JButton cancelBtn; | |||||
private javax.swing.JLabel errorLbl; | |||||
private javax.swing.JLabel idLbl; | |||||
private javax.swing.JLabel limitLbl; | |||||
private javax.swing.JTextField limitTxtField; | |||||
private javax.swing.JLabel nameLbl; | |||||
private javax.swing.JTextField nameTxtField; | |||||
private javax.swing.JButton saveBtn; | |||||
private javax.swing.JLabel titleLbl; | |||||
// End of variables declaration//GEN-END:variables | |||||
private User user; | |||||
private BookFactory books; | |||||
private boolean returnStatus; | |||||
private String newName; | |||||
private int newLimit; | |||||
} |
@@ -1,7 +1,7 @@ | |||||
package libsys; | package libsys; | ||||
/* | /* | ||||
* Written by : Bin Hong Lee | * Written by : Bin Hong Lee | ||||
* Last edited : 5/30/2017 | |||||
* Last edited : 6/2/2017 | |||||
*/ | */ | ||||
class Main | class Main | ||||
@@ -33,9 +33,8 @@ | |||||
<DimensionLayout dim="1"> | <DimensionLayout dim="1"> | ||||
<Group type="103" groupAlignment="0" attributes="0"> | <Group type="103" groupAlignment="0" attributes="0"> | ||||
<Group type="102" alignment="0" attributes="0"> | <Group type="102" alignment="0" attributes="0"> | ||||
<EmptySpace max="-2" attributes="0"/> | |||||
<Component id="mainPanel" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace max="32767" attributes="0"/> | <EmptySpace max="32767" attributes="0"/> | ||||
<Component id="mainPanel" min="-2" max="-2" attributes="0"/> | |||||
</Group> | </Group> | ||||
</Group> | </Group> | ||||
</DimensionLayout> | </DimensionLayout> | ||||
@@ -52,15 +51,12 @@ | |||||
<Group type="102" attributes="0"> | <Group type="102" attributes="0"> | ||||
<EmptySpace max="-2" attributes="0"/> | <EmptySpace max="-2" attributes="0"/> | ||||
<Group type="103" groupAlignment="0" attributes="0"> | <Group type="103" groupAlignment="0" attributes="0"> | ||||
<Group type="102" attributes="0"> | |||||
<Component id="jTabbedPane" max="32767" attributes="0"/> | |||||
<EmptySpace max="-2" attributes="0"/> | |||||
</Group> | |||||
<Component id="jTabbedPane" pref="0" max="32767" attributes="0"/> | |||||
<Group type="102" attributes="0"> | <Group type="102" attributes="0"> | ||||
<Component id="nameLabel" min="-2" max="-2" attributes="0"/> | <Component id="nameLabel" min="-2" max="-2" attributes="0"/> | ||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> | <EmptySpace min="0" pref="0" max="32767" attributes="0"/> | ||||
</Group> | </Group> | ||||
<Group type="102" attributes="0"> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<Component id="createBookBtn" min="-2" pref="130" max="-2" attributes="0"/> | <Component id="createBookBtn" min="-2" pref="130" max="-2" attributes="0"/> | ||||
<EmptySpace max="-2" attributes="0"/> | <EmptySpace max="-2" attributes="0"/> | ||||
<Component id="createUserBtn" min="-2" pref="130" max="-2" attributes="0"/> | <Component id="createUserBtn" min="-2" pref="130" max="-2" attributes="0"/> | ||||
@@ -68,30 +64,23 @@ | |||||
<Component id="settingsBtn" min="-2" max="-2" attributes="0"/> | <Component id="settingsBtn" min="-2" max="-2" attributes="0"/> | ||||
</Group> | </Group> | ||||
</Group> | </Group> | ||||
<EmptySpace max="-2" attributes="0"/> | |||||
</Group> | </Group> | ||||
</Group> | </Group> | ||||
</DimensionLayout> | </DimensionLayout> | ||||
<DimensionLayout dim="1"> | <DimensionLayout dim="1"> | ||||
<Group type="103" groupAlignment="0" attributes="0"> | <Group type="103" groupAlignment="0" attributes="0"> | ||||
<Group type="102" alignment="1" attributes="0"> | <Group type="102" alignment="1" attributes="0"> | ||||
<EmptySpace max="-2" attributes="0"/> | |||||
<Component id="nameLabel" min="-2" pref="59" max="-2" attributes="0"/> | <Component id="nameLabel" min="-2" pref="59" max="-2" attributes="0"/> | ||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | <EmptySpace type="unrelated" max="-2" attributes="0"/> | ||||
<Component id="jTabbedPane" min="-2" max="-2" attributes="0"/> | <Component id="jTabbedPane" min="-2" max="-2" attributes="0"/> | ||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Group type="102" attributes="0"> | |||||
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="createBookBtn" alignment="3" max="32767" attributes="0"/> | |||||
<Component id="createUserBtn" alignment="3" max="32767" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
<Group type="102" alignment="1" attributes="0"> | |||||
<EmptySpace max="32767" attributes="0"/> | |||||
<Component id="settingsBtn" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
</Group> | |||||
<EmptySpace max="-2" attributes="0"/> | <EmptySpace max="-2" attributes="0"/> | ||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="createBookBtn" alignment="3" max="32767" attributes="0"/> | |||||
<Component id="createUserBtn" alignment="3" max="32767" attributes="0"/> | |||||
<Component id="settingsBtn" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace min="-2" max="-2" attributes="0"/> | |||||
</Group> | </Group> | ||||
</Group> | </Group> | ||||
</DimensionLayout> | </DimensionLayout> | ||||
@@ -127,9 +116,13 @@ | |||||
<Component id="bookStatus" alignment="0" min="-2" max="-2" attributes="0"/> | <Component id="bookStatus" alignment="0" min="-2" max="-2" attributes="0"/> | ||||
<Component id="bookMgtLabel" alignment="0" min="-2" max="-2" attributes="0"/> | <Component id="bookMgtLabel" alignment="0" min="-2" max="-2" attributes="0"/> | ||||
<Component id="bookID" alignment="0" min="-2" max="-2" attributes="0"/> | <Component id="bookID" alignment="0" min="-2" max="-2" attributes="0"/> | ||||
<Component id="bookDueDate" alignment="0" min="-2" max="-2" attributes="0"/> | |||||
</Group> | </Group> | ||||
<EmptySpace min="0" pref="229" max="32767" attributes="0"/> | |||||
<EmptySpace min="0" pref="214" max="32767" attributes="0"/> | |||||
</Group> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<Component id="bookDueDate" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace max="32767" attributes="0"/> | |||||
<Component id="editBookBtn" min="-2" max="-2" attributes="0"/> | |||||
</Group> | </Group> | ||||
</Group> | </Group> | ||||
<EmptySpace max="-2" attributes="0"/> | <EmptySpace max="-2" attributes="0"/> | ||||
@@ -153,7 +146,10 @@ | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | <EmptySpace type="unrelated" max="-2" attributes="0"/> | ||||
<Component id="bookStatus" min="-2" max="-2" attributes="0"/> | <Component id="bookStatus" min="-2" max="-2" attributes="0"/> | ||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | <EmptySpace type="unrelated" max="-2" attributes="0"/> | ||||
<Component id="bookDueDate" min="-2" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="3" attributes="0"> | |||||
<Component id="bookDueDate" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
<Component id="editBookBtn" alignment="3" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace pref="88" max="32767" attributes="0"/> | <EmptySpace pref="88" max="32767" attributes="0"/> | ||||
</Group> | </Group> | ||||
</Group> | </Group> | ||||
@@ -198,6 +194,17 @@ | |||||
<Property name="text" type="java.lang.String" value="Due Date :"/> | <Property name="text" type="java.lang.String" value="Due Date :"/> | ||||
</Properties> | </Properties> | ||||
</Component> | </Component> | ||||
<Component class="javax.swing.JButton" name="editBookBtn"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Edit"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="editBookBtnActionPerformed"/> | |||||
</Events> | |||||
<AuxValues> | |||||
<AuxValue name="JavaCodeGenerator_InitCodePre" type="java.lang.String" value="editBookBtn.setVisible(false);"/> | |||||
</AuxValues> | |||||
</Component> | |||||
</SubComponents> | </SubComponents> | ||||
</Container> | </Container> | ||||
<Container class="javax.swing.JPanel" name="userPanel"> | <Container class="javax.swing.JPanel" name="userPanel"> | ||||
@@ -221,17 +228,23 @@ | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | <EmptySpace type="unrelated" max="-2" attributes="0"/> | ||||
<Component id="userSearchBtn" min="-2" max="-2" attributes="0"/> | <Component id="userSearchBtn" min="-2" max="-2" attributes="0"/> | ||||
</Group> | </Group> | ||||
<Component id="returnBtn" alignment="0" max="32767" attributes="0"/> | |||||
<Group type="102" attributes="0"> | <Group type="102" attributes="0"> | ||||
<Group type="103" groupAlignment="0" attributes="0"> | <Group type="103" groupAlignment="0" attributes="0"> | ||||
<Component id="userID" alignment="0" min="-2" max="-2" attributes="0"/> | |||||
<Component id="userMgtLabel" alignment="0" min="-2" max="-2" attributes="0"/> | <Component id="userMgtLabel" alignment="0" min="-2" max="-2" attributes="0"/> | ||||
<Component id="userName" alignment="0" min="-2" max="-2" attributes="0"/> | <Component id="userName" alignment="0" min="-2" max="-2" attributes="0"/> | ||||
<Component id="userBooks" alignment="0" min="-2" max="-2" attributes="0"/> | <Component id="userBooks" alignment="0" min="-2" max="-2" attributes="0"/> | ||||
</Group> | |||||
<EmptySpace min="0" pref="219" max="32767" attributes="0"/> | |||||
</Group> | |||||
<Group type="102" alignment="0" attributes="0"> | |||||
<Group type="103" groupAlignment="0" attributes="0"> | |||||
<Component id="userID" alignment="0" min="-2" max="-2" attributes="0"/> | |||||
<Component id="userLimit" alignment="0" min="-2" max="-2" attributes="0"/> | <Component id="userLimit" alignment="0" min="-2" max="-2" attributes="0"/> | ||||
</Group> | </Group> | ||||
<EmptySpace min="0" pref="234" max="32767" attributes="0"/> | |||||
<EmptySpace max="32767" attributes="0"/> | |||||
<Component id="editUserBtn" min="-2" max="-2" attributes="0"/> | |||||
</Group> | </Group> | ||||
<Component id="returnBtn" alignment="0" max="32767" attributes="0"/> | |||||
</Group> | </Group> | ||||
<EmptySpace max="-2" attributes="0"/> | <EmptySpace max="-2" attributes="0"/> | ||||
</Group> | </Group> | ||||
@@ -250,14 +263,19 @@ | |||||
<EmptySpace max="-2" attributes="0"/> | <EmptySpace max="-2" attributes="0"/> | ||||
<Component id="userName" min="-2" max="-2" attributes="0"/> | <Component id="userName" min="-2" max="-2" attributes="0"/> | ||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | <EmptySpace type="unrelated" max="-2" attributes="0"/> | ||||
<Component id="userID" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Component id="userLimit" min="-2" max="-2" attributes="0"/> | |||||
<Group type="103" groupAlignment="1" attributes="0"> | |||||
<Group type="102" attributes="0"> | |||||
<Component id="userID" min="-2" max="-2" attributes="0"/> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<Component id="userLimit" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<Component id="editUserBtn" min="-2" max="-2" attributes="0"/> | |||||
</Group> | |||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | <EmptySpace type="unrelated" max="-2" attributes="0"/> | ||||
<Component id="userBooks" min="-2" max="-2" attributes="0"/> | <Component id="userBooks" min="-2" max="-2" attributes="0"/> | ||||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | |||||
<EmptySpace pref="28" max="32767" attributes="0"/> | |||||
<Component id="rentBtn" min="-2" max="-2" attributes="0"/> | <Component id="rentBtn" min="-2" max="-2" attributes="0"/> | ||||
<EmptySpace max="32767" attributes="0"/> | |||||
<EmptySpace max="-2" attributes="0"/> | |||||
<Component id="returnBtn" min="-2" max="-2" attributes="0"/> | <Component id="returnBtn" min="-2" max="-2" attributes="0"/> | ||||
<EmptySpace max="-2" attributes="0"/> | <EmptySpace max="-2" attributes="0"/> | ||||
</Group> | </Group> | ||||
@@ -325,6 +343,17 @@ | |||||
<AuxValue name="JavaCodeGenerator_ListenersCodePost" type="java.lang.String" value="returnBtn.setVisible(false);"/> | <AuxValue name="JavaCodeGenerator_ListenersCodePost" type="java.lang.String" value="returnBtn.setVisible(false);"/> | ||||
</AuxValues> | </AuxValues> | ||||
</Component> | </Component> | ||||
<Component class="javax.swing.JButton" name="editUserBtn"> | |||||
<Properties> | |||||
<Property name="text" type="java.lang.String" value="Edit"/> | |||||
</Properties> | |||||
<Events> | |||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="editUserBtnActionPerformed"/> | |||||
</Events> | |||||
<AuxValues> | |||||
<AuxValue name="JavaCodeGenerator_InitCodePre" type="java.lang.String" value="editUserBtn.setVisible(false);"/> | |||||
</AuxValues> | |||||
</Component> | |||||
</SubComponents> | </SubComponents> | ||||
</Container> | </Container> | ||||
</SubComponents> | </SubComponents> | ||||
@@ -10,6 +10,10 @@ public class MainGUI extends javax.swing.JFrame | |||||
{ | { | ||||
Handler handler; | Handler handler; | ||||
Settings settings; | Settings settings; | ||||
Book book; | |||||
User user; | |||||
boolean bookExist = false; | |||||
boolean userExist = false; | |||||
public MainGUI(Handler handler, Settings settings) | public MainGUI(Handler handler, Settings settings) | ||||
{ | { | ||||
@@ -32,6 +36,7 @@ public class MainGUI extends javax.swing.JFrame | |||||
bookStatus = new javax.swing.JLabel(); | bookStatus = new javax.swing.JLabel(); | ||||
bookID = new javax.swing.JLabel(); | bookID = new javax.swing.JLabel(); | ||||
bookDueDate = new javax.swing.JLabel(); | bookDueDate = new javax.swing.JLabel(); | ||||
editBookBtn = new javax.swing.JButton(); | |||||
userPanel = new javax.swing.JPanel(); | userPanel = new javax.swing.JPanel(); | ||||
userMgtLabel = new javax.swing.JLabel(); | userMgtLabel = new javax.swing.JLabel(); | ||||
userSearch = new javax.swing.JTextField(); | userSearch = new javax.swing.JTextField(); | ||||
@@ -42,6 +47,7 @@ public class MainGUI extends javax.swing.JFrame | |||||
userBooks = new javax.swing.JLabel(); | userBooks = new javax.swing.JLabel(); | ||||
rentBtn = new javax.swing.JButton(); | rentBtn = new javax.swing.JButton(); | ||||
returnBtn = new javax.swing.JButton(); | returnBtn = new javax.swing.JButton(); | ||||
editUserBtn = new javax.swing.JButton(); | |||||
nameLabel = new javax.swing.JLabel(); | nameLabel = new javax.swing.JLabel(); | ||||
createBookBtn = new javax.swing.JButton(); | createBookBtn = new javax.swing.JButton(); | ||||
createUserBtn = new javax.swing.JButton(); | createUserBtn = new javax.swing.JButton(); | ||||
@@ -70,6 +76,14 @@ public class MainGUI extends javax.swing.JFrame | |||||
bookDueDate.setText("Due Date :"); | bookDueDate.setText("Due Date :"); | ||||
editBookBtn.setVisible(false); | |||||
editBookBtn.setText("Edit"); | |||||
editBookBtn.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
editBookBtnActionPerformed(evt); | |||||
} | |||||
}); | |||||
javax.swing.GroupLayout bookPanelLayout = new javax.swing.GroupLayout(bookPanel); | javax.swing.GroupLayout bookPanelLayout = new javax.swing.GroupLayout(bookPanel); | ||||
bookPanel.setLayout(bookPanelLayout); | bookPanel.setLayout(bookPanelLayout); | ||||
bookPanelLayout.setHorizontalGroup( | bookPanelLayout.setHorizontalGroup( | ||||
@@ -86,9 +100,12 @@ public class MainGUI extends javax.swing.JFrame | |||||
.addComponent(bookTitle) | .addComponent(bookTitle) | ||||
.addComponent(bookStatus) | .addComponent(bookStatus) | ||||
.addComponent(bookMgtLabel) | .addComponent(bookMgtLabel) | ||||
.addComponent(bookID) | |||||
.addComponent(bookDueDate)) | |||||
.addGap(0, 229, Short.MAX_VALUE))) | |||||
.addComponent(bookID)) | |||||
.addGap(0, 214, Short.MAX_VALUE)) | |||||
.addGroup(bookPanelLayout.createSequentialGroup() | |||||
.addComponent(bookDueDate) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |||||
.addComponent(editBookBtn))) | |||||
.addContainerGap()) | .addContainerGap()) | ||||
); | ); | ||||
bookPanelLayout.setVerticalGroup( | bookPanelLayout.setVerticalGroup( | ||||
@@ -107,7 +124,9 @@ public class MainGUI extends javax.swing.JFrame | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | ||||
.addComponent(bookStatus) | .addComponent(bookStatus) | ||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | ||||
.addComponent(bookDueDate) | |||||
.addGroup(bookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(bookDueDate) | |||||
.addComponent(editBookBtn)) | |||||
.addContainerGap(88, Short.MAX_VALUE)) | .addContainerGap(88, Short.MAX_VALUE)) | ||||
); | ); | ||||
@@ -148,6 +167,14 @@ public class MainGUI extends javax.swing.JFrame | |||||
}); | }); | ||||
returnBtn.setVisible(false); | returnBtn.setVisible(false); | ||||
editUserBtn.setVisible(false); | |||||
editUserBtn.setText("Edit"); | |||||
editUserBtn.addActionListener(new java.awt.event.ActionListener() { | |||||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||||
editUserBtnActionPerformed(evt); | |||||
} | |||||
}); | |||||
javax.swing.GroupLayout userPanelLayout = new javax.swing.GroupLayout(userPanel); | javax.swing.GroupLayout userPanelLayout = new javax.swing.GroupLayout(userPanel); | ||||
userPanel.setLayout(userPanelLayout); | userPanel.setLayout(userPanelLayout); | ||||
userPanelLayout.setHorizontalGroup( | userPanelLayout.setHorizontalGroup( | ||||
@@ -160,15 +187,19 @@ public class MainGUI extends javax.swing.JFrame | |||||
.addComponent(userSearch) | .addComponent(userSearch) | ||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | ||||
.addComponent(userSearchBtn)) | .addComponent(userSearchBtn)) | ||||
.addComponent(returnBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |||||
.addGroup(userPanelLayout.createSequentialGroup() | .addGroup(userPanelLayout.createSequentialGroup() | ||||
.addGroup(userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | .addGroup(userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||||
.addComponent(userID) | |||||
.addComponent(userMgtLabel) | .addComponent(userMgtLabel) | ||||
.addComponent(userName) | .addComponent(userName) | ||||
.addComponent(userBooks) | |||||
.addComponent(userBooks)) | |||||
.addGap(0, 219, Short.MAX_VALUE)) | |||||
.addGroup(userPanelLayout.createSequentialGroup() | |||||
.addGroup(userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addComponent(userID) | |||||
.addComponent(userLimit)) | .addComponent(userLimit)) | ||||
.addGap(0, 234, Short.MAX_VALUE)) | |||||
.addComponent(returnBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |||||
.addComponent(editUserBtn))) | |||||
.addContainerGap()) | .addContainerGap()) | ||||
); | ); | ||||
userPanelLayout.setVerticalGroup( | userPanelLayout.setVerticalGroup( | ||||
@@ -183,14 +214,17 @@ public class MainGUI extends javax.swing.JFrame | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||||
.addComponent(userName) | .addComponent(userName) | ||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | ||||
.addComponent(userID) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addComponent(userLimit) | |||||
.addGroup(userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |||||
.addGroup(userPanelLayout.createSequentialGroup() | |||||
.addComponent(userID) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addComponent(userLimit)) | |||||
.addComponent(editUserBtn)) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | ||||
.addComponent(userBooks) | .addComponent(userBooks) | ||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE) | |||||
.addComponent(rentBtn) | .addComponent(rentBtn) | ||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |||||
.addComponent(returnBtn) | .addComponent(returnBtn) | ||||
.addContainerGap()) | .addContainerGap()) | ||||
); | ); | ||||
@@ -228,9 +262,7 @@ public class MainGUI extends javax.swing.JFrame | |||||
.addGroup(mainPanelLayout.createSequentialGroup() | .addGroup(mainPanelLayout.createSequentialGroup() | ||||
.addContainerGap() | .addContainerGap() | ||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||||
.addGroup(mainPanelLayout.createSequentialGroup() | |||||
.addComponent(jTabbedPane) | |||||
.addContainerGap()) | |||||
.addComponent(jTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) | |||||
.addGroup(mainPanelLayout.createSequentialGroup() | .addGroup(mainPanelLayout.createSequentialGroup() | ||||
.addComponent(nameLabel) | .addComponent(nameLabel) | ||||
.addGap(0, 0, Short.MAX_VALUE)) | .addGap(0, 0, Short.MAX_VALUE)) | ||||
@@ -239,24 +271,20 @@ public class MainGUI extends javax.swing.JFrame | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||||
.addComponent(createUserBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) | .addComponent(createUserBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) | ||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | ||||
.addComponent(settingsBtn)))) | |||||
.addComponent(settingsBtn))) | |||||
.addContainerGap()) | |||||
); | ); | ||||
mainPanelLayout.setVerticalGroup( | mainPanelLayout.setVerticalGroup( | ||||
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() | ||||
.addContainerGap() | |||||
.addComponent(nameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) | .addComponent(nameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) | ||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | ||||
.addComponent(jTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | .addComponent(jTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | ||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |||||
.addGroup(mainPanelLayout.createSequentialGroup() | |||||
.addGap(10, 10, 10) | |||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(createBookBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |||||
.addComponent(createUserBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) | |||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |||||
.addComponent(settingsBtn))) | |||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |||||
.addComponent(createBookBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |||||
.addComponent(createUserBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |||||
.addComponent(settingsBtn)) | |||||
.addContainerGap()) | .addContainerGap()) | ||||
); | ); | ||||
@@ -272,33 +300,31 @@ public class MainGUI extends javax.swing.JFrame | |||||
layout.setVerticalGroup( | layout.setVerticalGroup( | ||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||||
.addGroup(layout.createSequentialGroup() | .addGroup(layout.createSequentialGroup() | ||||
.addContainerGap() | |||||
.addComponent(mainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |||||
.addComponent(mainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |||||
); | ); | ||||
pack(); | pack(); | ||||
}// </editor-fold>//GEN-END:initComponents | }// </editor-fold>//GEN-END:initComponents | ||||
private void returnBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_returnBtnActionPerformed | |||||
private void settingsBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_settingsBtnActionPerformed | |||||
SettingsDialog settingsUI = new SettingsDialog(this, true, settings); | |||||
User thisUser = handler.users.getUser(Integer.parseInt(userSearch.getText())); | |||||
ReturnDialog toReturnUI = new ReturnDialog(this, true, handler, thisUser.getId()); | |||||
toReturnUI.setVisible(true); | |||||
int toReturnID = toReturnUI.getReturnStatus(); | |||||
settingsUI.setVisible(true); | |||||
if (toReturnID != -1) | |||||
if (settingsUI.getReturnStatus() != -1) | |||||
{ | { | ||||
handler.returnBook(thisUser, handler.books.getBook(toReturnID)); | |||||
userSearchBtnActionPerformed(evt); | |||||
bookSearchBtnActionPerformed(evt); | |||||
settings.update(settings.getKey(0), settingsUI.getTitle()); | |||||
settings.update(settings.getKey(1), settingsUI.getUsersFilename()); | |||||
settings.update(settings.getKey(2), settingsUI.getBooksFilename()); | |||||
nameLabel.setText(settingsUI.getTitle()); | |||||
} | } | ||||
}//GEN-LAST:event_returnBtnActionPerformed | |||||
}//GEN-LAST:event_settingsBtnActionPerformed | |||||
private void createUserBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createUserBtnActionPerformed | private void createUserBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createUserBtnActionPerformed | ||||
NewUserDialog newUserUI = new NewUserDialog(this, true); | NewUserDialog newUserUI = new NewUserDialog(this, true); | ||||
newUserUI.setVisible(true); | newUserUI.setVisible(true); | ||||
if (newUserUI.getReturnStatus() != -1) | if (newUserUI.getReturnStatus() != -1) | ||||
{ | { | ||||
userSearch.setText(String.valueOf(handler.users.newUser(newUserUI.getName(), newUserUI.getLimit()).getId())); | userSearch.setText(String.valueOf(handler.users.newUser(newUserUI.getName(), newUserUI.getLimit()).getId())); | ||||
@@ -309,7 +335,7 @@ public class MainGUI extends javax.swing.JFrame | |||||
private void createBookBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createBookBtnActionPerformed | private void createBookBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createBookBtnActionPerformed | ||||
NewBookDialog newBookUI = new NewBookDialog(this, true); | NewBookDialog newBookUI = new NewBookDialog(this, true); | ||||
newBookUI.setVisible(true); | newBookUI.setVisible(true); | ||||
if (newBookUI.getReturnStatus() != -1) | if (newBookUI.getReturnStatus() != -1) | ||||
{ | { | ||||
bookSearch.setText(String.valueOf(handler.books.newBook(newBookUI.getName(), newBookUI.getStatus()).getId())); | bookSearch.setText(String.valueOf(handler.books.newBook(newBookUI.getName(), newBookUI.getStatus()).getId())); | ||||
@@ -317,22 +343,35 @@ public class MainGUI extends javax.swing.JFrame | |||||
} | } | ||||
}//GEN-LAST:event_createBookBtnActionPerformed | }//GEN-LAST:event_createBookBtnActionPerformed | ||||
private void settingsBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_settingsBtnActionPerformed | |||||
SettingsDialog settingsUI = new SettingsDialog(this, true, settings); | |||||
private void editUserBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editUserBtnActionPerformed | |||||
EditUserDialog editUserDialog = new EditUserDialog(this, true, user, handler.books); | |||||
editUserDialog.setVisible(true); | |||||
settingsUI.setVisible(true); | |||||
if (editUserDialog.getReturnStatus()) | |||||
{ | |||||
User newUser = user; | |||||
user.setName(editUserDialog.getNewName()); | |||||
user.setLimit(editUserDialog.getNewLimit()); | |||||
} | |||||
if (settingsUI.getReturnStatus() != -1) | |||||
userSearchBtnActionPerformed(evt); | |||||
}//GEN-LAST:event_editUserBtnActionPerformed | |||||
private void returnBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_returnBtnActionPerformed | |||||
User thisUser = handler.users.getUser(Integer.parseInt(userSearch.getText())); | |||||
ReturnDialog toReturnUI = new ReturnDialog(this, true, handler, thisUser.getId()); | |||||
toReturnUI.setVisible(true); | |||||
int toReturnID = toReturnUI.getReturnStatus(); | |||||
if (toReturnID != -1) | |||||
{ | { | ||||
settings.update(settings.getKey(0), settingsUI.getTitle()); | |||||
settings.update(settings.getKey(1), settingsUI.getUsersFilename()); | |||||
settings.update(settings.getKey(2), settingsUI.getBooksFilename()); | |||||
nameLabel.setText(settingsUI.getTitle()); | |||||
handler.returnBook(thisUser, handler.books.getBook(toReturnID)); | |||||
userSearchBtnActionPerformed(evt); | |||||
bookSearchBtnActionPerformed(evt); | |||||
} | } | ||||
}//GEN-LAST:event_settingsBtnActionPerformed | |||||
}//GEN-LAST:event_returnBtnActionPerformed | |||||
private void rentBtnActionPerformed(java.awt.event.ActionEvent evt) | |||||
{ | |||||
private void rentBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rentBtnActionPerformed | |||||
User thisUser = handler.users.getUser(Integer.parseInt(userSearch.getText())); | User thisUser = handler.users.getUser(Integer.parseInt(userSearch.getText())); | ||||
RentDialog toRentUI = new RentDialog(this, true, handler); | RentDialog toRentUI = new RentDialog(this, true, handler); | ||||
toRentUI.setVisible(true); | toRentUI.setVisible(true); | ||||
@@ -343,8 +382,20 @@ public class MainGUI extends javax.swing.JFrame | |||||
handler.borrowBook(thisUser, handler.books.getBook(toRentID)); | handler.borrowBook(thisUser, handler.books.getBook(toRentID)); | ||||
userSearchBtnActionPerformed(evt); | userSearchBtnActionPerformed(evt); | ||||
bookSearchBtnActionPerformed(evt); | bookSearchBtnActionPerformed(evt); | ||||
} }//GEN-LAST:event_rentBtnActionPerformed | |||||
private void editBookBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editBookBtnActionPerformed | |||||
EditBookDialog editBookDialog = new EditBookDialog(this, true, book); | |||||
editBookDialog.setVisible(true); | |||||
if (editBookDialog.getReturnStatus()) | |||||
{ | |||||
Book newBook = book; | |||||
book.setTitle(editBookDialog.getNewName()); | |||||
handler.books.update(book, newBook); | |||||
} | } | ||||
} | |||||
bookSearchBtnActionPerformed(evt); | |||||
}//GEN-LAST:event_editBookBtnActionPerformed | |||||
private void bookSearchBtnActionPerformed(ActionEvent evt) | private void bookSearchBtnActionPerformed(ActionEvent evt) | ||||
{ | { | ||||
@@ -362,6 +413,9 @@ public class MainGUI extends javax.swing.JFrame | |||||
{ | { | ||||
bookDueDate.setText("Due date : "); | bookDueDate.setText("Due date : "); | ||||
} | } | ||||
book = thisBook; | |||||
bookExist = true; | |||||
editBookBtn.setVisible(true); | |||||
} | } | ||||
catch (Exception e) | catch (Exception e) | ||||
{ | { | ||||
@@ -369,6 +423,8 @@ public class MainGUI extends javax.swing.JFrame | |||||
bookTitle.setText(""); | bookTitle.setText(""); | ||||
bookStatus.setText(""); | bookStatus.setText(""); | ||||
bookDueDate.setText(""); | bookDueDate.setText(""); | ||||
bookExist = false; | |||||
editBookBtn.setVisible(false); | |||||
} | } | ||||
} | } | ||||
@@ -383,6 +439,9 @@ public class MainGUI extends javax.swing.JFrame | |||||
userBooks.setText("Books : " + handler.bookIdsToTitlesString(thisUser.bookStatus())); | userBooks.setText("Books : " + handler.bookIdsToTitlesString(thisUser.bookStatus())); | ||||
rentBtn.setVisible(thisUser.status()); | rentBtn.setVisible(thisUser.status()); | ||||
returnBtn.setVisible(thisUser.bookStatus().length > 0); | returnBtn.setVisible(thisUser.bookStatus().length > 0); | ||||
editUserBtn.setVisible(true); | |||||
user = thisUser; | |||||
userExist = true; | |||||
} | } | ||||
catch (Exception e) | catch (Exception e) | ||||
{ | { | ||||
@@ -392,6 +451,8 @@ public class MainGUI extends javax.swing.JFrame | |||||
userBooks.setText(""); | userBooks.setText(""); | ||||
rentBtn.setVisible(false); | rentBtn.setVisible(false); | ||||
returnBtn.setVisible(false); | returnBtn.setVisible(false); | ||||
userExist = false; | |||||
editUserBtn.setVisible(false); | |||||
} | } | ||||
} | } | ||||
@@ -406,6 +467,8 @@ public class MainGUI extends javax.swing.JFrame | |||||
private javax.swing.JLabel bookTitle; | private javax.swing.JLabel bookTitle; | ||||
private javax.swing.JButton createBookBtn; | private javax.swing.JButton createBookBtn; | ||||
private javax.swing.JButton createUserBtn; | private javax.swing.JButton createUserBtn; | ||||
private javax.swing.JButton editBookBtn; | |||||
private javax.swing.JButton editUserBtn; | |||||
private javax.swing.JTabbedPane jTabbedPane; | private javax.swing.JTabbedPane jTabbedPane; | ||||
private javax.swing.JPanel mainPanel; | private javax.swing.JPanel mainPanel; | ||||
private javax.swing.JLabel nameLabel; | private javax.swing.JLabel nameLabel; | ||||
@@ -1,7 +1,7 @@ | |||||
package libsys; | package libsys; | ||||
/* | /* | ||||
* Written by : Bin Hong Lee | * Written by : Bin Hong Lee | ||||
* Last edited : 5/28/2017 | |||||
* Last edited : 6/3/2017 | |||||
*/ | */ | ||||
import java.util.*; | import java.util.*; | ||||
@@ -43,11 +43,16 @@ class User | |||||
return limit; | return limit; | ||||
} | } | ||||
public void setName() | |||||
public void setName(String name) | |||||
{ | { | ||||
this.name = name; | this.name = name; | ||||
} | } | ||||
public void setLimit(int limit) | |||||
{ | |||||
this.limit = limit; | |||||
} | |||||
public boolean status() | public boolean status() | ||||
{ | { | ||||
if (books.size() < limit) | if (books.size() < limit) | ||||