📄 web158_com_config.java
字号:
package web158.com;
/**
* @param 李建东
*
* 联系电话:0898-62925341
*
* 联系QQ:813751 657597 8912740
*
* 网 址:
* http://www.web156.com
* http://www.web158.com
*/
import java.awt.Font;
import java.awt.Graphics;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UIManager;
class Web158_Com_Config {
Web158_Com_Config()
{
}
//初始化字体
void initFont()
{
Font font = new Font("宋体",0,12);
UIManager.put("Label.font", font);
UIManager.put("Button.font", font);
UIManager.put("OptionPane.font", font);
UIManager.put("OptionPane.messageFont", font);
UIManager.put("OptionPane.buttonFont", font);
}
//配置参数是否完整
public boolean web_158_config_ok()
{
try
{
File web158_skin=new File("web158_com_config/info.dll");
File web158_photo=new File("web158_com_skin/nophoto.dll");
//位图资源文件存在返回正确
if(web158_skin.exists()&&web158_photo.exists())
{
//新建试题文件
File f=new File("D:/myexam/exam/");
//创建文件夹
if(!f.exists())
{
f.mkdirs();
}
return true;
}
//读取资源文件失败反回假值
else
{
return false;
}
}
catch(Exception web158_skin_no)
{
System.out.print(web158_skin_no.getMessage());
return false;
}
}
//打开技术支持
public boolean gotoWeb158_com()
{
File f=new File("C:\\Program Files\\Internet Explorer\\Iexplore.exe");
// 是XP存在
if(f.exists())
{
try{
String command = f+" http://www.web158.com";
Runtime.getRuntime().exec(command);
return true;
}//end of try
//出错返回
catch(IOException ex)
{
return false;
}
}
//不存在返回
else
{
return false;
}
}
}
//系统皮肤
//窗口背景Panel
class web158_com_getSkin extends JPanel
{
web158_com_getSkin(){
}
public void paintComponent(Graphics g)
{
int x=0;
int y=0;
ImageIcon im = new ImageIcon("web158_com_config/info.dll");
while(true)
{
g.drawImage(im.getImage(),x,y,this);
if(x>getSize().width&&y>getSize().height)
break;
if(x>getSize().width)
{
x=0;
y+=im.getIconHeight();
}
else
x+=im.getIconWidth();
}
}
}
//考生图片
class web158_com_pic extends JPanel
{
String picurl="nophoto.dll";
String name="nophoto.dll";
web158_com_pic()
{
this.setBorder(BorderFactory.createLineBorder(new Color(255,255,255)));
}
//接受外来参数
public void setPicurl(String url,String name)
{
this.picurl=url;
this.name=name;
}
public void paintComponent(Graphics g)
{
File f=new File("web158_com_skin/"+picurl);
if(!f.exists())
{
picurl="nophoto.dll";
}
int x=0;
int y=0;
try
{
ImageIcon im = new ImageIcon("web158_com_skin/"+picurl);
while(true)
{
g.drawImage(im.getImage(),x,y,this);
//如果是没有图片
if(picurl.equals("nophoto.dll"))
{
g.setColor(new Color(120,140,150));
g.drawString("华夏网建 ",im.getIconWidth()-70 , im.getIconHeight()-16);
}
else
{
g.setColor(new Color(0,0,0));
g.drawString("考生:"+name,(im.getIconWidth()-name.length())/4 , im.getIconHeight()-5);
}
if(x>getSize().width&&y>getSize().height)
break;
if(x>getSize().width)
{
x=0;
y+=im.getIconHeight();
}
else
x+=im.getIconWidth();
}
}catch(Exception ef)
{
System.out.print("出现头象错误");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -