Procházet zdrojové kódy

Added Basic GUI without any functionality

master
BinHong Lee před 7 roky
rodič
revize
88631e3cf4
3 změnil soubory, kde provedl 456 přidání a 2 odebrání
  1. +2
    -2
      src/main/java/libsys/Main.java
  2. +259
    -0
      src/main/java/libsys/MainGUI.form
  3. +195
    -0
      src/main/java/libsys/MainGUI.java

+ 2
- 2
src/main/java/libsys/Main.java Zobrazit soubor

@@ -1,7 +1,7 @@
package libsys;
/*
* Written by : Bin Hong Lee
* Last edited : 6/12/2016
* Last edited : 5/27/2017
*/

import java.util.Date;
@@ -15,7 +15,7 @@ class Main

public static void main(String[] args)
{
new MainGUI().setVisible(true);
}

public static boolean borrowBook(User user, Book book)


+ 259
- 0
src/main/java/libsys/MainGUI.form Zobrazit soubor

@@ -0,0 +1,259 @@
<?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="0" pref="7" max="32767" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">

<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jTabbedPane1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="32" max="32767" 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="jTabbedPane1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JTabbedPane" name="jTabbedPane1">

<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="bookPanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Book">
<Property name="tabTitle" type="java.lang.String" value="Book"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>

<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="bookSearch" min="-2" pref="108" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="bookSearchBtn" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="bookTitle" 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="bookID" 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="bookMgtLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="bookSearch" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="bookSearchBtn" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="bookTitle" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="bookID" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="bookStatus" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="74" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="bookMgtLabel">
<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="Book Management"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="bookSearch">
</Component>
<Component class="javax.swing.JButton" name="bookSearchBtn">
<Properties>
<Property name="text" type="java.lang.String" value="Search"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="bookTitle">
<Properties>
<Property name="text" type="java.lang.String" value="Title : "/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="bookStatus">
<Properties>
<Property name="text" type="java.lang.String" value="Status :"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="bookID">
<Properties>
<Property name="text" type="java.lang.String" value="ID :"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="userPanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="User">
<Property name="tabTitle" type="java.lang.String" value="User"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>

<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="userSearch" min="-2" pref="108" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="userSearchBtn" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" 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="userName" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="userBooks" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="userLimit" 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="userMgtLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="userSearch" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="userSearchBtn" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="userName" min="-2" 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"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="userBooks" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="46" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="userMgtLabel">
<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="User Management"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="userSearch">
</Component>
<Component class="javax.swing.JButton" name="userSearchBtn">
<Properties>
<Property name="text" type="java.lang.String" value="Search"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="userName">
<Properties>
<Property name="text" type="java.lang.String" value="Name : "/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="userLimit">
<Properties>
<Property name="text" type="java.lang.String" value="Limit :"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="userID">
<Properties>
<Property name="text" type="java.lang.String" value="ID :"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="userBooks">
<Properties>
<Property name="text" type="java.lang.String" value="Books :"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

+ 195
- 0
src/main/java/libsys/MainGUI.java Zobrazit soubor

@@ -0,0 +1,195 @@
package libsys;

public class MainGUI extends javax.swing.JFrame
{
public MainGUI()
{
initComponents();
}

@SuppressWarnings("unchecked")

//GEN-BEGIN:initComponents
private void initComponents()
{
jPanel1 = new javax.swing.JPanel();
jTabbedPane1 = new javax.swing.JTabbedPane();
bookPanel = new javax.swing.JPanel();
bookMgtLabel = new javax.swing.JLabel();
bookSearch = new javax.swing.JTextField();
bookSearchBtn = new javax.swing.JButton();
bookTitle = new javax.swing.JLabel();
bookStatus = new javax.swing.JLabel();
bookID = new javax.swing.JLabel();
userPanel = new javax.swing.JPanel();
userMgtLabel = new javax.swing.JLabel();
userSearch = new javax.swing.JTextField();
userSearchBtn = new javax.swing.JButton();
userName = new javax.swing.JLabel();
userLimit = new javax.swing.JLabel();
userID = new javax.swing.JLabel();
userBooks = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

bookMgtLabel.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
bookMgtLabel.setText("Book Management");

bookSearchBtn.setText("Search");

bookTitle.setText("Title : ");

bookStatus.setText("Status :");

bookID.setText("ID :");

javax.swing.GroupLayout bookPanelLayout = new javax.swing.GroupLayout(bookPanel);
bookPanel.setLayout(bookPanelLayout);
bookPanelLayout.setHorizontalGroup(
bookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(bookPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(bookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(bookMgtLabel)
.addGroup(bookPanelLayout.createSequentialGroup()
.addComponent(bookSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bookSearchBtn))
.addComponent(bookTitle)
.addComponent(bookStatus)
.addComponent(bookID))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
bookPanelLayout.setVerticalGroup(
bookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(bookPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(bookMgtLabel)
.addGap(18, 18, 18)
.addGroup(bookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(bookSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bookSearchBtn))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(bookID)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(bookTitle)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(bookStatus)
.addContainerGap(38, Short.MAX_VALUE))
);

jTabbedPane1.addTab("Book", bookPanel);

userMgtLabel.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
userMgtLabel.setText("User Management");

userSearchBtn.setText("Search");

userName.setText("Name : ");

userLimit.setText("Limit :");

userID.setText("ID :");

userBooks.setText("Books :");

javax.swing.GroupLayout userPanelLayout = new javax.swing.GroupLayout(userPanel);
userPanel.setLayout(userPanelLayout);
userPanelLayout.setHorizontalGroup(
userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(userPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(userPanelLayout.createSequentialGroup()
.addComponent(userSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(userSearchBtn))
.addGroup(userPanelLayout.createSequentialGroup()
.addGroup(userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(userMgtLabel)
.addComponent(userName)
.addComponent(userID)
.addComponent(userBooks)
.addComponent(userLimit))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
userPanelLayout.setVerticalGroup(
userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(userPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(userMgtLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(userSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(userSearchBtn))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(userName)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(userID)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(userLimit)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(userBooks)
.addContainerGap(28, Short.MAX_VALUE))
);

jTabbedPane1.addTab("User", userPanel);

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(32, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);

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(0, 7, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);

pack();
}
//GEN-END:initComponents

//GEN-BEGIN:variables
private javax.swing.JLabel bookID;
private javax.swing.JLabel bookMgtLabel;
private javax.swing.JPanel bookPanel;
private javax.swing.JTextField bookSearch;
private javax.swing.JButton bookSearchBtn;
private javax.swing.JLabel bookStatus;
private javax.swing.JLabel bookTitle;
private javax.swing.JPanel jPanel1;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JLabel userBooks;
private javax.swing.JLabel userID;
private javax.swing.JLabel userLimit;
private javax.swing.JLabel userMgtLabel;
private javax.swing.JLabel userName;
private javax.swing.JPanel userPanel;
private javax.swing.JTextField userSearch;
private javax.swing.JButton userSearchBtn;
//GEN-END:variables
}

Načítá se…
Zrušit
Uložit