📄 lefttoppanel.java
字号:
package com.redingsoft.mainframe;
import com.redingsoft.sunsdk.swing.setimage;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.*;
import javax.swing.border.TitledBorder;
public class LeftTopPanel extends JPanel{
//声明房间总信息标签
public static JLabel zjl1,zjl2,zjl3,zjl11,zjl12,wel;
// 声明一个文本框
public static JTextArea tf1;
//声明房间详细信息标签
public static JLabel xjl1,xjl2,xjl3,xjl4,xjl5,xjl11,xjl12,xjl13,xjl14,xjl15;
//声明面板
JPanel toppane,centerpane, bottpane,mainpane;
//构造方法
public LeftTopPanel(){
//实例化文本框
tf1=new JTextArea(3,10);
tf1.setBackground(Color.GRAY);
tf1.setFont(new Font("宋体",Font.BOLD,14));
tf1.setForeground(Color.RED);
tf1.setEditable(false);
tf1.setLineWrap(true); // tf1.setDisabledTextColor(Color.GREEN);
//实例化标签
// zjl1=new JLabel("现在时间:");
zjl2=new JLabel("可供房间总数:");
zjl3=new JLabel("占用房间总数:");
zjl11=new JLabel("0");
zjl12=new JLabel("0");
//设置标签内容的颜色
zjl11.setForeground(Color.BLUE);
zjl12.setForeground(Color.RED);
zjl11.setFont(new Font("宋体",Font.BOLD,15));
zjl12.setFont(new Font("宋体",Font.BOLD,15));
//////////////////////////////
xjl1=new JLabel("客人姓名:");
xjl2=new JLabel("开房时间:");
xjl3=new JLabel("预住天数:");
xjl4=new JLabel("实际消费:");
xjl5=new JLabel("客人押金:");
/////////////////////////////
xjl11=new JLabel("***");
xjl12=new JLabel(" ***");
xjl13=new JLabel("***");
xjl14=new JLabel("***");
xjl15=new JLabel("****");
/////////////////////////////
xjl11.setForeground(Color.ORANGE);
xjl12.setForeground(Color.green);
xjl13.setForeground(Color.ORANGE);
xjl14.setForeground(Color.green);
xjl15.setForeground(Color.ORANGE);
////////////////////////////
xjl11.setFont(new Font("宋体",Font.BOLD,15));
xjl12.setFont(new Font("宋体",Font.BOLD,12));
xjl13.setFont(new Font("宋体",Font.BOLD,15));
xjl14.setFont(new Font("宋体",Font.BOLD,15));
xjl15.setFont(new Font("宋体",Font.BOLD,15));
//实例化面板
toppane=new JPanel(new FlowLayout(FlowLayout.CENTER,1,10));
centerpane=new JPanel(new FlowLayout(FlowLayout.LEFT,1,15));
bottpane=new setimage("com/redingsoft/pic/welcome.gif");
mainpane=new JPanel(new BorderLayout());
// toppane.add(zjl1);
toppane.add(tf1); //时间
//centerpane中间面板
centerpane.add(zjl2); //可供房间数
centerpane.add(zjl11);
centerpane.add(zjl3); //占用房间总数
centerpane.add(zjl12);
centerpane.add(xjl1);//姓名
centerpane.add(xjl11);
centerpane.add(xjl2); //开房间时间
centerpane.add(xjl12);
centerpane.add(xjl3); //预住天数
centerpane.add(xjl13);
centerpane.add(xjl4); //消费额
centerpane.add(xjl14);
centerpane.add(xjl5); //押金
centerpane.add(xjl15);
//设置面板的参数
toppane.setPreferredSize(new Dimension(150,100));
centerpane.setPreferredSize(new Dimension(150,300));
bottpane.setPreferredSize(new Dimension(150,150));
toppane.setBackground(Color.GRAY);
centerpane.setBackground(Color.GRAY);
bottpane.setBackground(Color.WHITE);
//添加边框
centerpane.setBorder(BorderFactory.createRaisedBevelBorder());
toppane.setBorder(BorderFactory.createRaisedBevelBorder());
bottpane.setBorder(BorderFactory.createRaisedBevelBorder());
toppane.setBorder(BorderFactory.createTitledBorder(toppane.getBorder(),"当前时间",TitledBorder.CENTER ,TitledBorder.TOP,new Font("宋体",Font.BOLD,15),Color.BLUE));
centerpane.setBorder(BorderFactory.createTitledBorder(centerpane.getBorder(),"房间详细信息"));
bottpane.setBorder(BorderFactory.createTitledBorder(bottpane.getBorder(),"欢迎使用"));
mainpane.add(BorderLayout.NORTH,toppane);
mainpane.add(BorderLayout.SOUTH,bottpane);
mainpane.add(BorderLayout.CENTER,centerpane);
//添加到主面板
this.add(mainpane);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -