dangsn
2024-12-26 4e9ff2ce6a830bb2340d7c8612c72eea0c5a553e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.vci.client.logon.client;
 
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.net.URL;
 
import javax.swing.ImageIcon;
 
import com.vci.client.common.ConfigUtils;
import com.vci.client.ui.swing.components.VCIJPanel;
 
public class TopBannerPanel extends VCIJPanel {
 
    /**
     * 
     */
    private static final long serialVersionUID = 7310405974513397099L;
    private String imageName = ConfigUtils.getConfigValue("top.logon.image.name");
    private URL imgUrl = null;
    private Image bgImage = null;
    private boolean imageLoaded = false;
    public TopBannerPanel(){
        if(!imageLoaded && imageName != null && !imageName.equals("")){
            imgUrl = LogonPanel.class.getResource(imageName);
            bgImage = new ImageIcon(imgUrl).getImage();
            imageLoaded = true;
        }
        if(bgImage != null){
            setPreferredSize(new Dimension(getWidth(), bgImage.getHeight(null)));
        }
    }
    protected void paintComponent(Graphics g)
    {
        if(bgImage != null){
            g.drawImage(bgImage, bgImage.getWidth(null), 0, getWidth(), getHeight(), bgImage.getWidth(null) - 1, 0, bgImage.getWidth(null), getHeight(), null);
            g.drawImage(bgImage, 0, 0, null);
        }
        if(isShowSecretLevel()){
            Font font = new Font("宋体", Font.BOLD, 50);
            g.setFont(font);
            g.setColor(Color.RED);
            g.drawString("("+getSecretLevelName()+")", 375, 75);
        }
    }
    
    private boolean secretLevelLoaded = false;
    private boolean showSecretLevel = false;
    private String secretLevelValue = "";
    private String secretLevelName = "";
    public boolean isShowSecretLevel() {
        loadSecretLevelInfo();
        return showSecretLevel;
    }
    public void setShowSecretLevel(boolean showSecretLevel) {
        this.showSecretLevel = showSecretLevel;
    }
    public String getSecretLevelValue() {
        return secretLevelValue;
    }
    public void setSecretLevelValue(String secretLevelValue) {
        this.secretLevelValue = secretLevelValue;
    }
    public String getSecretLevelName() {
        return secretLevelName;
    }
    public void setSecretLevelName(String secretLevelName) {
        this.secretLevelName = secretLevelName;
    }
    private void loadSecretLevelInfo(){
        if(secretLevelLoaded) return;
        secretLevelLoaded = true;
        showSecretLevel = ConfigUtils.getBooleanConfigValue("secretLevel.show");
        secretLevelValue = ConfigUtils.getConfigValue("secretLevel.value");
        secretLevelName = ConfigUtils.getConfigValue("secretLevel.value." + secretLevelValue + ".name");
    }
}