因为是实训,老师要我们做controller和界面间跳转,就只要一个主程序类,但是我昨天做了一下午都没有弄好,不知道怎么去做。这个是用window builder做的界面。
package view;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import util.StringUtil;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.ImageIcon;
import java.awt.Font;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Login extends JFrame {
private JPanel contentPane;
private JTextField userNameTxt;
private JPasswordField passwordTxt;
/**
* Launch the application.
// */
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login frame = new Login();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Login() {
setTitle("\u7BA1\u7406\u5458\u767B\u5F55");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 568, 438);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JLabel lblNewLabel = new JLabel("\u56FE\u4E66\u7BA1\u7406\u7CFB\u7EDF");
lblNewLabel.setFont(new Font("宋体", Font.BOLD, 23));
lblNewLabel.setIcon(new ImageIcon(Login.class.getResource("/images/resizeApi.png")));
JLabel lblNewLabel_1 = new JLabel("\u7528\u6237\u540D\uFF1A");
lblNewLabel_1.setIcon(new ImageIcon(Login.class.getResource("/images/\u7528\u6237.png")));
JLabel lblNewLabel_2 = new JLabel("\u5BC6 \u7801\uFF1A");
lblNewLabel_2.setIcon(new ImageIcon(Login.class.getResource("/images/\u5BC6\u7801.png")));
userNameTxt = new JTextField();
userNameTxt.setColumns(10);
passwordTxt = new JPasswordField();
JButton btnNewButton = new JButton("\u767B\u5F55");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
loginActionPerformed(e);
}
});
btnNewButton.setIcon(new ImageIcon(Login.class.getResource("/images/\u767B\u5F55.png")));
JButton btnNewButton_1 = new JButton("\u91CD\u7F6E");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
resetValueActionPerformed(e);
}
});
btnNewButton_1.setIcon(new ImageIcon(Login.class.getResource("/images/\u91CD\u7F6E.png")));
GroupLayout gl_contentPane = new GroupLayout(contentPane);
gl_contentPane.setHorizontalGroup(
gl_contentPane.createParallelGroup(Alignment.TRAILING)
.addGroup(gl_contentPane.createSequentialGroup()
.addContainerGap(142, Short.MAX_VALUE)
.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 308, GroupLayout.PREFERRED_SIZE)
.addGap(90))
.addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup()
.addGap(73)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(lblNewLabel_2)
.addComponent(lblNewLabel_1))
.addGap(39)
.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false)
.addComponent(passwordTxt)
.addComponent(userNameTxt, GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE))
.addContainerGap(158, Short.MAX_VALUE))
.addGroup(gl_contentPane.createSequentialGroup()
.addComponent(btnNewButton)
.addPreferredGap(ComponentPlacement.RELATED, 177, Short.MAX_VALUE)
.addComponent(btnNewButton_1)
.addGap(114))))
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(39)
.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 127, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 41, GroupLayout.PREFERRED_SIZE)
.addComponent(userNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(50)
.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
.addComponent(lblNewLabel_2)
.addComponent(passwordTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(btnNewButton)
.addComponent(btnNewButton_1))
.addGap(28))
);
contentPane.setLayout(gl_contentPane);
}
/**
*重置事件处理
*/
private void resetValueActionPerformed(ActionEvent e) {
this.userNameTxt.setText("");
this.passwordTxt.setText("");
}
/**
* 登录事件处理
*
*/
private void loginActionPerformed(ActionEvent e) {
String userName=this.userNameTxt.getText();
String password=new String(this.passwordTxt.getPassword());
if(StringUtil.isEmpty(userName)) {
JOptionPane.showMessageDialog(null, "用户名不能为空!");
return;
}
if(StringUtil.isEmpty(password)) {
JOptionPane.showMessageDialog(null, "密码不能为空!");
return;
}
}
}
package view;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.ImageIcon;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JDesktopPane;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class MainFrame extends JFrame {
private JPanel contentPane;
private JDesktopPane table=null;
/**
* Launch the application.
// */
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainFrame frame = new MainFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MainFrame() {
setTitle("\u56FE\u4E66\u7BA1\u7406\u4E3B\u754C\u9762");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 637, 510);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu mnNewMenu = new JMenu("\u57FA\u672C\u6570\u636E\u7EF4\u62A4");
mnNewMenu.setIcon(new ImageIcon(MainFrame.class.getResource("/images/\u7EF4\u62A4.png")));
menuBar.add(mnNewMenu);
JMenu mnNewMenu_2 = new JMenu("\u56FE\u4E66\u7C7B\u522B\u7BA1\u7406");
mnNewMenu_2.setIcon(new ImageIcon(MainFrame.class.getResource("/images/\u7BA1\u7406.png")));
mnNewMenu.add(mnNewMenu_2);
JMenuItem mntmNewMenuItem_1 = new JMenuItem("\u56FE\u4E66\u7C7B\u522B\u6DFB\u52A0");
mntmNewMenuItem_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
BookTypeAddInternalFrm bookTypeAddInternalFrm =new BookTypeAddInternalFrm ();
bookTypeAddInternalFrm.setVisible(true);
table.add(bookTypeAddInternalFrm );
}
});
mntmNewMenuItem_1.setIcon(new ImageIcon(MainFrame.class.getResource("/images/\u6DFB\u52A0.png")));
mnNewMenu_2.add(mntmNewMenuItem_1);
JMenuItem mntmNewMenuItem_2 = new JMenuItem("\u56FE\u4E66\u7C7B\u522B\u7EF4\u62A4");
mntmNewMenuItem_2.setIcon(new ImageIcon(MainFrame.class.getResource("/images/\u7EF4\u62A41.png")));
mnNewMenu_2.add(mntmNewMenuItem_2);
JMenu mnNewMenu_3 = new JMenu("\u56FE\u4E66\u7BA1\u7406");
mnNewMenu_3.setIcon(new ImageIcon(MainFrame.class.getResource("/images/\u7BA1\u7406.png")));
mnNewMenu.add(mnNewMenu_3);
JMenuItem mntmNewMenuItem_3 = new JMenuItem("\u56FE\u4E66\u6DFB\u52A0");
mntmNewMenuItem_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
BookAddInterFrm bookAddInterFrm =new BookAddInterFrm ();
bookAddInterFrm.setVisible(true);
table.add(bookAddInterFrm );
}
});
mntmNewMenuItem_3.setIcon(new ImageIcon(MainFrame.class.getResource("/images/\u6DFB\u52A0.png")));
mnNewMenu_3.add(mntmNewMenuItem_3);
JMenuItem mntmNewMenuItem_4 = new JMenuItem("\u56FE\u4E66\u7EF4\u62A4");
mntmNewMenuItem_4.setIcon(new ImageIcon(MainFrame.class.getResource("/images/\u7EF4\u62A4.png")));
mnNewMenu_3.add(mntmNewMenuItem_4);
JMenuItem mntmNewMenuItem_5 = new JMenuItem("\u5B89\u5168\u9000\u51FA");
mntmNewMenuItem_5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int result=JOptionPane.showConfirmDialog(null, "是否退出系统");
if(result==0) {
dispose();
}
}
});
mntmNewMenuItem_5.setIcon(new ImageIcon(MainFrame.class.getResource("/images/\u9000\u51FA.png")));
mnNewMenu.add(mntmNewMenuItem_5);
JMenu mnNewMenu_1 = new JMenu("\u5173\u4E8E\u6211\u4EEC");
mnNewMenu_1.setIcon(new ImageIcon(MainFrame.class.getResource("/images/\u6211.png")));
menuBar.add(mnNewMenu_1);
JMenuItem mntmNewMenuItem = new JMenuItem("\u5173\u4E8E\u4F5C\u8005");
mntmNewMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
userInternalFrame userInternalFrame =new userInternalFrame();
userInternalFrame.setVisible(true);
table.add(userInternalFrame);
}
});
mntmNewMenuItem.setIcon(new ImageIcon(MainFrame.class.getResource("/images/\u6211.png")));
mnNewMenu_1.add(mntmNewMenuItem);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new BorderLayout(0, 0));
table = new JDesktopPane();
table.setBackground(Color.LIGHT_GRAY);
contentPane.add(table, BorderLayout.CENTER);
}}
package view;
import java.awt.EventQueue;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import java.awt.Font;
import javax.swing.SwingConstants;
import java.awt.Color;
public class userInternalFrame extends JInternalFrame {
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
userInternalFrame frame = new userInternalFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public userInternalFrame() {
setClosable(true);
setIconifiable(true);
setTitle("\u5173\u4E8E\u4F5C\u8005");
setBounds(100, 100, 516, 379);
JLabel lblNewLabel = new JLabel("\u6B22\u8FCE\u70B9\u8FDB\u6765\uFF01\uFF01\uFF01");
lblNewLabel.setForeground(Color.BLUE);
lblNewLabel.setFont(new Font("宋体", Font.BOLD, 33));
getContentPane().add(lblNewLabel, BorderLayout.CENTER);
}
}
```package view;
import java.awt.EventQueue;
import javax.swing.JInternalFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import javax.swing.JTextArea;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JComboBox;
import javax.swing.JButton;
import javax.swing.ImageIcon;
public class BookAddInterFrm extends JInternalFrame {
private JTextField bookNameTxt;
private final ButtonGroup buttonGroup = new ButtonGroup();
private JTextField authorTxt;
private JTextField priceTxt;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
BookAddInterFrm frame = new BookAddInterFrm();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public BookAddInterFrm() {
setIconifiable(true);
setTitle("\u56FE\u4E66\u6DFB\u52A0");
setClosable(true);
setBounds(100, 100, 619, 590);
JLabel lblNewLabel = new JLabel("\u56FE\u4E66\u540D\u79F0\uFF1A");
bookNameTxt = new JTextField();
bookNameTxt.setColumns(10);
JLabel lblNewLabel_1 = new JLabel("\u56FE\u4E66\u4F5C\u8005\uFF1A");
JLabel lblNewLabel_2 = new JLabel("\u4F5C\u8005\u6027\u522B\uFF1A");
JRadioButton manJrb = new JRadioButton("\u7537");
buttonGroup.add(manJrb);
JRadioButton womanJrb = new JRadioButton("\u5973");
buttonGroup.add(womanJrb);
JLabel lblNewLabel_3 = new JLabel("\u56FE\u4E66\u4EF7\u683C\uFF1A");
JLabel lblNewLabel_4 = new JLabel("\u56FE\u4E66\u63CF\u8FF0\uFF1A");
JTextArea bookDacTxt = new JTextArea();
authorTxt = new JTextField();
authorTxt.setColumns(10);
priceTxt = new JTextField();
priceTxt.setColumns(10);
JLabel lblNewLabel_5 = new JLabel("\u56FE\u4E66\u7C7B\u522B\uFF1A\r\n");
JComboBox bookTypeJcb = new JComboBox();
JButton btnNewButton = new JButton("\u6DFB\u52A0");
btnNewButton.setIcon(new ImageIcon(BookAddInterFrm.class.getResource("/images/\u6DFB\u52A0.png")));
JButton btnNewButton_1 = new JButton("\u91CD\u7F6E");
btnNewButton_1.setIcon(new ImageIcon(BookAddInterFrm.class.getResource("/images/\u91CD\u7F6E.png")));
GroupLayout groupLayout = new GroupLayout(getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(42)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(lblNewLabel_5)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(lblNewLabel)
.addGap(18)
.addComponent(bookNameTxt, GroupLayout.PREFERRED_SIZE, 118, GroupLayout.PREFERRED_SIZE))
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addComponent(lblNewLabel_4)
.addComponent(lblNewLabel_2))
.addGap(18)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
.addComponent(bookDacTxt, GroupLayout.PREFERRED_SIZE, 415, GroupLayout.PREFERRED_SIZE)
.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addComponent(lblNewLabel_1)
.addGroup(Alignment.LEADING, groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
.addGroup(Alignment.LEADING, groupLayout.createSequentialGroup()
.addGap(6)
.addComponent(bookTypeJcb, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(Alignment.LEADING, groupLayout.createSequentialGroup()
.addComponent(manJrb)
.addGap(28)
.addComponent(womanJrb)))
.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblNewLabel_3)))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(authorTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(priceTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))))
.addContainerGap(53, Short.MAX_VALUE))
.addGroup(groupLayout.createSequentialGroup()
.addGap(78)
.addComponent(btnNewButton)
.addPreferredGap(ComponentPlacement.RELATED, 225, Short.MAX_VALUE)
.addComponent(btnNewButton_1)
.addGap(74))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(31)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel)
.addComponent(bookNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(lblNewLabel_1)
.addComponent(authorTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(43)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel_2)
.addComponent(manJrb)
.addComponent(womanJrb)
.addComponent(lblNewLabel_3)
.addComponent(priceTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(45)
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addComponent(lblNewLabel_5)
.addComponent(bookTypeJcb, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(60)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel_4)
.addComponent(bookDacTxt, GroupLayout.PREFERRED_SIZE, 166, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED, 45, Short.MAX_VALUE)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(btnNewButton)
.addComponent(btnNewButton_1))
.addGap(62))
);
getContentPane().setLayout(groupLayout);
}
}
package view;
import java.awt.EventQueue;
import javax.swing.JInternalFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JComboBox;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.ImageIcon;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import javax.swing.JTextArea;
public class BookMangeInterFrm extends JInternalFrame {
private JTable table;
private JTextField s_bookNameTxt;
private JTextField s_authorTxt;
private JTextField textField;
private JTextField textField_1;
private final ButtonGroup buttonGroup = new ButtonGroup();
private JTextField textField_2;
private JTextField textField_3;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
BookMangeInterFrm frame = new BookMangeInterFrm();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public BookMangeInterFrm() {
setIconifiable(true);
setTitle("\u56FE\u4E66\u7BA1\u7406");
setClosable(true);
setBounds(100, 100, 803, 593);
JScrollPane scrollPane = new JScrollPane();
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(null, "\u641C\u7D22\u6761\u4EF6", TitledBorder.LEADING, TitledBorder.TOP, null, null));
JPanel panel_1 = new JPanel();
panel_1.setBorder(new TitledBorder(null, "\u8868\u5355\u64CD\u4F5C", TitledBorder.LEADING, TitledBorder.TOP, null, null));
JButton btnNewButton_1 = new JButton("\u4FEE\u6539");
btnNewButton_1.setIcon(new ImageIcon(BookMangeInterFrm.class.getResource("/images/\u4FEE\u6539.png")));
JButton btnNewButton_2 = new JButton("\u5220\u9664");
btnNewButton_2.setIcon(new ImageIcon(BookMangeInterFrm.class.getResource("/images/\u5220\u9664.png")));
GroupLayout groupLayout = new GroupLayout(getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 596, Short.MAX_VALUE)
.addComponent(panel, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 596, Short.MAX_VALUE)
.addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 759, Short.MAX_VALUE))
.addContainerGap())
.addGroup(groupLayout.createSequentialGroup()
.addGap(75)
.addComponent(btnNewButton_1)
.addPreferredGap(ComponentPlacement.RELATED, 410, Short.MAX_VALUE)
.addComponent(btnNewButton_2)
.addGap(126))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(22)
.addComponent(panel, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
.addGap(33)
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 139, GroupLayout.PREFERRED_SIZE)
.addGap(29)
.addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(btnNewButton_1)
.addComponent(btnNewButton_2))
.addContainerGap(15, Short.MAX_VALUE))
);
JLabel lblNewLabel_3 = new JLabel("\u7F16\u53F7\uFF1A");
textField = new JTextField();
textField.setEditable(false);
textField.setColumns(10);
JLabel lblNewLabel_4 = new JLabel("\u56FE\u4E66\u540D\u79F0\uFF1A");
textField_1 = new JTextField();
textField_1.setColumns(10);
JLabel lblNewLabel_5 = new JLabel("\u4F5C\u8005\u6027\u522B\uFF1A");
JRadioButton rdbtnNewRadioButton = new JRadioButton("\u7537");
buttonGroup.add(rdbtnNewRadioButton);
JRadioButton rdbtnNewRadioButton_1 = new JRadioButton("\u5973");
buttonGroup.add(rdbtnNewRadioButton_1);
JLabel lblNewLabel_6 = new JLabel("\u4EF7\u683C\uFF1A");
textField_2 = new JTextField();
textField_2.setColumns(10);
JLabel lblNewLabel_7 = new JLabel("\u56FE\u4E66\u4F5C\u8005\uFF1A");
textField_3 = new JTextField();
textField_3.setColumns(10);
JLabel lblNewLabel_8 = new JLabel("\u56FE\u4E66\u7C7B\u522B\uFF1A");
JComboBox comboBox = new JComboBox();
JLabel lblNewLabel_9 = new JLabel("\u56FE\u4E66\u63CF\u8FF0\uFF1A");
JTextArea textArea = new JTextArea();
GroupLayout gl_panel_1 = new GroupLayout(panel_1);
gl_panel_1.setHorizontalGroup(
gl_panel_1.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_1.createSequentialGroup()
.addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_1.createSequentialGroup()
.addContainerGap()
.addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING, false)
.addGroup(gl_panel_1.createSequentialGroup()
.addComponent(lblNewLabel_3)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 106, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_panel_1.createSequentialGroup()
.addComponent(lblNewLabel_6)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(textField_2)))
.addGap(88)
.addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING, false)
.addGroup(gl_panel_1.createSequentialGroup()
.addComponent(lblNewLabel_4)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, 104, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_panel_1.createSequentialGroup()
.addComponent(lblNewLabel_7)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(textField_3)))
.addGap(30)
.addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING, false)
.addGroup(gl_panel_1.createSequentialGroup()
.addComponent(lblNewLabel_5)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(rdbtnNewRadioButton)
.addGap(18)
.addComponent(rdbtnNewRadioButton_1))
.addGroup(gl_panel_1.createSequentialGroup()
.addComponent(lblNewLabel_8)
.addGap(18)
.addComponent(comboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGroup(gl_panel_1.createSequentialGroup()
.addComponent(lblNewLabel_9)
.addGap(6)
.addComponent(textArea, GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)))
.addContainerGap())
);
gl_panel_1.setVerticalGroup(
gl_panel_1.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_1.createSequentialGroup()
.addContainerGap()
.addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel_3)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(lblNewLabel_4)
.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(lblNewLabel_5)
.addComponent(rdbtnNewRadioButton)
.addComponent(rdbtnNewRadioButton_1))
.addGap(26)
.addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel_6)
.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(lblNewLabel_7)
.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(lblNewLabel_8)
.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_1.createSequentialGroup()
.addGap(28)
.addComponent(lblNewLabel_9))
.addGroup(gl_panel_1.createSequentialGroup()
.addGap(18)
.addComponent(textArea, GroupLayout.PREFERRED_SIZE, 64, GroupLayout.PREFERRED_SIZE)))
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panel_1.setLayout(gl_panel_1);
JLabel lblNewLabel = new JLabel("\u56FE\u4E66\u540D\u79F0\uFF1A");
s_bookNameTxt = new JTextField();
s_bookNameTxt.setColumns(10);
JLabel lblNewLabel_1 = new JLabel("\u56FE\u4E66\u4F5C\u8005\uFF1A");
s_authorTxt = new JTextField();
s_authorTxt.setColumns(10);
JComboBox s_bookTypeJcb = new JComboBox();
JLabel lblNewLabel_2 = new JLabel("\u56FE\u4E66\u7C7B\u522B\uFF1A");
JButton btnNewButton = new JButton("\u67E5\u8BE2");
btnNewButton.setSelectedIcon(new ImageIcon(BookMangeInterFrm.class.getResource("/images/\u67E5\u8BE2.png")));
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
GroupLayout gl_panel = new GroupLayout(panel);
gl_panel.setHorizontalGroup(
gl_panel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel.createSequentialGroup()
.addComponent(lblNewLabel)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(s_bookNameTxt, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE)
.addGap(28)
.addComponent(lblNewLabel_1)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(s_authorTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addGap(30)
.addComponent(lblNewLabel_2)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(s_bookTypeJcb, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
gl_panel.setVerticalGroup(
gl_panel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel.createSequentialGroup()
.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel)
.addComponent(s_bookNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(s_authorTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(s_bookTypeJcb, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(lblNewLabel_1)
.addComponent(lblNewLabel_2)
.addComponent(btnNewButton))
.addContainerGap(30, Short.MAX_VALUE))
);
panel.setLayout(gl_panel);
table = new JTable();
table.setModel(new DefaultTableModel(
new Object[][] {
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
},
new String[] {
"\u7F16\u53F7", "\u56FE\u4E66\u540D\u79F0", "\u56FE\u4E66\u4F5C\u8005", "\u4F5C\u8005\u6027\u522B", "\u56FE\u4E66\u4EF7\u683C", "\u56FE\u4E66\u6982\u8FF0", "\u56FE\u4E66\u7C7B\u522B"
}
));
scrollPane.setViewportView(table);
getContentPane().setLayout(groupLayout);
}
}
```package view;
import java.awt.EventQueue;
import javax.swing.JInternalFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.ImageIcon;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class BookTypeAddInternalFrm extends JInternalFrame {
private JTextField bookTypeNameTxt;
private JTextArea bookTypeDecscTxt;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
BookTypeAddInternalFrm frame = new BookTypeAddInternalFrm();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public BookTypeAddInternalFrm() {
setClosable(true);
setIconifiable(true);
setTitle("\u56FE\u4E66\u7C7B\u522B\u6DFB\u52A0");
setBounds(100, 100, 513, 388);
JLabel lblNewLabel = new JLabel("\u56FE\u4E66\u7C7B\u522B\u540D\u79F0\uFF1A");
JLabel lblNewLabel_1 = new JLabel("\u56FE\u4E66\u7C7B\u522B\u63CF\u8FF0");
bookTypeNameTxt = new JTextField();
bookTypeNameTxt.setColumns(10);
JTextArea bookTypeDecscTxt = new JTextArea();
JButton btnNewButton = new JButton("\u6DFB\u52A0");
btnNewButton.setIcon(new ImageIcon(BookTypeAddInternalFrm.class.getResource("/images/\u6DFB\u52A0.png")));
JButton btnNewButton_1 = new JButton("\u91CD\u7F6E");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
resetValueActionPerformed(e);
}
});
btnNewButton_1.setIcon(new ImageIcon(BookTypeAddInternalFrm.class.getResource("/images/\u91CD\u7F6E.png")));
GroupLayout groupLayout = new GroupLayout(getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(85)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(lblNewLabel)
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addComponent(btnNewButton)
.addComponent(lblNewLabel_1)))
.addGap(18)
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
.addComponent(bookTypeNameTxt)
.addComponent(bookTypeDecscTxt, GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE))
.addComponent(btnNewButton_1))
.addContainerGap(75, Short.MAX_VALUE))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(84)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel)
.addComponent(bookTypeNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(46)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel_1)
.addComponent(bookTypeDecscTxt, GroupLayout.PREFERRED_SIZE, 135, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(btnNewButton)
.addComponent(btnNewButton_1))
.addContainerGap(21, Short.MAX_VALUE))
);
getContentPane().setLayout(groupLayout);
}
private void resetValueActionPerformed(ActionEvent e) {
this.resetValue();
}
private void resetValue() {
this.bookTypeNameTxt.setText("");
this.bookTypeDecscTxt.setText("");
}
```package view;
import java.awt.EventQueue;
import javax.swing.JInternalFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.ImageIcon;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import javax.swing.JTextArea;
public class BookTypeMangerInternalFrm extends JInternalFrame {
private JTable BookTypeTable;
private JTextField textField;
private JTextField idTxt;
private JTextField bookTypeTxt;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
BookTypeMangerInternalFrm frame = new BookTypeMangerInternalFrm();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public BookTypeMangerInternalFrm() {
setIconifiable(true);
setTitle("\u56FE\u4E66\u7C7B\u522B\u7BA1\u7406");
setClosable(true);
setBounds(100, 100, 606, 639);
JScrollPane scrollPane = new JScrollPane();
JLabel lblNewLabel = new JLabel("\u56FE\u4E66\u7C7B\u522B\u67E5\u8BE2\uFF1A");
textField = new JTextField();
textField.setColumns(10);
JButton button = new JButton("\u67E5\u8BE2");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
button.setIcon(new ImageIcon(BookTypeMangerInternalFrm.class.getResource("/images/\u67E5\u8BE2.png")));
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(null, "\u8868\u5355\u64CD\u4F5C", TitledBorder.LEADING, TitledBorder.TOP, null, null));
GroupLayout groupLayout = new GroupLayout(getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.TRAILING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 553, Short.MAX_VALUE)
.addContainerGap())
.addGroup(Alignment.LEADING, groupLayout.createSequentialGroup()
.addGap(66)
.addComponent(lblNewLabel)
.addGap(43)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 157, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED, 74, Short.MAX_VALUE)
.addComponent(button)
.addGap(23))
.addGroup(Alignment.LEADING, groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(panel, GroupLayout.DEFAULT_SIZE, 562, Short.MAX_VALUE)
.addContainerGap())
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(52)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(button))
.addGap(41)
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE)
.addGap(26)
.addComponent(panel, GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE)
.addContainerGap(28, Short.MAX_VALUE))
);
JLabel lblNewLabel_1 = new JLabel("\u7F16\u53F7\uFF1A");
idTxt = new JTextField();
idTxt.setColumns(10);
JLabel lblNewLabel_2 = new JLabel("\u56FE\u4E66\u7C7B\u522B\u540D\u79F0\uFF1A");
bookTypeTxt = new JTextField();
bookTypeTxt.setColumns(10);
JLabel lblNewLabel_3 = new JLabel("\u63CF\u8FF0\uFF1A");
JTextArea bookTypeDescTxt = new JTextArea();
JButton btnNewButton = new JButton("\u4FEE\u6539");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
btnNewButton.setIcon(new ImageIcon(BookTypeMangerInternalFrm.class.getResource("/images/\u4FEE\u6539.png")));
JButton btnNewButton_1 = new JButton("\u5220\u9664");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
btnNewButton_1.setIcon(new ImageIcon(BookTypeMangerInternalFrm.class.getResource("/images/\u5220\u9664.png")));
GroupLayout gl_panel = new GroupLayout(panel);
gl_panel.setHorizontalGroup(
gl_panel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel.createSequentialGroup()
.addGap(38)
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING, false)
.addComponent(lblNewLabel_3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(32)
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel.createSequentialGroup()
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel.createSequentialGroup()
.addComponent(idTxt, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
.addGap(56)
.addComponent(lblNewLabel_2)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(bookTypeTxt, GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE))
.addComponent(bookTypeDescTxt, GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE))
.addContainerGap())
.addGroup(Alignment.TRAILING, gl_panel.createSequentialGroup()
.addComponent(btnNewButton)
.addPreferredGap(ComponentPlacement.RELATED, 194, Short.MAX_VALUE)
.addComponent(btnNewButton_1)
.addGap(75))))
);
gl_panel.setVerticalGroup(
gl_panel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel.createSequentialGroup()
.addContainerGap()
.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel_1)
.addComponent(idTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(lblNewLabel_2)
.addComponent(bookTypeTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
.addComponent(bookTypeDescTxt, GroupLayout.PREFERRED_SIZE, 92, GroupLayout.PREFERRED_SIZE)
.addComponent(lblNewLabel_3))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
.addComponent(btnNewButton_1)
.addComponent(btnNewButton))
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panel.setLayout(gl_panel);
BookTypeTable = new JTable();
BookTypeTable.setModel(new DefaultTableModel(
new Object[][] {
{null, null, null},
{null, null, null},
},
new String[] {
"\u7F16\u53F7", "\u56FE\u4E66\u7C7B\u522B\u540D\u79F0", "\u56FE\u4E66\u7C7B\u522B\u63CF\u8FF0"
}
));
scrollPane.setViewportView(BookTypeTable);
getContentPane().setLayout(groupLayout);
}
}