/*
* MainFrame.java
*
* Created on __DATE__, __TIME__
*/
package bookstore.manage;
import java.util.TimerTask;
import javax.swing.JOptionPane;
/**
*
* @author __USER__
*/
public class MainFrame extends javax.swing.JFrame {
/** Creates new form MainFrame */
public MainFrame() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
label1 = new java.awt.Label();
imagePanel1 = new bookstore.panel.ImagePanel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem4 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuItem1 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem5 = new javax.swing.JMenuItem();
jMenuItem6 = new javax.swing.JMenuItem();
jMenuItem7 = new javax.swing.JMenuItem();
jMenuItem8 = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenu4 = new javax.swing.JMenu();
jMenuItem11 = new javax.swing.JMenuItem();
jMenuItem12 = new javax.swing.JMenuItem();
jMenuItem10 = new javax.swing.JMenuItem();
jMenuItem9 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
label1.setAlignment(java.awt.Label.CENTER);
label1.setFont(new java.awt.Font("Dialog", 2, 40));
label1.setForeground(new java.awt.Color(0, 0, 204));
label1.setText("\u6b22\u8fce\u8fdb\u5165\u7cfb\u7edf");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(
jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addGroup(
jPanel1Layout.createSequentialGroup().addGap(79, 79, 79)
.addComponent(label1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(384, Short.MAX_VALUE)));
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addGroup(
jPanel1Layout.createSequentialGroup().addGap(38, 38, 38)
.addComponent(label1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(291, Short.MAX_VALUE)));
javax.swing.GroupLayout imagePanel1Layout = new javax.swing.GroupLayout(
imagePanel1);
imagePanel1.setLayout(imagePanel1Layout);
imagePanel1Layout.setHorizontalGroup(imagePanel1Layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE));
imagePanel1Layout.setVerticalGroup(imagePanel1Layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE));
timer = new java.util.Timer();
timer.scheduleAtFixedRate(new java.util.TimerTask() {
public void run() {
if ((label1.getLocation().y + label1.getSize().getHeight()) < jPanel1
.getSize().getHeight()
&& (label1.getLocation().x + label1.getSize()
.getWidth()) < jPanel1.getSize().getWidth()
&& Rdown) {
label1.setLocation(label1.getLocation().x + 10, label1
.getLocation().y + 10);
if ((label1.getLocation().y + label1.getSize().getHeight()) >= jPanel1
.getSize().getHeight()) {
Rdown = false;
Rup = true;
Lup = false;
Ldown = false;
}
if ((label1.getLocation().x + label1.getSize().getWidth()) >= jPanel1
.getSize().getWidth()) {
Rdown = false;
Rup = false;
Lup = false;
Ldown = true;
}
}
if ((label1.getLocation().x + label1.getSize().getWidth()) < jPanel1
.getSize().getWidth()
&& (label1.getLocation().y + label1.getSize()
.getHeight()) > label1.getSize().getHeight()
&& Rup) {
label1.setLocation(label1.getLocation().x + 10, label1
.getLocation().y - 10);
if ((label1.getLocation().x + label1.getSize().getWidth()) >= jPanel1
.getSize().getWidth()) {
Rdown = false;
Rup = false;
Lup = true;
Ldown = false;
}
if (label1.getLocation().y <= 0) {
Rdown = true;
Rup = false;
Lup = false;
Ldown = false;
}
}
if (label1.getLocation().x > 0 && label1.getLocation().y > 0
&& Lup) {
label1.setLocation(label1.getLocation().x - 10, label1
.getLocation().y - 10);
if (label1.getLocation().y <= 0) {
Rdown = false;
Rup = false;
Lup = false;
Ldown = true;
}
if (label1.getLocation().x <= 0) {
Rdown = false;
Rup = true;
Lup = false;
Ldown = false;
}
}
if (label1.getLocation().x > 0
&& (label1.getLocation().y + label1.getSize()
.getHeight()) < jPanel1.getSize().getHeight()
&& Ldown) {
label1.setLocation(label1.getLocation().x - 10, label1
.getLocation().y + 10);
if (label1.getLocation().x <= 0) {
Rdown = true;
Rup = false;
Lup = false;
Ldown = false;
}
if ((label1.getLocation().y + label1.getSize().getHeight()) >= jPanel1
.getSize().getHeight()) {
Rdown = false;
Rup = false;
Lup = true;
Ldown = false;
}
}
}
}, 800, 500);
jMenu1.setText("\u56fe\u4e66\u7ba1\u7406");
jMenuItem4.setText("\u65b0\u4e66\u5165\u5e93");
jMenu1.add(jMenuItem4);
jMenuItem2.setText("\u56fe\u4e66\u501f\u9605");
jMenu1.add(jMenuItem2);
jMenuItem3.setText("\u4fee\u6539\u56fe\u4e66\u72b6\u6001");
jMenu1.add(jMenuItem3);
jMenuItem1.setText("\u5220\u9664\u65e7\u4e66");
jMenu1.add(jMenuItem1);
jMenuBar1.add(jMenu1);
jMenu2.setText("\u5b66\u751f\u7ba1\u7406");
jMenuItem5.setText("\u6ce8\u518c\u5b66\u751f");
jMenu2.add(jMenuItem5);
jMenuItem6.setText("\u4fee\u6539\u5b66\u751f\u8d44\u6599");
jMenu2.add(jMenuItem6);
jMenuItem7.setText("\u5b66\u751f\u501f\u9605\u8bb0\u5f55");
jMenu2.add(jMenuItem7);
jMenuItem8.setText("\u5220\u9664\u5b66\u751f\u8d44\u6599");
jMenu2.add(jMenuItem8);
jMenuBar1.add(jMenu2);
jMenu3.setText("\u7cfb\u7edf\u8bbe\u5b9a");
jMenu4.setText("\u7ba1\u7406\u5458");
jMenuItem11.setText("\u6dfb\u52a0\u65b0\u7ba1\u7406\u5458");
jMenu4.add(jMenuItem11);
jMenuItem12.setText("\u4fee\u6539\u7ba1\u7406\u5458\u8d44\u6599");
jMenu4.add(jMenuItem12);
jMenuItem10.setText("\u5220\u9664\u7ba1\u7406\u5458");
jMenu4.add(jMenuItem10);
jMenu3.add(jMenu4);
jMenuItem9.setText("\u9000\u51fa");
jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
qiut(evt);
}
});
jMenu3.add(jMenuItem9);
jMenuBar1.add(jMenu3);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addComponent(
jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
layout.setVerticalGroup(layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addComponent(
jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
pack();
}// </editor-fold>
// GEN-END:init
- 1
- 2
前往页