自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(4)
  • 资源 (1)
  • 收藏
  • 关注

转载 自定义数字格式字符串

详见 http://msdn.microsoft.com/zh-cn/library/0c899ak8(v=vs.90).aspx  double value = .086;Console.WriteLine(value.ToString("#0.##%", CultureInfo.InvariantCulture));// Displays 8.6% dou

2013-07-04 14:16:45 311

转载 send a mail

******************** SmtpClient client = new SmtpClient("smtp.sina.com【邮件服务器,比如这个就是新浪邮箱的发件服务器】"); client.UseDefaultCredentials = false; client.Credentials = new System.Net.NetworkCredential("发送邮箱的用户名"

2013-07-04 14:04:47 367

转载 split()

1、用字符串分隔: using System.Text.RegularExpressions;string str="aaajsbbbjsccc";string[] sArray=Regex.Split(str,"js",RegexOptions.IgnoreCase);foreach (string i in sArray)    Response.Write(i.ToStr

2013-07-03 23:50:34 258

转载 send email with attachment

public static void CreateMessageWithAttachment(string server){ // Specify the file to be attached and sent. // This example assumes that a file named Data.xls exists in the // current working

2013-07-03 23:15:07 297

SpiderCardGame-java

java编写的蜘蛛纸牌游戏代码 import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; public class Spider extends JFrame{ //整型变量,表示难度等级为:简单 public static final int EASY = 1; //整型变量,表示难度等级为:普通 public static final int NATURAL = 2; //整型变量,表示难度等级为:难 public static final int HARD = 3; //设定初始难度等级为简单 private int grade = Spider.EASY; private Container pane = null; //生成纸牌数组 private PKCard cards[] = new PKCard[104]; private JLabel clickLabel = null; private int c = 0;//牌的数量 private int n = 0; private int a = 0; private int finish = 0; Hashtable table = null; private JLabel groundLabel[] = null; public static void main(String[] args){ Spider spider = new Spider(); spider.setVisible(true); } /** **构造函数 */ public Spider(){ setTitle("蜘蛛牌"); //关闭窗口事件(使用 System exit(0)方法,直接关闭应用程序)setDefaultCloseOperation(3) setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); //设置框架的大小 setSize(1024, 742); //生成SpiderMenuBar对象,并放置在框架之上 setJMenuBar(new SpiderMenuBar(this)); pane = this.getContentPane();//getContentPane()获得JFrame的内容面板 //设置背景颜色 pane.setBackground(new Color(0, 112, 26)); //将布局管理器设置成为null,布局管理器用于设置游戏界面的仓储式大小及时间监听程序的引入布局 pane.setLayout(null); clickLabel = new JLabel(); //setBounds(),用来设置组件的大小和位置,首先要把上一阶的布局管理器设为null,两个是组件左上角在容器中的坐标,两个是宽度和高度 clickLabel.setBounds(883, 606, 121, 96); pane.add(clickLabel); //在布局管理器中设置对鼠标时间监听程序进行初始布局 clickLabel.addMouseListener(new MouseAdapter(){ public void mouseReleased(MouseEvent me){ if (c < 60){ Spider.this.deal(); } } }); //添加纸牌 this.initCards(); this.randomCards(); this.setCardsLocation(); groundLabel = new JLabel[10]; int x = 20; //对游戏的排放位置也要布局,纸牌需要摆放10列 for (int i = 0; i < 10; i++) { groundLabel[i] = new JLabel(); //setBorder()设置组件外围的边框,使用一个EmptyBorder对象能在组件周围留出空白 groundLabel[i].setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); //纸牌位置的大小也要用setBounds进行设置 groundLabel[i].setBounds(x, 25, 71, 96); x += 101; this.pane.add(groundLabel[i]);//添加到容器 } this.setVisible(true); this.deal(); this.addKeyListener(new KeyAdapter(){ class Show extends Thread{ public void run(){ Spider.this.showEnableOperator(); } } public void keyPressed(KeyEvent e){ if (finish != 8) if (e.getKeyCode() == KeyEvent.VK_D && c < 60){ Spider.this.deal(); } else if (e.getKeyCode() == KeyEvent.VK_M){ new Show().start(); } } }); } /** **开始新游戏 */ …………………… ……………… …………………… ^-^

2011-11-22

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除