package a;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.LineBorder;
public class List extends JFrame implements MouseListener {
/**
*
*/
private static final long serialVersionUID = 1L;
private int hang=40;//改变行距
private int width=200;//第一级列表宽度
private int height=60;//第一级列表高度
private int kuang=200;//列表第二级宽度
private int cang=60;//列表第一级和第二级高度
private int font1=18;//第一级字体大小
private int font2=18;//第二级字体大小
private int change=0;
private int change1=0;//改变列表列距
private boolean b=false,c=false,d=false,e=false;
private int i=1,o=1,p=1,q=1;
static JPanel jpanel;
static JPanel jp1=new JPanel();//列表
static JScrollPane jsp1=new JScrollPane(jp1);
JLabel jl=new JLabel(" 》系统设置");
public JLabel jl01=new JLabel(" 权限管理");
JLabel jl1=new JLabel(" 》基本资料");
JLabel jl11=new JLabel(" 个人资料");
JLabel jl2=new JLabel(" 》仓库作业");
JLabel jl21=new JLabel(" 入库登记");
JLabel jl22=new JLabel(" 出库登记");
JLabel jl3=new JLabel(" 》报表管理");
JLabel jl31=new JLabel(" 货物统计");
JLabel jl32=new JLabel(" 入库报表");
JLabel jl33=new JLabel(" 出库报表");
JLabel jl34=new JLabel(" 客户报表");
JLabel jl35=new JLabel(" 供应商报表");
List(){
Dimension s=Toolkit.getDefaultToolkit().getScreenSize();//全屏用的
jpanel=(JPanel)getContentPane();
jpanel.setLayout(null);
jpanel.add(jsp1);
jpanel.setBounds(0, 0, (int)s.getWidth()-1500, (int)s.getHeight()-473);
jpanel.setBackground(Color.black);
jsp1.setBounds(0, 0, (int)s.getWidth()-1500, (int)s.getHeight()-473);
jp1.setPreferredSize(new Dimension(jsp1.getWidth()-50,jsp1.getHeight()));
jp1.setLayout(null);
jp1.revalidate();
jp1.setBackground(new Color(49,79,79));
jsp1.getVerticalScrollBar().setUI(new Slider());//改变滑动条
List1();//显示列表
this.setTitle("这是列表");
this.setSize((int)s.getWidth()-1400,(int)s.getHeight()-200);
this.setVisible(true);
this.setResizable(false);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public void List1(){//设置列表
jp1.add(jl);
jp1.add(jl01);
jp1.add(jl1);
jp1.add(jl11);
jp1.add(jl2);
jp1.add(jl21);
jp1.add(jl22);
jp1.add(jl3);
jp1.add(jl31);
jp1.add(jl32);
jp1.add(jl33);
jp1.add(jl34);
jp1.add(jl35);
jl.setBounds(0,change,width,height);
jl01.setBounds(hang,change+height,kuang,cang);
jl01.setVisible(false);
jl01.setForeground(Color.white);
jl1.setBounds(0,change1+height,width,height);
jl11.setBounds(hang,change1+height*2,kuang,cang);
jl11.setVisible(false);
jl11.setForeground(Color.white);
jl2.setBounds(0,change1+height*2,width,height);
jl21.setBounds(hang,change1+height*3,kuang,cang);
jl21.setVisible(false);
jl21.setForeground(Color.white);
jl22.setBounds(hang,change1+height*3+cang,kuang,cang);
jl22.setVisible(false);
jl22.setForeground(Color.white);
jl3.setBounds(0,change1+height*3,width,height);
jl31.setBounds(hang,change1+height*4,kuang,cang);
jl31.setVisible(false);
jl31.setForeground(Color.white);
jl32.setBounds(hang,change1+height*4+cang,kuang,cang);
jl32.setVisible(false);
jl32.setForeground(Color.white);
jl33.setBounds(hang,change1+height*4+cang*2,kuang,cang);
jl33.setVisible(false);
jl33.setForeground(Color.white);
jl34.setBounds(hang,change1+height*4+cang*3,kuang,cang);
jl34.setVisible(false);
jl34.setForeground(Color.white);
jl35.setBounds(hang,change1+height*4+cang*4,kuang,cang);
jl35.setVisible(false);
jl35.setForeground(Color.white);
jl.setForeground(Color.white);
jl1.setForeground(Color.white);
jl2.setForeground(Color.white);
jl3.setForeground(Color.white);
jl.setBorder(new LineBorder( Color.gray));
jl1.setBorder(new LineBorder( Color.gray));
jl2.setBorder(new LineBorder( Color.gray));
jl3.setBorder(new LineBorder( Color.gray));
jl.setFont(new Font(" ",1,font1));
jl01.setFont(new Font(" ",1,font2));
jl1.setFont(new Font(" ",1,font1));
jl11.setFont(new Font(" ",1,font2));
jl2.setFont(new Font(" ",1,font1));
jl21.setFont(new Font(" ",1,font2));
jl22.setFont(new Font(" ",1,font2));
jl3.setFont(new Font(" ",1,font1));
jl31.setFont(new Font(" ",1,font2));
jl32.setFont(new Font(" ",1,font2));
jl33.setFont(new Font(" ",1,font2));
jl34.setFont(new Font(" ",1,font2));
jl35.setFont(new Font(" ",1,font2));
jl.addMouseListener(this);
jl01.addMouseListener(this);
jl1.addMouseListener(this);
jl11.addMouseListener(this);
jl2.addMouseListener(this);
jl21.addMouseListener(this);
jl22.addMouseListener(this);
jl3.addMouseListener(this);
jl31.addMouseListener(this);
jl32.addMouseListener(this);
jl33.addMouseListener(this);
jl34.addMouseListener(this);
jl35.addMouseListener(this);
}
public static void main(String args[]){
new List();
}
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==jl){
jl();
}
if(e.getSource()==jl1){
jl1();
}
if(e.getSource()==jl2){
jl2();
}
if(e.getSource()==jl3){
jl3();
}
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==jl){//系统设置列表变颜色
jl.setOpaque(true);
jl.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl01){
jl01.setOpaque(true);
jl01.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl1){//基本资料列表变颜色
jl1.setOpaque(true);
jl1.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl11){
jl11.setOpaque(true);
jl11.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl2){//仓库作业列表变颜色
jl2.setOpaque(true);
jl2.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl21){
jl21.setOpaque(true);
jl21.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl22){
jl22.setOpaque(true);
jl22.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl3){//报表管理列表变颜色
jl3.setOpaque(true);
jl3.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl31){
jl31.setOpaque(true);
jl31.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl32){
jl32.setOpaque(true);
jl32.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl33){
jl33.setOpaque(true);
jl33.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl34){
jl34.setOpaque(true);
jl34.setBackground(new Color(105,105,105));
}
if(e.getSource()==jl35){
jl35.setOpaque(true);
jl35.setBackground(new Color(105,105,105));
}
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==jl){//系统设置颜色变回去
jl.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl01){
jl01.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl1){//基本资料颜色变回去
jl1.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl11){
jl11.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl2){//仓库作业列表颜色变回去
jl2.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl21){
jl21.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl22){
jl22.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl3){//报表管理列表颜色变回去
jl3.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl31){
jl31.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl32){
jl32.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl33){
jl33.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl34){
jl34.setBackground(new Color(49,79,79));
}
if(e.getSource()==jl35){
jl35.setBackground(new Color(49,79,79));
}
}
public void jl(){//系统设置弹出列表
if(i%2==1){
b=true;
if(c==true){
change1=change+cang*2;
if(d==true){
if(e==true){
jl1.setBounds(0,change1,width,height);
jl11.setBounds(hang,change1+height,kuang,cang);
jl2.setBounds(0,change1+height+cang,width,height);
jl21.setBounds(hang,change1+height*2+cang,kuang,cang);
jl22.setBounds(hang,change1+height*2+cang*2,kuang,cang);
jl3.setBounds(0,change1+height*2+cang*3,width,height);
jl31.setBounds(hang,change1+height*3+cang*3,kuang,cang);
jl32.setBounds(hang,change1+height*3+cang*4,kuang,cang);
jl33.setBounds(hang,change1+height*3+cang*5,kuang,cang);
jl34.setBounds(hang,change1+height*3+cang*6,kuang,cang);
jl35.setBounds(hang,change1+height*3+cang*7,kuang,cang);
}
else if(e==false){
jl1.setBounds(0,change1,width,height);
jl11.setBounds(hang,change1+height,kuang,cang);
jl2.setBounds(0,change1+height+cang,width,height);
jl21.setBounds(hang,change1+height*2+cang,kuang,cang);
jl22.setBounds(hang,change1+height*2+cang*2,kuang,cang);
jl3.setBounds(0,change1+height*2+cang*3,width,height);
}
}
else if(d==false){
if(e==true){
jl1.setBounds(0,change1,width,height);
jl11.setBounds(hang,change1+height,kuang,cang);
jl2.setBounds(0,change1+height+cang,width,height);
jl3.setBounds(0,change1+height*2+cang,width,height);
jl31.setBounds(hang,change1+height*3+cang,kuang,cang);
jl32.setBounds(hang,change1+height*3+cang*2,kuang,cang);
jl33.setBounds(hang,change1+height*3+cang*3,kuang,cang);
jl34.setBounds(hang,change1+height*3+cang*4,kuang,cang);
jl35.setBounds(hang,change1+height*3+cang*5,kuang,cang);
}
else if(e==false){
jl1.setBounds(0,change1,width,height);
jl11.setBounds(hang,change1+height,kuang,cang);
jl2.setBounds(0,change1+height+cang,width,height);
jl3.setBounds(0,change1+height*2+cang,width,height);
}
}
}
else if(c==false){
change1=change+cang;
if(d==true){
if(e==true){
jl1.setBounds(0,change1+cang,width,height);
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
jl31.setBounds(hang,change1+cang*6,kuang,cang);
jl32.setBounds(hang,change1+cang*7,kuang,cang);
jl33.setBounds(hang,change1+cang*8,kuang,cang);
jl34.setBounds(hang,change1+cang*9,kuang,cang);
jl35.setBounds(hang,change1+cang*10,kuang,cang);
}
else if(e==false){
jl1.setBounds(0,change1+cang,width,height);
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
}
}
else if(d==false){
if(e==true){
jl1.setBounds(0,change1+cang,width,height);
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
jl1.setBounds(0,change1+cang,width,height);
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
}
}
}
jl01.setVisible(b);
}
else{
b=false;
if(c==true){
change1=change+cang;
if(d==true){
if(e==true){
jl1.setBounds(0,change1,width,height);
jl11.setBounds(hang,change1+cang,kuang,cang);
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
jl31.setBounds(hang,change1+cang*6,kuang,cang);
jl32.setBounds(hang,change1+cang*7,kuang,cang);
jl33.setBounds(hang,change1+cang*8,kuang,cang);
jl34.setBounds(hang,change1+cang*9,kuang,cang);
jl35.setBounds(hang,change1+cang*10,kuang,cang);
}
else if(e==false){
jl1.setBounds(0,change1,width,height);
jl11.setBounds(hang,change1+cang,kuang,cang);
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
}
}
else if(d==false){
if(e==true){
jl1.setBounds(0,change1,width,height);
jl11.setBounds(hang,change1+cang,kuang,cang);
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
jl1.setBounds(0,change1,width,height);
jl11.setBounds(hang,change1+cang,kuang,cang);
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
}
}
}
else if(c==false){
change1=change;
if(d==true){
if(e==true){
jl1.setBounds(0,change1+cang,width,height);
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
jl31.setBounds(hang,change1+cang*6,kuang,cang);
jl32.setBounds(hang,change1+cang*7,kuang,cang);
jl33.setBounds(hang,change1+cang*8,kuang,cang);
jl34.setBounds(hang,change1+cang*9,kuang,cang);
jl35.setBounds(hang,change1+cang*10,kuang,cang);
}
else if(e==false){
jl1.setBounds(0,change1+cang,width,height);
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
}
}
else if(d==false){
if(e==true){
jl1.setBounds(0,change1+cang,width,height);
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
jl1.setBounds(0,change1+cang,width,height);
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
}
}
}
}
jl01.setVisible(b);
i++;
}
public void jl1(){//基本资料弹出列表
if(o%2==1){
c=true;
if(b==true){
change1=change+cang*2;
if(d==true){
if(e==true){
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
jl31.setBounds(hang,change1+cang*6,kuang,cang);
jl32.setBounds(hang,change1+cang*7,kuang,cang);
jl33.setBounds(hang,change1+cang*8,kuang,cang);
jl34.setBounds(hang,change1+cang*9,kuang,cang);
jl35.setBounds(hang,change1+cang*10,kuang,cang);
}
else if(e==false){
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
}
}
else if(d==false){
if(e==true){
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
}
}
jl11.setBounds(hang,change1+cang,kuang,cang);
jl11.setVisible(c);
}
else if(b==false){
change1=change+cang;
if(d==true){
if(e==true){
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
jl31.setBounds(hang,change1+cang*6,kuang,cang);
jl32.setBounds(hang,change1+cang*7,kuang,cang);
jl33.setBounds(hang,change1+cang*8,kuang,cang);
jl34.setBounds(hang,change1+cang*9,kuang,cang);
jl35.setBounds(hang,change1+cang*10,kuang,cang);
}
else if(e==false){
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
}
}
else if(d==false){
if(e==true){
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
}
}
jl11.setBounds(hang,change1+cang,kuang,cang);
jl11.setVisible(c);
}
}
else{
c=false;
if(b==true){
change1=change+cang;
if(d==true){
if(e==true){
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
jl31.setBounds(hang,change1+cang*6,kuang,cang);
jl32.setBounds(hang,change1+cang*7,kuang,cang);
jl33.setBounds(hang,change1+cang*8,kuang,cang);
jl34.setBounds(hang,change1+cang*9,kuang,cang);
jl35.setBounds(hang,change1+cang*10,kuang,cang);
}
else if(e==false){
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
}
}
else if(d==false){
if(e==true){
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
}
}
jl11.setBounds(hang,change1+cang,kuang,cang);
jl11.setVisible(c);
}
else if(b==false){
change1=change;
if(d==true){
if(e==true){
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
jl31.setBounds(hang,change1+cang*6,kuang,cang);
jl32.setBounds(hang,change1+cang*7,kuang,cang);
jl33.setBounds(hang,change1+cang*8,kuang,cang);
jl34.setBounds(hang,change1+cang*9,kuang,cang);
jl35.setBounds(hang,change1+cang*10,kuang,cang);
}
else if(e==false){
jl2.setBounds(0,change1+cang*2,width,height);
jl21.setBounds(hang,change1+cang*3,kuang,cang);
jl22.setBounds(hang,change1+cang*4,kuang,cang);
jl3.setBounds(0,change1+cang*5,width,height);
}
}
else if(d==false){
if(e==true){
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
jl2.setBounds(0,change1+cang*2,width,height);
jl3.setBounds(0,change1+cang*3,width,height);
}
}
jl11.setVisible(c);
}
}
o++;
}
public void jl2(){//仓库作业弹出列表
if(p%2==1){
d=true;
if(b==true){
if(c==true){
if(e==true){
change1=change+cang*4;
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
change1=change+cang*4;
}
}
else if(c==false){
if(e==true){
change1=change+cang*3;
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
change1=change+cang*3;
}
}
}
else if(b==false){
if(c==true){
if(e==true){
change1=change+cang*3;
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
change1=change+cang*3;
}
}
else if(c==false){
if(e==true){
change1=change+cang*2;
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
change1=change+cang*2;
}
}
}
jl21.setBounds(hang,change1+cang,kuang,cang);
jl22.setBounds(hang,change1+cang*2,kuang,cang);
jl3.setBounds(0,change1+cang*3,width,cang);
jl21.setVisible(d);
jl22.setVisible(d);
}
else{
d=false;
if(b==true){
if(c==true){
if(e==true){
change1=change+cang*2;
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
change1=change+cang*2;
}
}
else if(c==false){
if(e==true){
change1=change+cang;
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
change1=change+cang;
}
}
}
else if(b==false){
if(c==true){
if(e==true){
change1=change+cang;
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
change1=change+cang;
}
}
else if(c==false){
if(e==true){
change1=change;
jl31.setBounds(hang,change1+cang*4,kuang,cang);
jl32.setBounds(hang,change1+cang*5,kuang,cang);
jl33.setBounds(hang,change1+cang*6,kuang,cang);
jl34.setBounds(hang,change1+cang*7,kuang,cang);
jl35.setBounds(hang,change1+cang*8,kuang,cang);
}
else if(e==false){
change1=change;
}
}
}
jl21.setBounds(hang,change1+cang,kuang,cang);
jl22.setBounds(hang,change1+cang*2,kuang,cang);
jl3.setBounds(0,change1+cang*3,width,cang);
jl21.setVisible(d);
jl22.setVisible(d);
}
p++;
}
public void jl3(){//报表管理弹出列表
if(q%2==1){
e=true;
if(b==true){
if(c==true){
if(d==true){
change1=change+cang*8;
}
else if(d==false){
change1=change+cang*6;
}
}
else if(c==false){
if(d==true){
change1=change+cang*7;
}
else if(d==false){
change1=change+cang*5;
}
}
}
else if(b==false){
if(c==true){
if(d==true){
change1=change+cang*7;
}
else if(d==false){
change1=change+cang*5;
}
}
else if(c==false){
if(d==true){
change1=change+cang*6;
}
else if(d==false){
change1=change+cang*4;
}
}
}
jl31.setBounds(hang,change1,kuang,cang);
jl32.setBounds(hang,change1+cang,kuang,cang);
jl33.setBounds(hang,change1+cang*2,kuang,cang);
jl34.setBounds(hang,change1+cang*3,kuang,cang);
jl35.setBounds(hang,change1+cang*4,kuang,cang);
jl31.setVisible(e);
jl32.setVisible(e);
jl33.setVisible(e);
jl34.setVisible(e);
jl35.setVisible(e);
q++;
}
else{
e=false;
jl31.setVisible(e);
jl32.setVisible(e);
jl33.setVisible(e);
jl34.setVisible(e);
jl35.setVisible(e);
q++;
}
}
}
这是滑动条用的
package a;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Rectangle;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
import javax.swing.plaf.basic.BasicArrowButton;
import javax.swing.plaf.basic.BasicScrollBarUI;
public class Slider extends BasicScrollBarUI{
private Color frameColor=new Color(145,105,55);
public Dimension getPreferredSize(JComponent c){
return new Dimension(16,16);
}
//重新绘制滑块
public void paintThumb(Graphics g,JComponent c,Rectangle thumbBounds){
super.paintThumb(g, c, thumbBounds);
g.translate(thumbBounds.x,thumbBounds.y);
Graphics2D g2=(Graphics2D) g;
GradientPaint gp=null;
if(this.scrollbar.getOrientation()==JScrollBar.VERTICAL){
gp=new GradientPaint(0,0,new Color(242,222,198),thumbBounds.width ,0,new Color(207,190,164));
}
if(this.scrollbar.getOrientation()==JScrollBar.HORIZONTAL ){
gp=new GradientPaint(0,0,new Color(242,222,198),thumbBounds.height ,0,new Color(207,190,164));
}
g2.setPaint(gp);
g2.fillRoundRect(0, 0, thumbBounds.width-1, thumbBounds.height-1, 5, 5);
g2.setColor(frameColor);
g2.drawRoundRect(0, 0, thumbBounds.width-1, thumbBounds.height-1, 5, 5);
}
//重新绘制滑块背景
public void paintTrack(Graphics g,JComponent c,Rectangle trackBounds){
Graphics2D g2=(Graphics2D) g;
GradientPaint gp=null;
if(this.scrollbar.getOrientation()==JScrollBar.VERTICAL){
gp=new GradientPaint(0,0,new Color(198,178,151),trackBounds.width ,0,new Color(234,214,190));
}
if(this.scrollbar.getOrientation()==JScrollBar.HORIZONTAL ){
gp=new GradientPaint(0,0,new Color(198,178,151),trackBounds.height ,0,new Color(234,214,190));
}
g2.setPaint(gp);
g2.fillRect(trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height);
g2.setColor(new Color(175,155,95));
g2.drawRect(trackBounds.x, trackBounds.y, trackBounds.width-1, trackBounds.height-1);
if(trackHighlight==BasicScrollBarUI.DECREASE_HIGHLIGHT)
this.paintDecreaseHighlight(g);
if(trackHighlight==BasicScrollBarUI.INCREASE_HIGHLIGHT)
this.paintDecreaseHighlight(g);
}
//重新绘制鼠标点击滑动到向上或向左按钮之间的区域
protected void paintDecreaseHighlight(Graphics g){
g.setColor(Color.green);
int x=this.getTrackBounds().x;
int y=this.getTrackBounds().y;
int w=0,h=0;
if(this.scrollbar.getOrientation()==JScrollBar.VERTICAL){
w=this.getThumbBounds().width;
h=this.getThumbBounds().y-y;
}
if(this.scrollbar.getOrientation()==JScrollBar.HORIZONTAL){
w=this.getThumbBounds().x-x;
h=this.getThumbBounds().height;
}
g.fillRect(x, y, w, h);
}
//重新绘制鼠标点击滑块向下或向右按钮之间的区域
protected void paintIncreaseHighlight(Graphics g){
Insets insets=scrollbar.getInsets();
g.setColor(Color.blue);
int x=this.getThumbBounds().x;
int y=this.getThumbBounds().y;
int w=this.getThumbBounds().width;
int h=this.getThumbBounds().height;
g.fillRect(x, y, w, h);
}
protected JButton createIncreaseButton(int orientation){
return new BasicArrowButton(orientation){
public void paintTriangle(Graphics g,int x, int y ,int size, int direction,boolean isEnabled){
Graphics2D g2=(Graphics2D) g;
GradientPaint gp=null;
//Image arrowImg=null;
switch(this.getDirection()){
case BasicArrowButton.SOUTH:
gp=new GradientPaint(0,0,new Color(242,222,198),getWidth(),0,new Color(207,190,164));
// arrowImg=ImageLoader.get("south.gif");
break;
case BasicArrowButton.EAST:
gp=new GradientPaint(0,0,new Color(242,222,198),getWidth(),0,new Color(207,190,164));
// arrowImg=ImageLoader.get("east.gif");
break;
}
g2.setPaint(gp);
g2.fillRect(0, 0, getWidth(), getHeight());
g2.setColor(frameColor);
g2.drawRect(0, 0, getWidth()-1, getHeight()-1);
}
};
}
protected JButton createDecreaseButton(int orientation){
return new BasicArrowButton(orientation){
public void paintTriangle(Graphics g,int x, int y ,int size, int direction,boolean isEnabled){
Graphics2D g2=(Graphics2D) g;
GradientPaint gp=null;
//Image arrowImg=null;
switch(this.getDirection()){
case BasicArrowButton.NORTH :
gp=new GradientPaint(0,0,new Color(242,222,198),getWidth(),0,new Color(207,190,164));
// arrowImg=ImageLoader.get("south.gif");
break;
case BasicArrowButton.WEST:
gp=new GradientPaint(0,0,new Color(242,222,198),getWidth(),0,new Color(207,190,164));
// arrowImg=ImageLoader.get("east.gif");
break;
}
g2.setPaint(gp);
g2.fillRect(0, 0, getWidth(), getHeight());
g2.setColor(frameColor);
g2.drawRect(0, 0, getWidth()-1, getHeight()-1);
}
};
}
}