Javaee -- 酒店管理系统

(今天调试了一下,把问题解决了,因为连接数库的语法错误,把||改成and就可以了,所以这篇文章的问题已经解决,各位自行把||改成and就好,谢谢阅读!!!)
//接上一篇,这一篇没有编写新页面,只是弄了后台数据库连接,采用model模式
因为有了错误,所以把现在所做的所有页面的代码共享吗,希望大佬帮忙调试一下,,,好无奈
//第一个页面index
package com.mol.view;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;

import javax.swing.JPanel;
import javax.swing.JWindow;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class Index extends JWindow implements Runnable{
//定义为成员变量,将应用类型嵌入到Window窗口中!
paint p;
public static void main(String[] args) {

    try {
        // 将当前窗体外观设置为所在操作系统的外观
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
        e.printStackTrace();
    }
    Index index = new Index();
    Thread t = new Thread(index);
    t.start();
}
//构造方法用来初始化变量和方法
public Index() {
    // 创建Paint对象,实现闪屏
    p = new paint();
    this.add(p);

    this.setSize(400, 250);
    // 确定Jwindow初始位置
    this.setLocationRelativeTo(null);
    this.setVisible(true);
}

//线程方法,跳出登录页面
public void run() {
    while(true) {
        try {
            Thread.sleep(29*500);
        } catch (Exception e) {
            e.printStackTrace();
        }
        //释放进入的窗体,显示登录页面
        this.dispose();
        //跳转到登录页面
        new UserLogin();
        break;

    }

}

}
//定义一个闪屏类
class paint extends JPanel implements Runnable{// 可以自动刷新Panel
Thread t;
int x = 10;
int i = 0, j = 40, u = 10;
String gg[] = { “系”, “统”, “正”, “在”, “加”, “载”, “请”, “稍”, “侯” };
int k = 0, tt = 0;
String shi[] = { “满”, “汉”, “楼”, “融”, “满”, “汉”, “精”, “华”, “做”, “天”, “下”,
“美”, “味”, “招”, “八”, “方”, “食”, “客”, “结”, “四”, “海”, “良”, “朋”,
“满”, “汉”, “楼”, “程”, “序”, “演”, “示” };
//设置字体
Font f = new Font(“隶书”, Font.PLAIN, 18);

boolean ifok = true;
int width = 180;
int height = 0;
int dian = 0;

paint() {
    t = new Thread(this);
    t.start();
}

public void run() {
    while (true) {
        if (x <= 380);
        repaint();
        try {
            Thread.sleep(70);
            i++;// i=0
            j = j - 6;// j=40
            u = u + 10;// u=10
            if (tt == 3)
                width = width - 20; // tt=0,width=180
            if (i == 4) {
                tt++;
                if (ifok && x > 120 + k * 20)
                    k++;// k=0
                if (k >= gg.length - 1)
                    ifok = false;
                x = x + 10;
                i = 0;
                j = 40;
                u = 10;
                dian++;
                if (dian > 3)
                    dian = 0;
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

public void paintComponent(Graphics g) {
    // super.paintComponent(g);
    Image image;
    image = Toolkit.getDefaultToolkit().getImage("image/index.jpg");// 获得背景图片
    g.drawImage(image, 0, 0, this.getWidth(), 200, this);

    int r = (int) (Math.random() * 255);
    int b = (int) (Math.random() * 255);
    int y = (int) (Math.random() * 255);

    g.setColor(new Color(253, 250, 250));// White
    g.fillRect(x, 210, 380 - x, 30);
    g.setColor(new Color(253, 250, 250));// white
    if (i > 1)
        g.fillRect(x, 235 - (j + 20) / 2, 10, j + 10);// 领头的长方块儿
    if (j > 25)
        g.setColor(new Color(r, b, y));
    else
        g.setColor(new Color(123, 194, 252));// light blue
    g.fillRect(x, 235 - (j + 20) / 2, 10, j);// 后面跟着的短方块儿,10代表闪动条的宽度,j代表闪动条的高度
    g.setColor(new Color(123, 194, 252));// light blue
    g.drawRect(10, 210, 380, 30);

    if (x < 120) {
        for (int l = 0; l < gg.length; l++) {
            g.setColor(new Color(0, 0, 0));
            g.drawString(gg[l], 120 + l * 20, 230);
        }
        for (int l = 0; l < dian; l++) {
            g.setColor(new Color(0, 0, 0));
            g.drawString("*", 300 + l * 10, 235);
        }
        g.drawString("*", 300 + dian * 10, 235);
    } else {
        // 设置写字的颜色和位置
        g.setColor(new Color(23, 23, 230));
        g.drawString(gg[k], 120 + k * 20, 230);

        for (int l = k + 1; l < gg.length; l++) {
            g.setColor(new Color(0, 0, 0));
            g.drawString(gg[l], 120 + l * 20, 230);
        }
        if (x > 300 + dian * 10)
            g.setColor(new Color(23, 23, 230));
        for (int l = 0; l < dian; l++) {
            g.drawString("*", 300 + l * 10, 235);
        }
        g.drawString("*", 300 + dian * 10, 235);
    }
    // ------------逐字写诗

    if (tt < 3) {
        for (int rr = 0; rr <= tt; rr++) {
            g.setColor(new Color(250, 0, 0));
            g.drawString(shi[rr], 180, 60 + rr * 20);
        }
        g.drawString(shi[tt], 180, 60 + tt * 20);
    }
    if (tt >= 3 && tt < 8) {
        g.setColor(new Color(230, 0, 0));
        for (int rr = 0; rr < 3; rr++)
            g.drawString(shi[rr], 180, 60 + rr * 20);
        g.setColor(new Color(r, b, y));
        if (tt < 8)
  • 3
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值