Переглянути джерело

Added more buttons!

master
BinHong Lee 7 роки тому
джерело
коміт
7f6185bcef
2 змінених файлів з 89 додано та 23 видалено
  1. +51
    -13
      src/main/java/libsys/MainGUI.form
  2. +38
    -10
      src/main/java/libsys/MainGUI.java

+ 51
- 13
src/main/java/libsys/MainGUI.form Переглянути файл

@@ -32,10 +32,10 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="mainPanel" max="32767" 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"/>
</Group>
</Group>
</DimensionLayout>
@@ -49,18 +49,38 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jTabbedPane" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jTabbedPane" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="createBookBtn" min="-2" pref="130" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="createUserBtn" min="-2" pref="130" max="-2" attributes="0"/>
</Group>
<Component id="nameLabel" 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">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="nameLabel" min="-2" pref="59" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTabbedPane" max="32767" attributes="0"/>
<Component id="jTabbedPane" min="-2" pref="290" max="-2" 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>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -99,7 +119,7 @@
<Component id="bookID" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="bookDueDate" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="115" max="32767" attributes="0"/>
<EmptySpace min="0" pref="229" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@@ -124,7 +144,7 @@
<Component id="bookStatus" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="bookDueDate" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="88" max="32767" attributes="0"/>
<EmptySpace pref="94" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -199,7 +219,7 @@
<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="120" max="32767" attributes="0"/>
<EmptySpace min="0" pref="234" max="32767" attributes="0"/>
</Group>
<Component id="returnBtn" alignment="0" max="32767" attributes="0"/>
</Group>
@@ -292,13 +312,31 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="returnBtnActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_ListenersCodePost" type="java.lang.String" value="rentBtn.setVisible(false);"/>
<AuxValue name="JavaCodeGenerator_ListenersCodePost" type="java.lang.String" value="returnBtn.setVisible(false);"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="nameLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="36" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Welcome to abc Library"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="createBookBtn">
<Properties>
<Property name="text" type="java.lang.String" value="Add new book"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="createUserBtn">
<Properties>
<Property name="text" type="java.lang.String" value="Add new user"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>


+ 38
- 10
src/main/java/libsys/MainGUI.java Переглянути файл

@@ -38,6 +38,9 @@ public class MainGUI extends javax.swing.JFrame
userBooks = new javax.swing.JLabel();
rentBtn = new javax.swing.JButton();
returnBtn = new javax.swing.JButton();
nameLabel = new javax.swing.JLabel();
createBookBtn = new javax.swing.JButton();
createUserBtn = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

@@ -80,7 +83,7 @@ public class MainGUI extends javax.swing.JFrame
.addComponent(bookMgtLabel)
.addComponent(bookID)
.addComponent(bookDueDate))
.addGap(0, 115, Short.MAX_VALUE)))
.addGap(0, 229, Short.MAX_VALUE)))
.addContainerGap())
);
bookPanelLayout.setVerticalGroup(
@@ -100,7 +103,7 @@ public class MainGUI extends javax.swing.JFrame
.addComponent(bookStatus)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(bookDueDate)
.addContainerGap(88, Short.MAX_VALUE))
.addContainerGap(94, Short.MAX_VALUE))
);

jTabbedPane.addTab("Book", bookPanel);
@@ -138,7 +141,7 @@ public class MainGUI extends javax.swing.JFrame
returnBtnActionPerformed(evt);
}
});
rentBtn.setVisible(false);
returnBtn.setVisible(false);

javax.swing.GroupLayout userPanelLayout = new javax.swing.GroupLayout(userPanel);
userPanel.setLayout(userPanelLayout);
@@ -159,7 +162,7 @@ public class MainGUI extends javax.swing.JFrame
.addComponent(userName)
.addComponent(userBooks)
.addComponent(userLimit))
.addGap(0, 120, Short.MAX_VALUE))
.addGap(0, 234, Short.MAX_VALUE))
.addComponent(returnBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
@@ -189,20 +192,42 @@ public class MainGUI extends javax.swing.JFrame

jTabbedPane.addTab("User", userPanel);

nameLabel.setFont(new java.awt.Font("Lucida Grande", 0, 36)); // NOI18N
nameLabel.setText("Welcome to abc Library");

createBookBtn.setText("Add new book");

createUserBtn.setText("Add new user");

javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane)
.addGroup(mainPanelLayout.createSequentialGroup()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(createBookBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(createUserBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(nameLabel))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane)
.addComponent(nameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
.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))
.addContainerGap())
);

@@ -219,8 +244,8 @@ public class MainGUI extends javax.swing.JFrame
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.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))
);

pack();
@@ -255,7 +280,7 @@ public class MainGUI extends javax.swing.JFrame
bookSearchBtnActionPerformed(evt);
}
}
private void bookSearchBtnActionPerformed(ActionEvent evt)
{
try
@@ -314,8 +339,11 @@ public class MainGUI extends javax.swing.JFrame
private javax.swing.JButton bookSearchBtn;
private javax.swing.JLabel bookStatus;
private javax.swing.JLabel bookTitle;
private javax.swing.JButton createBookBtn;
private javax.swing.JButton createUserBtn;
private javax.swing.JTabbedPane jTabbedPane;
private javax.swing.JPanel mainPanel;
private javax.swing.JLabel nameLabel;
private javax.swing.JButton rentBtn;
private javax.swing.JButton returnBtn;
private javax.swing.JLabel userBooks;


Завантаження…
Відмінити
Зберегти