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");
|
}
|
}
|