⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pictureinspecture.java

📁 农业银行ATM对帐查询系统后台类包的源代码,实现了FTP,数据库管理等等功能
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
    JList theList = null;    theList = (JList)e.getSource();    if (theList.isSelectionEmpty()) {      mainMap=this.getImage(this.getCodeBase(),"image/imgmain.jpg").getScaledInstance(697, 512,Image.SCALE_DEFAULT);    }    else{      int index = theList.getSelectedIndex();      in = index;      actionPower = Integer.parseInt(vActPower.elementAt(in).toString());      mainMap=this.getImage(this.getCodeBase(),"image/"+(String)ListMap.elementAt(index)).getScaledInstance(697, 512,Image.SCALE_DEFAULT);      AreaId = ListId.elementAt(index).toString().trim();      if(actionPower>1){        atm.setVisible(true);        atmNew.setVisible(true);      }      else{        atm.setVisible(false);        atmNew.setVisible(false);      }      viewATM(index);      start.setEnabled(true);    }  } */  void jTree1_mouseClicked(MouseEvent exp){    stop.setEnabled(false);    if(timer!=null){      timer.stop();    }    DefaultMutableTreeNode node = (DefaultMutableTreeNode)jTree1.getLastSelectedPathComponent();    if(node!=null && !branchname.equals(node.toString())){      branchname = node.toString() ;      //System.out.println(node.toString()) ;      for(int i=0;i<vBranchName.size() ;i++){        if(vBranchName.elementAt(i).equals(branchname)){          branchcode = vBranchCode.elementAt(i).toString() ;          if(branchcode.length()==4){            String tmpcode = branchcode.substring(0,2) ;            for(int j=0 ;j<vBranchCode.size();j++){              if(vBranchCode.elementAt(j).equals(tmpcode))                branchmap = vBranchDes.elementAt(j).toString() ;            }          }          else{            branchmap = vBranchDes.elementAt(i).toString() ;          }          if(User.length()==4 || node.equals("95599")){          }          else{            actionPower=2;            //atm.setVisible(true);            //atmNew.setVisible(true);          }          if(branchcode.length()==4)            AreaId=branchcode.substring(0,2);          else            AreaId=branchcode;        }      }      //test:System.out.println("actionPower:"+actionPower) ;      if(User.length()==4 || branchcode.equals("95599")){      }      else{        actionPower=2;        atm.setVisible(true);        atmNew.setVisible(true);      }      //System.out.println(branchcode + branchmap) ;      mainMap=this.getImage(this.getCodeBase(),"image/"+branchmap).getScaledInstance(627, 512,Image.SCALE_DEFAULT);      //test:System.out.println("branchcode:"+branchcode) ;      viewATM(branchcode);      start.setEnabled(true);    }  }  public void viewATM(String index){    //test:System.out.println("viewATM index:"+index) ;      int count = jPanel1.getComponentCount();      for(int i=0;i<count;i++){        jPanel1.remove(jPanel1.getComponent(0));      }      //取出所有设备并显示      AtmMap am = new AtmMap(dbDriver,connstr,username,pass);      Image tempLamp=null;      int status=0;//设备状态      vStatus.removeAllElements();      am.getAllAtm(index);      AtmId = am.getAllAtmId();      AtmX = am.getAllAtmX();      AtmY = am.getAllAtmY();      AtmStatus as = new AtmStatus(dbDriver,connstr,username,pass);      as.AtmStatus(AtmId);      vStatus = as.getAtmStatus();      //:test:System.out.println("size:"+AtmId.size());      for(int j=0;j<vStatus.size();j++){        int x = Integer.parseInt(AtmX.elementAt(j).toString());        int y = Integer.parseInt(AtmY.elementAt(j).toString());        JLabel labelNew = null;        status = Integer.parseInt(vStatus.elementAt(j).toString());        switch(status){          case 0:tempLamp = this.getImage(this.getCodeBase(),"image/img1.gif");break;          case 1:tempLamp = this.getImage(this.getCodeBase(),"image/img2.gif");break;          case 2:tempLamp = this.getImage(this.getCodeBase(),"image/img3.gif");break;          case 3:tempLamp = this.getImage(this.getCodeBase(),"image/img4.gif");break;          case 4:tempLamp = this.getImage(this.getCodeBase(),"image/img5.gif");break;          case 5:tempLamp = this.getImage(this.getCodeBase(),"image/img6.gif");break;          case 6:tempLamp = this.getImage(this.getCodeBase(),"image/img7.gif");break;          case 7:tempLamp = this.getImage(this.getCodeBase(),"image/img8.gif");break;          default:tempLamp = this.getImage(this.getCodeBase(),"image/imgadd.gif");break;        }        labelNew = getLabelFromUrl(tempLamp);        labelNew.setName(AtmId.elementAt(j).toString().trim());        addNewLamp(labelNew,tempLamp,new Point(x,y));      }      statuLen=1;      jPanelChart.removeAll() ;      int size = vStatus.size() ;      int stu0=0,stu1=0,stu2=0,stu3=0,stu4=0,stu5=0,stu6=0,stu7=0;      for(int i=0;i<size;i++){        if(vStatus.elementAt(i).equals("0")) stu0=stu0+1;        else if(vStatus.elementAt(i).equals("1")) stu1=stu1+1;        else if(vStatus.elementAt(i).equals("2")) stu2=stu2+1;        else if(vStatus.elementAt(i).equals("3")) stu3=stu3+1;        else if(vStatus.elementAt(i).equals("4")) stu4=stu4+1;        else if(vStatus.elementAt(i).equals("5")) stu5=stu5+1;        else if(vStatus.elementAt(i).equals("6")) stu6=stu6+1;        else  stu7=stu7+1;      }      if(stu0>0){        int length=0 ;        double ftmp = stu0*100.00/size;        Float ft = new Float(ftmp);        length = (int)(ftmp*6.3);        String tmp="";        if(ft.toString().length()>5)          tmp = ft.toString().substring(0,4);        else          tmp = ft.toString() ;        String strtmp="正常状态:"+tmp+"%" ;        JLabel label = createColoredLabel(tmp+"%",Color.green.darker(),statuLen,length,strtmp);        jPanelChart.add(label);        statuLen = length;        //contentPane.add(jPanelChart,null);      }      if(stu1>0){        double ftmp = stu1*100.00/size;        int length = (int)(ftmp*6.3);        Float ft = new Float(ftmp);        String tmp="";        if(ft.toString().length()>5)          tmp = ft.toString().substring(0,4);        else          tmp = ft.toString() ;        String strtmp="暂停服务:"+tmp+"%" ;        JLabel label = createColoredLabel(tmp+"%",Color.red,statuLen,length,strtmp);        jPanelChart.add(label);        statuLen = statuLen+length;        //contentPane.add(jPanelChart,null);      }      if(stu2>0){        double ftmp= stu2*100.00/size;        int length = (int)(ftmp*6.3);        Float ft = new Float(ftmp);        String tmp="";        if(ft.toString().length()>5)          tmp = ft.toString().substring(0,4);        else          tmp = ft.toString() ;        String strtmp="警告状态:"+tmp+"%" ;        JLabel label = createColoredLabel(tmp+"%",Color.pink,statuLen,length,strtmp);        jPanelChart.add(label);        statuLen = statuLen+length;        //contentPane.add(jPanelChart,null);      }      if(stu3>0){        double ftmp = stu3*100.00/size;        int length = (int)(ftmp*6.3);        Float ft = new Float(ftmp);        String tmp="";        if(ft.toString().length()>5)          tmp = ft.toString().substring(0,4);        else          tmp = ft.toString() ;        String strtmp="管理员模式:"+tmp+"%" ;        JLabel label = createColoredLabel(tmp+"%",Color.orange,statuLen,length,strtmp);        jPanelChart.add(label);        statuLen = statuLen+length;        //contentPane.add(jPanelChart,null);      }      if(stu4>0){        double ftmp = stu4*100.00/size;        int length = (int)(ftmp*6.3);        Float ft = new Float(ftmp);        String tmp="";        if(ft.toString().length()>5)          tmp = ft.toString().substring(0,4);        else          tmp = ft.toString() ;        String strtmp="关机状态:"+tmp+"%" ;        JLabel label = createColoredLabel(tmp+"%",Color.black ,statuLen,length,strtmp);        jPanelChart.add(label);        statuLen = statuLen+length;        //contentPane.add(jPanelChart,null);      }      if(stu5>0){        double ftmp = stu5*100.00/size;        int length = (int)(ftmp*6.3);        Float ft = new Float(ftmp);        String tmp="";        if(ft.toString().length()>5)          tmp = ft.toString().substring(0,4);        else          tmp = ft.toString() ;        String strtmp="脱机状态:"+tmp+"%" ;        JLabel label = createColoredLabel(tmp+"%",Color.magenta,statuLen,length,strtmp);        jPanelChart.add(label);        statuLen = statuLen+length;        //contentPane.add(jPanelChart,null);      }      if(stu6>0){        double ftmp = stu6*100.00/size;        int length = (int)(ftmp*6.3);        Float ft = new Float(ftmp);        String tmp="";        if(ft.toString().length()>5)          tmp = ft.toString().substring(0,4);        else          tmp = ft.toString() ;        String strtmp="未开通:"+tmp+"%" ;        JLabel label = createColoredLabel(tmp+"%",Color.blue,statuLen,length,strtmp);        jPanelChart.add(label);        statuLen = statuLen+length;        //contentPane.add(jPanelChart,null);      }      if(stu7>0){        double ftmp = stu7*100.00/size;        int length = (int)(ftmp*6.3);        Float ft = new Float(ftmp);        String tmp="";        if(ft.toString().length()>5)          tmp = ft.toString().substring(0,4);        else          tmp = ft.toString() ;        String strtmp="未知状态:"+tmp+"%" ;        JLabel label = createColoredLabel(tmp+"%",Color.white,statuLen,length,strtmp);        jPanelChart.add(label);        statuLen = statuLen+length;        //contentPane.add(jPanelChart,null);      }      if(stu0==0&&stu1==0&&stu2==0&&stu3==0&&stu4==0&&stu5==0&&stu6==0&&stu7==0){        JLabel label = createColoredLabel("状态统计",Color.blue,1,630,"状态统计");        jPanelChart.add(label);      }      repaint();  }  public void viewNewATM(String index){    //test:System.out.println("viewNewATM index:"+index) ;    int count = jPanel1.getComponentCount();    int status=0;//设备状态    vStatus.removeAllElements();    Image tempLamp = null;    Vector AtmId = new Vector();    AtmMap am = new AtmMap(dbDriver,connstr,username,pass);    //am.getAllAtm(Integer.parseInt((String)ListId.elementAt(index)));    am.getAllAtm(index);    AtmId = am.getAllAtmId();    AtmStatus as = new AtmStatus(dbDriver,connstr,username,pass);    as.AtmStatus(AtmId);    vStatus = as.getAtmStatus();    URL codebase = getCodeBase();    for(int i=0;i<count;i++){      JLabel labelNew = null;      status = Integer.parseInt(vStatus.elementAt(i).toString());      switch(status){        case 0:tempLamp = getImage(codebase,"image/img1.gif");break;        case 1:tempLamp = getImage(codebase,"image/img2.gif");break;        case 2:tempLamp = getImage(codebase,"image/img3.gif");break;        case 3:tempLamp = getImage(codebase,"image/img4.gif");break;        case 4:tempLamp = getImage(codebase,"image/img5.gif");break;        case 5:tempLamp = getImage(codebase,"image/img6.gif");break;        case 6:tempLamp = getImage(codebase,"image/img7.gif");break;        case 7:tempLamp = getImage(codebase,"image/img8.gif");break;        default:tempLamp = getImage(codebase,"image/imgadd.gif");break;      }      for(int j=0;j<count;j++){        if(((JLabel)jPanel1.getComponent(j)).getName().equals(AtmId.elementAt(i).toString()))          ((JLabel)jPanel1.getComponent(j)).setIcon(new ImageIcon(tempLamp));      }      jPanel1.getComponent(i).repaint();    }  }  //create color label  private JLabel createColoredLabel(String text,Color color,int len,int length,String tooltip) {    JLabel label = new JLabel(tooltip);    label.setVerticalAlignment(JLabel.TOP);    label.setHorizontalAlignment(JLabel.CENTER);    label.setOpaque(true);    label.setBackground(color);    label.setForeground(Color.white);    label.setBounds(len,1, length, 16);    //label.setToolTipText(tooltip);    return label;  }  //method createNodes to add nodes to the tree}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -