<?xml version="1.0" encoding="utf-8"?><rss version="2.0">
<channel>
<title><![CDATA[天龙星健]]></title>
<link>http://blog.pfan.cn/tld5yj</link>
<description>编程爱好者博客</description>
<language>zh-cn</language>
			<item>
		<title><![CDATA[本地化，我来说]]></title>
		<link>http://blog.pfan.cn/tld5yj/54431.html</link>
		<description><![CDATA[&nbsp; &nbsp; &nbsp; &nbsp; 本地化，2009 年 10 月 26 日至今，已经和我一起四年半时间了，这些日子从坎坷到平坦再到坎坷，作为一段历程，我想我也有资格说两句，仅发自内心地想说说。


	&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; 我的本地化生涯伊始，跟着第一任组长 Michael Zhang 从零开始，慢慢接触了这个原本陌生的环境，一段时间后，基本了解了这个行业，或者说我自己，处在当前的位置渐渐清楚了需要做的东西，明白了一个本地化工程师的职责。起初的本地化只局限于 Trados，后来到了 World Server，等到 Michael 离职后，又有了 SDLX，按理说应该是有越来越充实的感觉，但随时间这么过，不但没有充实感，倒是更多了一份压抑和委身的感觉，觉得就像是在一个魔爪中。其实 Trados 被 SDL 收购前，它的开放文档格式 .ttx&nbsp;已经很符合本地化的需求，并且针对这个格式开发出来的工具已经很能符合翻译需求，或者这是一个良好的利于翻译过程的格式，这种基于 XML 的格式无论任何方面都能被轻松接受，尤其是后来我加入到针对 .ttx 格式开发自动化脚本的过程后，我已然能体会到这种格式的优越性。但随着收购的完成，SDL 将 Trados 并入到一个集成翻译环境中，这就意味着这种开放的格式慢慢地被遗弃了，即便后来又有了高版本的 .sdlxliff 开放格式，我的感觉也只认为这只是一次不疼不痒的升级，纯粹是为了升级和垄断，号称免费的 SDK 也只能被注册用户拿到，这是翻译界的事，为什么要我注册？罢了，我还就不做有关 SDL 的自动化了。


	&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; 现在，对于工具当然还是 SDL 的稍有优势，不过分，只是稍有，随着这款工具的不断升级，授权费用也越来越高，对于企业来说尚且需要衡量购买，更别说翻译了，在版权越来越被尊重的今天，盗版软件的使用越来越被行业所不齿，并且日常的本地化生产过程也因此严重受限。这种情况下，大部分本地化企业都在着手自己的本地化翻译流程化平台，基本都是基于开源翻译软件，如 OmegaT，在此基础上对功能进行扩展和完善。这样做的的坏处就是对于本地化这个行业来说，工具碎片化严重，难于制定行业规范，好处是避免了某]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2014-04-22 23:53:00</pubDate>
		</item>
				<item>
		<title><![CDATA[Python&nbsp;3&nbsp;文件重命名]]></title>
		<link>http://blog.pfan.cn/tld5yj/53692.html</link>
		<description><![CDATA[一段 Python 3&nbsp;编写的重命名脚本，仅用于文件，不包括文件夹，一般说来文件重命名更实用点儿，自己用自己的东西怎么都顺手，递归是好东西：


	import os
import re

def BatchRenameFile(string_path, string_old_name, string_new_name):  # We need three parameters, the path contains all the files you want to rename, the regular expression strings for old and new names
&nbsp;   &nbsp; re_old_name = re.compile(string_old_name)  # re object compiled for match the files whose name need to be changed
&nbsp;   &nbsp; string_contents = os.listdir(string_path)  # List all files and sub folders in current folder
&nbsp;   &nbsp; for string_content in string_contents:  # For every object
&nbsp;       &nbsp; &nbsp; &nbsp; if os.path.isdir(string_content):  # If it's a folder, enter it and execute this method in it, when finish, go back to parent folder
&nbsp;           &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; os.chdir(string_content)
&nbsp;           &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;BatchRenameFile(os.getcwd(), string_old_name, string_new_name)
&nb]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2012-08-02 17:36:00</pubDate>
		</item>
				<item>
		<title><![CDATA[本地化的征途]]></title>
		<link>http://blog.pfan.cn/tld5yj/53421.html</link>
		<description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在发这篇文章之前，我也想了多少次该不该把“本地化”加到这个编程爱好者的地盘上来，而决定把它加进来之后，又想是不是应该为它单独建一个分类，结果我都这么做了。在我进入这个行业之前，真是一无所知，进门之后发现原来也是高利润产业，并且和 IT 息息相关，虽然不是短时间内认识到，但是依旧是认识到了，我想把我对这个行业的看法说说，有同行尽可能指正一下不妥之处，毕竟我的理解不代表大众。


	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 本地化是运用各种计算机软件技术把各类可用于交流的文件格式多国语言化的一个行业：那不就是翻译吗？自从干上这个，我从未这样想过，因为身在其中，我的的确确知道我不是做翻译的，但是翻译是最重要的一个环节。本地化的最终目的就是把一种语言格式的文件翻译成其它一种或多种语言文件以使更多的人能够用自己精通的语言来学习和认知，其中最重要的就是翻译，这是本地化最核心的部分，翻译的质量决定着整个任务的成败，但是大多数情况下“翻译人员”并不是某一方面的专家，他们只懂语言而不懂要翻译的文件的背景和特殊之处，最要命的就是他们在大量的翻译任务面前需要并且只能使用快捷的计算机辅助翻译工具（CAT），而辅助工具并不能直接或者根本就不支持原始要翻译的文档的文档格式，所以在送给翻译之前，这些原始文档就需要通过某种手段转换为计算机辅助翻译工具所能处理的格式，而这些大量的多种多样的原始格式和单一的受限被支持文档格式之间就需要我们想办法转换一下，翻译前把原始文件转换为翻译工具支持的格式，翻译后再转换回原始的文件格式，正是由于原始文档的格式太多，几乎包括了所有包含可阅读信息的文件格式，所以需要有些人专注于文件格式转换方面的工作并保证转换的健康性和可靠性，而这些人就是“本地化工程师”。


	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 通常所说的本地化工程师大多数情况下是指上面提到的这些专注于文件本身和之间联系的面向机器的人，还有一种是面向人文的，也就是“排版工程师”，他们的工作在社会上各个行业都应用广泛，类似于图文设计和版式调整。如果被翻译文档是最终供人们获取信息的，比如演示文稿、网页、广告页、宣传册、书籍，或者软件界面也算，那么我们就需要排版工程师对其进行版式调整，因为把一种语]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2012-04-11 23:18:00</pubDate>
		</item>
				<item>
		<title><![CDATA[全排列]]></title>
		<link>http://blog.pfan.cn/tld5yj/52160.html</link>
		<description><![CDATA[全排列的程序似乎很基础，不过乍一想还真有点儿想不通，防止忘记，存下来作为积累吧。#include&lt;stdio.h&gt;

#define N 4

void swap(int *first, int *second)
{int temp;
&nbsp;temp = *first;
&nbsp;*first = *second;
&nbsp;*second = temp;
}

void QuanPaiLie(int array[], int start, int end)
{int current;
&nbsp;if(start &gt; end)
&nbsp;{for(current = 0; current &lt;= end; current ++) printf("%d ", array[current]);
&nbsp; printf("\n");
&nbsp;}
&nbsp;else
&nbsp;{for(current = start; current &lt;= end; current ++)
&nbsp; {swap(&amp;array[current], &amp;array[start]);
&nbsp;&nbsp; QuanPaiLie(array, start + 1, end);
&nbsp;&nbsp; swap(&amp;array[current], &amp;array[start]);
&nbsp; }
&nbsp;}
}

void main(void)
{int arraylist[N], iter;
&nbsp;printf("Please input %d numbers for test: ", N);
&nbsp;for(iter = 0; iter &lt; N; iter ++)
&nbsp; scanf("%d", &amp; arraylist[iter]);
&nbsp;printf("Now the result is:\n");
&nbsp;QuanPaiLie(arraylist, 0, N - 1);
}]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2011-01-13 22:25:00</pubDate>
		</item>
				<item>
		<title><![CDATA[C魔方矩阵]]></title>
		<link>http://blog.pfan.cn/tld5yj/38098.html</link>
		<description><![CDATA[#include&lt;stdio.h&gt;
void main(){int array[19][19],dimension,first,second,count=1;&nbsp;printf("Please input the dimension: ");&nbsp;scanf("%d",&amp;dimension);&nbsp;first=0;&nbsp;second=dimension/2;&nbsp;for(;count&lt;=dimension*dimension;count++)&nbsp;{array[first][second]=count;&nbsp; if(count%dimension!=0)&nbsp; {first=(dimension+first-1)%dimension;&nbsp;&nbsp; second=(second+1)%dimension;&nbsp; }&nbsp; else if(count%dimension==0)first=first+1;&nbsp;}&nbsp;printf("\nThe array is:\n\n");&nbsp;for(first=0;first&lt;dimension;first++)&nbsp;{for(second=0;second&lt;dimension;second++)&nbsp; {printf("%4d",array[first][second]);&nbsp; }&nbsp; printf("\n");&nbsp;}&nbsp;printf("\nEnter Key To Exit......");&nbsp;getch();}]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2008-09-04 22:46:00</pubDate>
		</item>
				<item>
		<title><![CDATA[C冒泡排序]]></title>
		<link>http://blog.pfan.cn/tld5yj/38097.html</link>
		<description><![CDATA[#include&lt;stdio.h&gt;
main(){int array[10],i,j,temp;&nbsp;printf("Please input 10 numbers to sort:\n");&nbsp;for(i=0;i&lt;10;i++)&nbsp; scanf("%d",&amp;array[i]);&nbsp;for(i=0;i&lt;9;i++)&nbsp;{for(j=i+1;j&lt;10;j++)&nbsp; {if(array[j]&lt;array[i])&nbsp;&nbsp; {temp=array[i];&nbsp;&nbsp;&nbsp; array[i]=array[j];&nbsp;&nbsp;&nbsp; array[j]=temp;&nbsp;&nbsp; }&nbsp; }&nbsp;}&nbsp;printf("The numbers after sorting are:\n");&nbsp;for(i=0;i&lt;10;i++)&nbsp; printf("%d ",array[i]);&nbsp;printf("\n");&nbsp;getch();}]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2008-09-04 22:45:00</pubDate>
		</item>
				<item>
		<title><![CDATA[布局和事件]]></title>
		<link>http://blog.pfan.cn/tld5yj/31547.html</link>
		<description><![CDATA[一个简单的布局和时间的组合程序，没什么可借鉴的的地方，只是作为曾经做过的一个标志。
import java.awt.*;import java.awt.event.*;import javax.swing.*;
public class Copy extends JFrame implements ActionListener{JPanel p1,p2;TextField t1,t2;Label l1,l2;JButton b1,b2;&nbsp;public static void main(String args[])&nbsp;{new Copy();&nbsp;}&nbsp;Copy()&nbsp;{addWindowListener(new WindowAdapter()&nbsp; {public void windowClosing(WindowEvent e)&nbsp;&nbsp; {System.exit(0);&nbsp;&nbsp; }&nbsp; });&nbsp; setLayout(new GridLayout(2,1));&nbsp; p1=new JPanel();p2=new JPanel();t1=new TextField();t2=new TextField();&nbsp; l1=new Label();l2=new Label();b1=new JButton("复制");b2=new JButton("复制");&nbsp; p1.setLayout(new BorderLayout());&nbsp; p2.setLayout(new GridLayout(3,1));&nbsp; p1.add("North",t1);p1.add("East",b1);p1.add("Center",l1);&nbsp; p2.add(t2);p2.add(l2);p2.add(b2);&nbsp; b1.addActionListener(this);b2.addActionListener(this);&nbsp; add(p1);add(p2);setVisible(true);setSize(500,400);&nbsp;}&nbsp;public void actionPerformed(ActionEvent e)]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-22 21:16:00</pubDate>
		</item>
				<item>
		<title><![CDATA[单选按钮]]></title>
		<link>http://blog.pfan.cn/tld5yj/31507.html</link>
		<description><![CDATA[最基本的单选按钮使用，见笑了。
import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Check extends JFrame implements ActionListener{JRadioButton c1,c2;ButtonGroup b;&nbsp;public static void main(String args[])&nbsp;{new Check();&nbsp;}&nbsp;public Check()&nbsp;{super("单选按钮");&nbsp; addWindowListener(new WindowAdapter()&nbsp; {public void windowClosing(WindowEvent e)&nbsp;&nbsp; {System.exit(0);&nbsp;&nbsp; }&nbsp; });&nbsp; b=new ButtonGroup();&nbsp; c1=new JRadioButton("启用",true);&nbsp; c2=new JRadioButton("禁用",false);&nbsp; b.add(c1);b.add(c2);&nbsp; c1.setEnabled(false);&nbsp; setLayout(null);add(c1);add(c2);&nbsp; c1.setBounds(60,140,60,20);c2.setBounds(180,140,60,20);&nbsp; c1.addActionListener(this);&nbsp; c2.addActionListener(this);&nbsp; setVisible(true);&nbsp; setSize(300,240);&nbsp;}&nbsp;public void actionPerformed(ActionEvent e)&nbsp;{if(e.getSource()==c2)&nbsp; {setTitle("启用第二个单选按钮");&nbsp;&nbsp; c1.setEnabled(true);c2.setEnabled(false);&nbsp; }&nbsp; else&nbsp; {s]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-20 08:38:00</pubDate>
		</item>
				<item>
		<title><![CDATA[扫描线种子填充算法]]></title>
		<link>http://blog.pfan.cn/tld5yj/31505.html</link>
		<description><![CDATA[这就是扫描线种子填充程序的C实现，运行后将出现一个多边形和一个种子，由于仅是模拟，所以初始化时固定了多边形的位置和种子的位置，可以在代码中修改其位置后重新编译运行，运行时请在main()函数里设置好图形驱动程序路径，因人而异了。
#include&lt;graphics.h&gt;#include&lt;stdio.h&gt;#include&lt;malloc.h&gt;#define bordercolor 15#define backcolor 0#define seedcolor 4#define fillcolor 10
typedef struct Point{int x;&nbsp;int y;}point;
typedef struct Stack{point *base;&nbsp;point *top;}*stack;
void initstack(stack s){(*s).base=(point*)malloc(sizeof(point));&nbsp;if(!(*s).base)exit(1);&nbsp;(*s).top=(*s).base;}
void push(stack s,point p){*((*s).top)=p;&nbsp;(*s).top++;}
int stackempty(stack s){if((*s).top==(*s).base)return(1);&nbsp;else return(0);}
point pop(stack s){(*s).top--;&nbsp;return(*((*s).top));}
void drawgraphics(){rectangle(100,100,539,299);&nbsp;rectangle(150,150,489,249);}
point produceseed(){point p;&nbsp;p.x=125;&nbsp;p.y=200;&nbsp;return(p);}
void intostack(stack s,int y0,int xl,int xr){int x,y;&nbsp;point tm;&nbsp;for(x=xl,y=y0;x&lt;=xr&amp;&amp;x&lt;getmaxx();x++)&nbsp;{if((x!=xr&]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-20 08:01:00</pubDate>
		</item>
				<item>
		<title><![CDATA[JApplet上画圆]]></title>
		<link>http://blog.pfan.cn/tld5yj/31466.html</link>
		<description><![CDATA[一个小程序，自己写一个网页文件嵌入运行就行了，不过没什么技术含量，仅作为一个学习过程加以收藏。
import java.awt.*;import java.awt.event.*;import javax.swing.*;
public class RandomClick extends JApplet{Color c;int x,y;&nbsp;public void init()&nbsp;{addMouseListener(new MouseAdapter()&nbsp; {public void mousePressed(MouseEvent e)&nbsp;&nbsp; {x=e.getX();y=e.getY();&nbsp;&nbsp;&nbsp; repaint();&nbsp;&nbsp; }&nbsp; });&nbsp;}&nbsp;public void paint(Graphics g)&nbsp;{c=new Color((int)(Math.random()*256),(int)(Math.random()*256),(int)(Math.random()*256));&nbsp;&nbsp;&nbsp; g.setColor(c);&nbsp;&nbsp;&nbsp; g.fillOval(x-10,y-10,20,20);&nbsp;}}]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-16 21:49:00</pubDate>
		</item>
				<item>
		<title><![CDATA[Java基础计算]]></title>
		<link>http://blog.pfan.cn/tld5yj/31465.html</link>
		<description><![CDATA[一个小程序，自行编写一个HTML文件嵌入运行就行了。
import java.awt.*;import java.awt.event.*;import java.applet.*;public class Add extends Applet implements ActionListener{Label ask,result;TextField answer;Button submit;int a=6,b=9;&nbsp;public static void main(String args[])&nbsp;{Add a=new Add();&nbsp; a.init();&nbsp;}&nbsp;public void init()&nbsp;{Panel p=new Panel();&nbsp; setLayout(new BorderLayout());&nbsp; p.setLayout(null);&nbsp; ask=new Label(Integer.toString(a)+"+"+Integer.toString(b));&nbsp; ask.setFont(new Font("宋体",Font.BOLD,16));&nbsp; answer=new TextField(5);&nbsp; result=new Label();&nbsp; submit=new Button("OK");&nbsp; submit.addActionListener(this);&nbsp; p.add(ask);p.add(answer);p.add(result);p.add(submit);&nbsp; ask.setBounds(50,20,70,20);answer.setBounds(160,20,70,20);&nbsp; result.setBounds(50,60,90,20);submit.setBounds(160,60,70,20);&nbsp; add("Center",p);p.setVisible(true);&nbsp;}&nbsp;public void actionPerformed(ActionEvent e)&nbsp;{try&nbsp; {if(Integer.valueOf(answer.getText())==a+]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-16 21:45:00</pubDate>
		</item>
				<item>
		<title><![CDATA[渔网]]></title>
		<link>http://blog.pfan.cn/tld5yj/31428.html</link>
		<description><![CDATA[给大家看张渔网，运行的时候请设置好图形驱动的路径。
#include &lt;graphics.h&gt;#include &lt;math.h&gt;
void ellip(int x0,int y0,int a,int b,int dt){int x,y,n,i;&nbsp;float t1,t=0;&nbsp;t1=dt*0.0174533;&nbsp;n=360/dt;&nbsp;moveto(x0+a,y0);&nbsp;for(i=1;i&lt;n;i++)&nbsp;{t=t+t1;&nbsp; x=x0+a*cos(t);&nbsp; y=y0+b*sin(t);&nbsp; lineto(x,y);&nbsp;}&nbsp;lineto(x0+a,y0);}
main(){int i,a=200,x=320,y=200;&nbsp;int driver=DETECT,mode;&nbsp;registerbgidriver(EGAVGA_driver);&nbsp;initgraph(&amp;driver,&amp;mode,"");&nbsp;cleardevice();&nbsp;setbkcolor(9);&nbsp;setcolor(4);&nbsp;for(i=0;i&lt;=200;i=i+10)&nbsp;{ellip(x,y,a-i,i,10);&nbsp;}&nbsp;getch();&nbsp;closegraph();}]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-14 22:44:00</pubDate>
		</item>
				<item>
		<title><![CDATA[C画函数曲线]]></title>
		<link>http://blog.pfan.cn/tld5yj/31427.html</link>
		<description><![CDATA[这是一个函数曲线的描绘问题，可根据注释修改程序，以画出不同的曲线。
#include&lt;graphics.h&gt;#define y(x) x*x&nbsp; /*在这里修改曲线方程，此处为x的平方*/#define xs(x) x0+x*s&nbsp; /*这里为x方向的坐标转换*/#define ys(x) y0-y(x)*s&nbsp; /*这里为y方向的坐标转换*/
main(){float x0,y0,xl,xr,s,x,dx;&nbsp;int driver=DETECT,mode;&nbsp;printf("Please input the x and y of new location:");&nbsp;scanf("%f %f",&amp;x0,&amp;y0);&nbsp; /*输入要画曲线的坐标系原点坐标*/&nbsp;printf("Please input the multiply:");&nbsp;scanf("%f",&amp;s);&nbsp; /*曲线放大倍数，以几十为效果最佳*/&nbsp;printf("Please input the left edge and the right edge and dx:");&nbsp;scanf("%f %f %f",&amp;xl,&amp;xr,&amp;dx);&nbsp; /*输入曲线的自变量上下界xl和xr以及自变量的递增步长*/&nbsp;registerbgidriver(EGAVGA_driver);&nbsp;initgraph(&amp;driver,&amp;mode,"");&nbsp;line(x0,getmaxy(),x0,0);&nbsp;line(0,y0,getmaxx(),y0);&nbsp;outtextxy(x0,y0,"0,0");&nbsp;setcolor(14);&nbsp;while(ys(xl)&lt;0)xl+=dx;&nbsp;moveto(xs(xl),ys(xl));&nbsp;for(x=xl;x&lt;=xr;x+=dx)&nbsp;{if(x&gt;xl&amp;&amp;ys(x)&gt;=0)&nbsp; {putpixel(xs(x),ys(x),14);&nbsp;&nbsp; lineto(xs(x),]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-14 22:35:00</pubDate>
		</item>
				<item>
		<title><![CDATA[C图形学中的错切演示程序]]></title>
		<link>http://blog.pfan.cn/tld5yj/31426.html</link>
		<description><![CDATA[此程序用到两个文件，一个是被调用程序affine.c，另一个是主程序cuoqie.c，在运行前请注意自己设置好图形驱动程序的路径。
affine.c如下：
double sin(),cos();double xmax=639.0,ymax=399.0;double f[3][3],xx,yy;
scx(xj)double xj;{int x;&nbsp;x=(int)(xj+xmax/2);&nbsp;return(x);}
scy(yj)double yj;{int y;&nbsp;y=(int)(ymax-(yj+(ymax/2)));&nbsp;return(y);}
parallel(dx,dy)double dx,dy;{f[0][0]=1.0;f[0][1]=0.0;f[0][2]=0.0;&nbsp;f[1][0]=0.0;f[1][1]=1.0;f[1][2]=0.0;&nbsp;f[2][0]=dx;f[2][1]=dy;f[2][2]=1.0;}
rotate(theta)double theta;{double th;&nbsp;th=theta/180*3.1415927;&nbsp;f[0][0]=cos(th);f[0][1]=sin(th);f[0][2]=0.0;f[1][0]=-sin(th);&nbsp;f[1][1]=cos(th);f[2][0]=0.0;f[2][1]=0.0;f[2][2]=1.0;}
scale(s)double s;{f[0][0]=s;f[0][1]=0.0;f[0][2]=0.0;&nbsp;f[1][0]=0.0;f[1][1]=s;f[1][2]=0.0;&nbsp;f[2][0]=0.0;f[2][1]=0.0;f[2][2]=1.0;}
taisho_x(){f[0][0]=1.0;f[0][1]=0.0;f[0][2]=0.0;&nbsp;f[1][0]=0.0;f[1][1]=-1;f[1][2]=0.0;&nbsp;f[2][0]=0.0;f[2][1]=0.0;f[2][2]=1.0;}
taisho_y(){f[0][0]=-1.0;f[0][1]=0.0;f[0][2]=0.0;&nbsp;f[1][0]=0.0;f[1][1]=1.0;f[1][2]=0.0;]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-14 22:15:00</pubDate>
		</item>
				<item>
		<title><![CDATA[Java画布画圆]]></title>
		<link>http://blog.pfan.cn/tld5yj/31425.html</link>
		<description><![CDATA[这个程序很简单，没有什么好说的了，希望大家多多指教一下,在JDK1.6下通过。
import java.awt.*;import java.awt.event.*;import java.util.*;public class Draw extends WindowAdapter implements ActionListener,WindowListener{Canvas c;TextField radius,x,y;Button b;&nbsp;public static void main(String args[])&nbsp;{Draw d=new Draw();&nbsp; Frame f=new Frame("画布画圆");&nbsp; d.c=new Canvas();&nbsp; d.x=new TextField(5);&nbsp; d.y=new TextField(5);&nbsp; d.radius=new TextField(5);&nbsp; d.b=new Button("清空画布");&nbsp; Label x1=new Label("请输入左上角x：");&nbsp; Label y1=new Label("请输入左上角y：");&nbsp; Label radius1=new Label("请输入半径：");&nbsp; Panel p=new Panel();&nbsp; f.setLayout(new BorderLayout());&nbsp; p.setLayout(new FlowLayout());&nbsp; f.add("Center",d.c);&nbsp; f.add("South",p);&nbsp; p.add(radius1);p.add(d.radius);p.add(x1);p.add(d.x);&nbsp; p.add(y1);p.add(d.y);p.add(d.b);&nbsp; d.x.addActionListener(d);&nbsp; d.y.addActionListener(d);&nbsp; d.radius.addActionListener(d);&nbsp; d.b.addActionListener(d);&nbsp; f.addWindowListener(d);&]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-14 22:07:00</pubDate>
		</item>
				<item>
		<title><![CDATA[是非程序]]></title>
		<link>http://blog.pfan.cn/tld5yj/31407.html</link>
		<description><![CDATA[此程序在JDK1.6环境下一切正常，甚至可以不添加ButtonGroup也可以使用JRadioButton，但是至少在JDK1.4中是不正确的，需要明确使用容器，在不同的版本之间已经有了语法上的不同，而且也充分体现了教学中与实际中的的确确的脱节，还是跟上时代的好啊。
import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Check extends JFrame implements ActionListener{JRadioButton c1,c2;ButtonGroup b;&nbsp;public static void main(String args[])&nbsp;{new Check();&nbsp;}&nbsp;public Check()&nbsp;{super("单选按钮");&nbsp; addWindowListener(new WindowAdapter()&nbsp; {public void windowClosing(WindowEvent e)&nbsp;&nbsp; {System.exit(0);&nbsp;&nbsp; }&nbsp; });&nbsp; b=new ButtonGroup();&nbsp; c1=new JRadioButton("启用",true);&nbsp; c2=new JRadioButton("禁用",false);&nbsp; b.add(c1);b.add(c2);&nbsp; c1.setEnabled(false);&nbsp; setLayout(null);add(c1);add(c2);&nbsp; c1.setBounds(60,140,60,20);c2.setBounds(180,140,60,20);&nbsp; c1.addActionListener(this);&nbsp; c2.addActionListener(this);&nbsp; setVisible(true);&nbsp; setSize(300,240);&nbsp;}&nbsp;public void actionPerformed(ActionEvent e)&nbsp;{if(e.getSource(]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-13 08:11:00</pubDate>
		</item>
				<item>
		<title><![CDATA[Java中Menu的简单使用]]></title>
		<link>http://blog.pfan.cn/tld5yj/31406.html</link>
		<description><![CDATA[在一个JFrame上使用Menu，Menu使用要先添加MenuBar，Menu加到MenuBar上，MenuItem加到Menu上，如此级联添加。
import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Me extends JFrame implements ActionListener{MenuBar mb;Menu m;MenuItem mi1,mi2,mi3;&nbsp;public Me()&nbsp;{addWindowListener(new WindowAdapter()&nbsp; {public void windowClosing(WindowEvent e)&nbsp;&nbsp; {System.exit(0);&nbsp;&nbsp; }&nbsp; });&nbsp; mb=new MenuBar();&nbsp; m=new Menu("文件");&nbsp; mi1=new MenuItem("功能１");&nbsp; mi2=new MenuItem("功能２");&nbsp; mi3=new MenuItem("退出");&nbsp; m.add(mi1);m.add(mi2);m.addSeparator();m.add(mi3);mb.add(m);&nbsp; mi1.addActionListener(this);&nbsp; mi2.addActionListener(this);&nbsp; mi3.addActionListener(this);&nbsp; setMenuBar(mb);&nbsp; setSize(320,240);setVisible(true);&nbsp;}&nbsp;public static void main(String args[])&nbsp;{new Me();&nbsp;}&nbsp;public void actionPerformed(ActionEvent e)&nbsp;{if(e.getSource()==mi1)setTitle("功能１");&nbsp; else if(e.getSource()==mi2)setTitle("功能２");&nbsp; else]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-13 08:02:00</pubDate>
		</item>
				<item>
		<title><![CDATA[Java中布局的简单使用]]></title>
		<link>http://blog.pfan.cn/tld5yj/31405.html</link>
		<description><![CDATA[本例是为了体现Java中布局的使用，在一个Frame上添加了两个Panel，在两个Panel上分别体现了一个Butoon，一个Label和一个TextField的边框布局和网格布局，而Frame本身使用了网格布局。
import java.awt.*;import java.awt.event.*;
class TwoLayout extends WindowAdapter implements WindowListener,ActionListener{Frame f;Panel pborder,pgrid;&nbsp;Label lborder,lgrid;TextField tborder,tgrid;Button bborder,bgrid;&nbsp;public static void main(String args[])&nbsp;{TwoLayout a=new TwoLayout();&nbsp; a.execute();&nbsp;}&nbsp;public void execute()&nbsp;{f=new Frame("布局");&nbsp; f.setLayout(new GridLayout(2,1));&nbsp; f.addWindowListener(this);&nbsp; pborder=new Panel();pgrid=new Panel();&nbsp; f.add(pborder);f.add(pgrid);&nbsp; pborder.setLayout(new BorderLayout());&nbsp; pgrid.setLayout(new GridLayout(3,1));&nbsp; lborder=new Label();tborder=new TextField();bborder=new Button("边框布局复制");&nbsp; lgrid=new Label();tgrid=new TextField();bgrid=new Button("网格布局复制");&nbsp; lborder.setBackground(Color.yellow);lgrid.setBackground(Color.yellow);&nbsp; pborder.add("East",bborder);pgri]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-13 07:58:00</pubDate>
		</item>
				<item>
		<title><![CDATA[Java中awt的简单使用]]></title>
		<link>http://blog.pfan.cn/tld5yj/31404.html</link>
		<description><![CDATA[这是Java中简单的java.awt包的使用，并且使用了监听接口，只是作为一个程序思想的展示，没有什么高深之处。
import java.awt.*;import java.awt.event.*;
class ChangeColor extends WindowAdapter implements WindowListener,ActionListener{Frame f;Button r,b,y;&nbsp;public static void main(String args[])&nbsp;{ChangeColor c=new ChangeColor();&nbsp; c.execute();&nbsp;}&nbsp;public void execute()&nbsp;{f=new Frame("改变颜色");&nbsp; f.setLayout(new FlowLayout());&nbsp; f.addWindowListener(this);&nbsp; r=new Button("红色");&nbsp; b=new Button("蓝色");&nbsp; y=new Button("黄色");&nbsp; f.add(r);f.add(b);f.add(y);&nbsp; r.addActionListener(this);&nbsp; b.addActionListener(this);&nbsp; y.addActionListener(this);&nbsp; f.setSize(400,300);f.setVisible(true);&nbsp;}&nbsp;public void windowClosing(WindowEvent e)&nbsp;{System.exit(0);&nbsp;}&nbsp;public void actionPerformed(ActionEvent e)&nbsp;{if(e.getSource()==r)f.setBackground(Color.red);&nbsp; else if(e.getSource()==b)f.setBackground(Color.blue);&nbsp; else if(e.getSource()==y)f.setBackground(Color.yellow);&]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-13 07:51:00</pubDate>
		</item>
				<item>
		<title><![CDATA[Java中接口的简单使用]]></title>
		<link>http://blog.pfan.cn/tld5yj/31403.html</link>
		<description><![CDATA[接口和C++中的抽象类差不多，是只能被实现但是不能在自身实现某种方法的一种结构，下面的程序是一个Interface的简单应用，功能是实现一个数组中几个数据的升序排序和求最大值，实际上排序后最后一个数组元素即为最大值，此处使用一个独立方法只为体现接口的用法，确有欠妥。
interface vir&nbsp; //这是一个接口，用interface关键字声明{void bigsmall(int a[]);&nbsp; //这里在接口里声明bigsmall和sort两个方法用来被实现它的类继承&nbsp;void sort(int b[]);}
class function implements vir&nbsp; //这是一个来实现上面的接口的类，即implements(实现)接口 {public void bigsmall(int c[])&nbsp; //实现接口的第一个函数，形式必须和接口中相同并且&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{int i=0,small=c[0],big=c[0];&nbsp;&nbsp;//前面要有public关键字&nbsp; for(i=1;i&lt;c.length;i++)&nbsp; {if(c[i]&lt;small)small=c[i];&nbsp;&nbsp; if(c[i]&gt;big)big=c[i];&nbsp; }&nbsp; System.out.print("The smallest number is: "+small+'\n');&nbsp; System.out.print("The biggest number is: "+big+'\n');&nbsp;}&nbsp;public void sort(int c[])&nbsp; //这是实现接口的第二个函数，形式与与上相同，带public关键字&nbsp;{int j=0,k=0,temp=0;&nbsp;&nbsp;//程序本身及算法没有什么可说之处了&nbsp; for(j=0;j&lt;4;j++)&nbsp; {for(k=j+1;k&lt;5;k++)&nbsp;&nbsp; {if(c[j]&gt;c[k])&nbsp;&nbsp;&nbsp; {temp=c[j];&nbsp;&]]></description>
		<author><![CDATA[tld5yj]]></author>
		<pubDate>2007-12-13 07:45:00</pubDate>
		</item>
		</channel>
</rss>