??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲第一福利在线观看,久久一区二区三区四区五区,国产日韩成人精品http://www.aygfsteel.com/georgehill/category/1273.html希望能和您交Java~程的知识和见解zh-cnTue, 27 Feb 2007 15:53:13 GMTTue, 27 Feb 2007 15:53:13 GMT60由JComponent生成BufferedImagehttp://www.aygfsteel.com/georgehill/archive/2006/04/14/41179.htmlFri, 14 Apr 2006 15:41:00 GMThttp://www.aygfsteel.com/georgehill/archive/2006/04/14/41179.htmlhttp://www.aygfsteel.com/georgehill/comments/41179.htmlhttp://www.aygfsteel.com/georgehill/archive/2006/04/14/41179.html#Feedback0http://www.aygfsteel.com/georgehill/comments/commentRss/41179.htmlhttp://www.aygfsteel.com/georgehill/services/trackbacks/41179.html
Rectangle rect = comp.getBounds();
 BufferedImage bufImage 
= new BufferedImage(rect.width,
           rect.height,
           BufferedImage.TYPE_INT_RGB);
 Graphics g 
= bufImage.getGraphics();
 g.translate(
-rect.x, -rect.y);
 comp.paint(g);

q样QJComponent中的囑փ׃存到BufferedImage中了?br />原文的链接:http://dev.csdn.net/article/13/13531.shtm

2006-04-14 23:41 发表评论
]]>
如何BufferedImage实例保存为BMP文ghttp://www.aygfsteel.com/georgehill/archive/2005/07/04/7101.htmlMon, 04 Jul 2005 09:33:00 GMThttp://www.aygfsteel.com/georgehill/archive/2005/07/04/7101.htmlhttp://www.aygfsteel.com/georgehill/comments/7101.htmlhttp://www.aygfsteel.com/georgehill/archive/2005/07/04/7101.html#Feedback2http://www.aygfsteel.com/georgehill/comments/commentRss/7101.htmlhttp://www.aygfsteel.com/georgehill/services/trackbacks/7101.html阅读全文

2005-07-04 17:33 发表评论
]]>
关闭JBuilder2005的Smart MemberInsight功能http://www.aygfsteel.com/georgehill/archive/2005/06/15/6164.htmlWed, 15 Jun 2005 08:02:00 GMThttp://www.aygfsteel.com/georgehill/archive/2005/06/15/6164.htmlhttp://www.aygfsteel.com/georgehill/comments/6164.htmlhttp://www.aygfsteel.com/georgehill/archive/2005/06/15/6164.html#Feedback0http://www.aygfsteel.com/georgehill/comments/commentRss/6164.htmlhttp://www.aygfsteel.com/georgehill/services/trackbacks/6164.html      不过Q这实在是一个不怎么讨好的方法。因为很多时候ƈ不是只有一层方法调用的Q例如,当需要用一个方法获取一个实例,然后再用q个实例的方法获取需要的值时Q这个功能就昑־很碍手了?BR>      l于Q我q是军_关闭q个“智能”的功能。打开"Tools"—?gt;"Preferences"Q在"Editor"的子?CodeInsight"里,展开"MemberInsight"Q把"Default to Smart MemberInsight"q一去掉。如下图所C:

memberinsight.JPG

2005-06-15 16:02 发表评论
]]>
用JFreeChartL状图的范?/title><link>http://www.aygfsteel.com/georgehill/archive/2005/06/14/6123.html</link><dc:creator>米</dc:creator><author>米</author><pubDate>Tue, 14 Jun 2005 10:40:00 GMT</pubDate><guid>http://www.aygfsteel.com/georgehill/archive/2005/06/14/6123.html</guid><wfw:comment>http://www.aygfsteel.com/georgehill/comments/6123.html</wfw:comment><comments>http://www.aygfsteel.com/georgehill/archive/2005/06/14/6123.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/georgehill/comments/commentRss/6123.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/georgehill/services/trackbacks/6123.html</trackback:ping><description><![CDATA[      q个范例说明如何用JFreeChartȝ单的q图,下面是一个JSP的简单范例:<BR><BR> <DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <DIV><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000">@ page contentType</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">text/html; charset=GB2312</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000">@ page import</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">java.awt.*, java.text.*, java.util.*</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000">@ page import</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">org.jfree.chart.*</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000">@ page import</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">org.jfree.chart.axis.*</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000">@ page import</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">org.jfree.chart.labels.StandardCategoryItemLabelGenerator</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000">@ page import</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">org.jfree.chart.plot.*</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000">@ page import</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">org.jfree.chart.renderer.*</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000">@ page import</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">org.jfree.chart.servlet.ServletUtilities</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000">@ page import</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">org.jfree.data.DefaultCategoryDataset</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000">@ page import</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">org.jfree.ui.TextAnchor</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">The data for the bar chart</SPAN><SPAN style="COLOR: #008000"><BR><IMG id=Codehighlighter1_583_608_Open_Image onclick="this.style.display='none'; Codehighlighter1_583_608_Open_Text.style.display='none'; Codehighlighter1_583_608_Closed_Image.style.display='inline'; Codehighlighter1_583_608_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_583_608_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_583_608_Closed_Text.style.display='none'; Codehighlighter1_583_608_Open_Image.style.display='inline'; Codehighlighter1_583_608_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">  </SPAN><SPAN style="COLOR: #0000ff">double</SPAN><SPAN style="COLOR: #000000">[] data </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN id=Codehighlighter1_583_608_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_583_608_Open_Text><SPAN style="COLOR: #000000">{</SPAN><SPAN style="COLOR: #000000">85</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">156</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">179.5</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">211</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">123</SPAN><SPAN style="COLOR: #000000">}</SPAN></SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">The labels for the bar chart</SPAN><SPAN style="COLOR: #008000"><BR><IMG id=Codehighlighter1_664_698_Open_Image onclick="this.style.display='none'; Codehighlighter1_664_698_Open_Text.style.display='none'; Codehighlighter1_664_698_Closed_Image.style.display='inline'; Codehighlighter1_664_698_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_664_698_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_664_698_Closed_Text.style.display='none'; Codehighlighter1_664_698_Open_Image.style.display='inline'; Codehighlighter1_664_698_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">  String[] labels </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN id=Codehighlighter1_664_698_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_664_698_Open_Text><SPAN style="COLOR: #000000">{</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Mon</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Tue</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Wed</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Thu</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Fri</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">}</SPAN></SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  DefaultCategoryDataset dataset </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> DefaultCategoryDataset();<BR><IMG id=Codehighlighter1_809_861_Open_Image onclick="this.style.display='none'; Codehighlighter1_809_861_Open_Text.style.display='none'; Codehighlighter1_809_861_Closed_Image.style.display='inline'; Codehighlighter1_809_861_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_809_861_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_809_861_Closed_Text.style.display='none'; Codehighlighter1_809_861_Open_Image.style.display='inline'; Codehighlighter1_809_861_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">for</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> i </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">; i </SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000"> data.length; i</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">) </SPAN><SPAN id=Codehighlighter1_809_861_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_809_861_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    dataset.addValue(data[i], </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">, labels[i]);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  JFreeChart chart </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> ChartFactory.createBarChart3D(</SPAN><SPAN style="COLOR: #000000">"Weekly Server Load"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"Work Week 25"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"MBytes"</SPAN><SPAN style="COLOR: #000000">, dataset, PlotOrientation.VERTICAL, </SPAN><SPAN style="COLOR: #0000ff">false</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #0000ff">false</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #0000ff">false</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  chart.setBackgroundPaint(</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> Color(</SPAN><SPAN style="COLOR: #000000">0xE1E1E1</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  CategoryPlot plot </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> chart.getCategoryPlot();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 讄Y轴显C整?/SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">  NumberAxis rangeAxis </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (NumberAxis) plot.getRangeAxis();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  CategoryAxis domainAxis </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> plot.getDomainAxis();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">讄距离囄左端距离</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">  domainAxis.setLowerMargin(</SPAN><SPAN style="COLOR: #000000">0.05</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  BarRenderer3D renderer </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> BarRenderer3D();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">讄q颜色</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">  renderer.setSeriesPaint(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> Color(</SPAN><SPAN style="COLOR: #000000">0xff00</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  plot.setRenderer(renderer);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  String filename </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> ServletUtilities.saveChartAsPNG(chart, </SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">280</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">, session);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>  String graphURL </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> request.getContextPath() </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">/displayChart?filename=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> filename;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">html</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">body topmargin</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">5</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> leftmargin</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">5</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> rightmargin</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">div style</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">font-size:18pt; font-family:verdana; font-weight:bold</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    3D Bar Chart<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"></</SPAN><SPAN style="COLOR: #000000">div</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">br</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">img src</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><%= graphURL %></SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> border</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"></</SPAN><SPAN style="COLOR: #000000">body</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"></</SPAN><SPAN style="COLOR: #000000">html</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN></DIV></DIV> <P><BR>      d来的图:<BR><BR><IMG height=280 alt=displayChart.JPG src="http://www.aygfsteel.com/images/blogjava_net/georgehill/temp/displayChart.JPG" width=300 border=0><BR><BR>      和ChartDirectord来的囑ց一个比较:<BR><BR><IMG height=280 alt=threedbar.JPG src="http://www.aygfsteel.com/images/blogjava_net/georgehill/temp/threedbar.JPG" width=300 border=0><BR></P><img src ="http://www.aygfsteel.com/georgehill/aggbug/6123.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/georgehill/" target="_blank">米</a> 2005-06-14 18:40 <a href="http://www.aygfsteel.com/georgehill/archive/2005/06/14/6123.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用ChartDirector在JSP中画l计?/title><link>http://www.aygfsteel.com/georgehill/archive/2005/06/14/6118.html</link><dc:creator>米</dc:creator><author>米</author><pubDate>Tue, 14 Jun 2005 09:46:00 GMT</pubDate><guid>http://www.aygfsteel.com/georgehill/archive/2005/06/14/6118.html</guid><wfw:comment>http://www.aygfsteel.com/georgehill/comments/6118.html</wfw:comment><comments>http://www.aygfsteel.com/georgehill/archive/2005/06/14/6118.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.aygfsteel.com/georgehill/comments/commentRss/6118.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/georgehill/services/trackbacks/6118.html</trackback:ping><description><![CDATA[      以前一直是用JFreeChartȝ计图的,不过JFreeChartd来的囑Ş不够_Q看h有些模糊Q今天在|上看到另外一个工具ChartDirectorQ这是一个商业版本的工具Q不q也可以免费使用Q只是在d来的囑Ş下面都有一条它的广告条?BR>      下面是它的一个柱状图的例子:<BR><BR><IMG height=280 alt=threedbar.JPG src="http://www.aygfsteel.com/images/blogjava_net/georgehill/temp/threedbar.JPG" width=300 border=0><BR>      范例E序Q?BR><BR> <DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <DIV><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000">@page import</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">ChartDirector.*</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><%</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">The data for the bar chart</SPAN><SPAN style="COLOR: #008000"><BR><IMG id=Codehighlighter1_84_109_Open_Image onclick="this.style.display='none'; Codehighlighter1_84_109_Open_Text.style.display='none'; Codehighlighter1_84_109_Closed_Image.style.display='inline'; Codehighlighter1_84_109_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_84_109_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_84_109_Closed_Text.style.display='none'; Codehighlighter1_84_109_Open_Image.style.display='inline'; Codehighlighter1_84_109_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">double</SPAN><SPAN style="COLOR: #000000">[] data </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN id=Codehighlighter1_84_109_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_84_109_Open_Text><SPAN style="COLOR: #000000">{</SPAN><SPAN style="COLOR: #000000">85</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">156</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">179.5</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">211</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">123</SPAN><SPAN style="COLOR: #000000">}</SPAN></SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">The labels for the bar chart</SPAN><SPAN style="COLOR: #008000"><BR><IMG id=Codehighlighter1_162_196_Open_Image onclick="this.style.display='none'; Codehighlighter1_162_196_Open_Text.style.display='none'; Codehighlighter1_162_196_Closed_Image.style.display='inline'; Codehighlighter1_162_196_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_162_196_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_162_196_Closed_Text.style.display='none'; Codehighlighter1_162_196_Open_Image.style.display='inline'; Codehighlighter1_162_196_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">String[] labels </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN id=Codehighlighter1_162_196_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_162_196_Open_Text><SPAN style="COLOR: #000000">{</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Mon</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Tue</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Wed</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Thu</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Fri</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">}</SPAN></SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Create a XYChart object of size 300 x 280 pixels</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">XYChart c </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> XYChart(</SPAN><SPAN style="COLOR: #000000">300</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">280</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Set the plotarea at (45, 30) and of size 200 x 200 pixels</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">c.setPlotArea(</SPAN><SPAN style="COLOR: #000000">45</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">30</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">200</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">200</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Add a title to the chart</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">c.addTitle(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Weekly Server Load</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Add a title to the y axis</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">c.yAxis().setTitle(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">MBytes</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Add a title to the x axis</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">c.xAxis().setTitle(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Work Week 25</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Add a bar chart layer with green (0x00ff00) bars using the given data</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">c.addBarLayer(data, </SPAN><SPAN style="COLOR: #000000">0xff00</SPAN><SPAN style="COLOR: #000000">).set3D();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Set the labels on the x axis.</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">c.xAxis().setLabels(labels);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">output the chart</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">String chart1URL </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> c.makeSession(request, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">chart1</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">include tool tip for the chart</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">String imageMap1 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> c.getHTMLImageMap(</SPAN><SPAN style="COLOR: #000000">""</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">""</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">title='{xLabel}: {value} MBytes'</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    ;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">%></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">html</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">body topmargin</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">5</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> leftmargin</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">5</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> rightmargin</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">div style</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">font-size:18pt; font-family:verdana; font-weight:bold</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    3D Bar Chart<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"></</SPAN><SPAN style="COLOR: #000000">div</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">hr color</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">#000080</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">a href</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">viewsource.jsp?file=<%=request.getServletPath()%></SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    </SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">font size</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> face</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Verdana</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000">View Chart Source Code</SPAN><SPAN style="COLOR: #000000"></</SPAN><SPAN style="COLOR: #000000">font</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"></</SPAN><SPAN style="COLOR: #000000">a</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"></</SPAN><SPAN style="COLOR: #000000">div</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">br</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">img src</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000"><%=response.encodeURL("getchart.jsp?"+chart1URL)%></SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    usemap</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">#map1</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> border</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">map name</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">map1</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">><%=</SPAN><SPAN style="COLOR: #000000">imageMap1</SPAN><SPAN style="COLOR: #000000">%></</SPAN><SPAN style="COLOR: #000000">map</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"></</SPAN><SPAN style="COLOR: #000000">body</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000"></</SPAN><SPAN style="COLOR: #000000">html</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN></DIV></DIV> <P><BR>      如果要在q剙昄数|可以调用Layer的setDataLabelFormatҎ讄Q范例:layer.setDataLabelFormat("{value}");<BR><BR>      其它的例子可以参考它的文档的说明。ChartDirector的网址Q?A >http://www.advsofteng.com</A></P><img src ="http://www.aygfsteel.com/georgehill/aggbug/6118.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/georgehill/" target="_blank">米</a> 2005-06-14 17:46 <a href="http://www.aygfsteel.com/georgehill/archive/2005/06/14/6118.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用java.util.Timer定时执行dhttp://www.aygfsteel.com/georgehill/archive/2005/06/09/5793.htmlThu, 09 Jun 2005 02:29:00 GMThttp://www.aygfsteel.com/georgehill/archive/2005/06/09/5793.htmlhttp://www.aygfsteel.com/georgehill/comments/5793.htmlhttp://www.aygfsteel.com/georgehill/archive/2005/06/09/5793.html#Feedback2http://www.aygfsteel.com/georgehill/comments/commentRss/5793.htmlhttp://www.aygfsteel.com/georgehill/services/trackbacks/5793.html      下面是我的一个例子:

class Worker extends TimerTask {
  
public void run() {
    System.
out.println("我在工作啦!");
  }

}

      TimercȝscheduleҎ或者scheduleAtFixedRateҎ启动定时执行Qschedule重蝲了四个版本,scheduleAtFixedRate重蝲了两个。每个方法的实现都不同,下面是每个方法的说明Q?BR>

schedule

public void schedule(TimerTask task,
                     long delay)
Schedules the specified task for execution after the specified delay.

Parameters:
task - task to be scheduled.
delay - delay in milliseconds before task is to be executed.
Throws:
IllegalArgumentException - if delay is negative, or delay + System.currentTimeMillis() is negative.
IllegalStateException - if task was already scheduled or cancelled, or timer was cancelled.
说明Q该Ҏ会在讑֮的g时后执行一ơQ务?BR>

schedule

public void schedule(TimerTask task,
                     Date time)
Schedules the specified task for execution at the specified time. If the time is in the past, the task is scheduled for immediate execution.

Parameters:
task - task to be scheduled.
time - time at which task is to be executed.
Throws:
IllegalArgumentException - if time.getTime() is negative.
IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or timer thread terminated.
说明Q该Ҏ会在指定的时间点执行一ơQ务?BR>

schedule

public void schedule(TimerTask task,
                     long delay,
                     long period)
Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay. Subsequent executions take place at approximately regular intervals separated by the specified period.

In fixed-delay execution, each execution is scheduled relative to the actual execution time of the previous execution. If an execution is delayed for any reason (such as garbage collection or other background activity), subsequent executions will be delayed as well. In the long run, the frequency of execution will generally be slightly lower than the reciprocal of the specified period (assuming the system clock underlying Object.wait(long) is accurate).

Fixed-delay execution is appropriate for recurring activities that require "smoothness." In other words, it is appropriate for activities where it is more important to keep the frequency accurate in the short run than in the long run. This includes most animation tasks, such as blinking a cursor at regular intervals. It also includes tasks wherein regular activity is performed in response to human input, such as automatically repeating a character as long as a key is held down.

Parameters:
task - task to be scheduled.
delay - delay in milliseconds before task is to be executed.
period - time in milliseconds between successive task executions.
Throws:
IllegalArgumentException - if delay is negative, or delay + System.currentTimeMillis() is negative.
IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or timer thread terminated.
说明Q该Ҏ会在指定的g时后执行dQƈ且在讑֮的周期定时执行Q务?BR>

schedule

public void schedule(TimerTask task,
                     Date firstTime,
                     long period)
Schedules the specified task for repeated fixed-delay execution, beginning at the specified time. Subsequent executions take place at approximately regular intervals, separated by the specified period.

In fixed-delay execution, each execution is scheduled relative to the actual execution time of the previous execution. If an execution is delayed for any reason (such as garbage collection or other background activity), subsequent executions will be delayed as well. In the long run, the frequency of execution will generally be slightly lower than the reciprocal of the specified period (assuming the system clock underlying Object.wait(long) is accurate).

Fixed-delay execution is appropriate for recurring activities that require "smoothness." In other words, it is appropriate for activities where it is more important to keep the frequency accurate in the short run than in the long run. This includes most animation tasks, such as blinking a cursor at regular intervals. It also includes tasks wherein regular activity is performed in response to human input, such as automatically repeating a character as long as a key is held down.

Parameters:
task - task to be scheduled.
firstTime - First time at which task is to be executed.
period - time in milliseconds between successive task executions.
Throws:
IllegalArgumentException - if time.getTime() is negative.
IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or timer thread terminated.
说明Q该Ҏ会在指定的时间点执行dQ然后从该时间点开始,在设定的周期定时执行d。特别的Q如果设定的旉点在当前旉之前QQ务会被马上执行,然后开始按照设定的周期定时执行d?BR>

scheduleAtFixedRate

public void scheduleAtFixedRate(TimerTask task,
                                long delay,
                                long period)
Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay. Subsequent executions take place at approximately regular intervals, separated by the specified period.

In fixed-rate execution, each execution is scheduled relative to the scheduled execution time of the initial execution. If an execution is delayed for any reason (such as garbage collection or other background activity), two or more executions will occur in rapid succession to "catch up." In the long run, the frequency of execution will be exactly the reciprocal of the specified period (assuming the system clock underlying Object.wait(long) is accurate).

Fixed-rate execution is appropriate for recurring activities that are sensitive to absolute time, such as ringing a chime every hour on the hour, or running scheduled maintenance every day at a particular time. It is also appropriate for recurring activities where the total time to perform a fixed number of executions is important, such as a countdown timer that ticks once every second for ten seconds. Finally, fixed-rate execution is appropriate for scheduling multiple repeating timer tasks that must remain synchronized with respect to one another.

Parameters:
task - task to be scheduled.
delay - delay in milliseconds before task is to be executed.
period - time in milliseconds between successive task executions.
Throws:
IllegalArgumentException - if delay is negative, or delay + System.currentTimeMillis() is negative.
IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or timer thread terminated.
说明Q该Ҏ和schedule的相同参数的版本cMQ不同的是,如果该Q务因为某些原因(例如垃圾攉Q而gq执行,那么接下来的d会尽可能的快速执行,以赶上特定的旉炏V?BR>

scheduleAtFixedRate

public void scheduleAtFixedRate(TimerTask task,
                                Date firstTime,
                                long period)
Schedules the specified task for repeated fixed-rate execution, beginning at the specified time. Subsequent executions take place at approximately regular intervals, separated by the specified period.

In fixed-rate execution, each execution is scheduled relative to the scheduled execution time of the initial execution. If an execution is delayed for any reason (such as garbage collection or other background activity), two or more executions will occur in rapid succession to "catch up." In the long run, the frequency of execution will be exactly the reciprocal of the specified period (assuming the system clock underlying Object.wait(long) is accurate).

Fixed-rate execution is appropriate for recurring activities that are sensitive to absolute time, such as ringing a chime every hour on the hour, or running scheduled maintenance every day at a particular time. It is also appropriate for recurring activities where the total time to perform a fixed number of executions is important, such as a countdown timer that ticks once every second for ten seconds. Finally, fixed-rate execution is appropriate for scheduling multiple repeating timer tasks that must remain synchronized with respect to one another.

Parameters:
task - task to be scheduled.
firstTime - First time at which task is to be executed.
period - time in milliseconds between successive task executions.
Throws:
IllegalArgumentException - if time.getTime() is negative.
IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or timer thread terminated.
说明Q和上一个方法类伹{?BR>
      下面是我的一个测试片断:

  public static void main(String[] args) throws Exception {
    Timer timer 
= new Timer(false);
    timer.schedule(
new Worker(), new Date(System.currentTimeMillis() + 1000));
  }


2005-06-09 10:29 发表评论
]]>
JavaMail的简单实?/title><link>http://www.aygfsteel.com/georgehill/archive/2005/06/02/5473.html</link><dc:creator>米</dc:creator><author>米</author><pubDate>Thu, 02 Jun 2005 08:30:00 GMT</pubDate><guid>http://www.aygfsteel.com/georgehill/archive/2005/06/02/5473.html</guid><wfw:comment>http://www.aygfsteel.com/georgehill/comments/5473.html</wfw:comment><comments>http://www.aygfsteel.com/georgehill/archive/2005/06/02/5473.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.aygfsteel.com/georgehill/comments/commentRss/5473.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/georgehill/services/trackbacks/5473.html</trackback:ping><description><![CDATA[     摘要:       利用JavaMail的API可以快速的实现发送邮件的功能。下面是我用的一个简单的实例Q实C单的文本邮g的发送? import java.io.*;import java.util.*;import javax.activation.*;import javax.mail.*;...  <a href='http://www.aygfsteel.com/georgehill/archive/2005/06/02/5473.html'>阅读全文</a><img src ="http://www.aygfsteel.com/georgehill/aggbug/5473.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/georgehill/" target="_blank">米</a> 2005-06-02 16:30 <a href="http://www.aygfsteel.com/georgehill/archive/2005/06/02/5473.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何比较两个有可能ؓnull的实?/title><link>http://www.aygfsteel.com/georgehill/archive/2005/05/25/5195.html</link><dc:creator>米</dc:creator><author>米</author><pubDate>Wed, 25 May 2005 09:00:00 GMT</pubDate><guid>http://www.aygfsteel.com/georgehill/archive/2005/05/25/5195.html</guid><wfw:comment>http://www.aygfsteel.com/georgehill/comments/5195.html</wfw:comment><comments>http://www.aygfsteel.com/georgehill/archive/2005/05/25/5195.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/georgehill/comments/commentRss/5195.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/georgehill/services/trackbacks/5195.html</trackback:ping><description><![CDATA[      以前在写E序的时候,到需要比较两个有可能为null的实例时Qؓ了避免出现NullPointerExceptionQ经常用q样的一D代码来比较Q?BR><BR> <DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <DIV><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">    Object obj1 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">abc</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    Object obj2 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">cde</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> ((obj1 </SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&&</SPAN><SPAN style="COLOR: #000000"> obj2 </SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">) </SPAN><SPAN style="COLOR: #000000">||</SPAN><SPAN style="COLOR: #000000"> (obj1 </SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&&</SPAN><SPAN style="COLOR: #000000"> obj1.equals(obj2)) <BR><IMG id=Codehighlighter1_182_223_Open_Image onclick="this.style.display='none'; Codehighlighter1_182_223_Open_Text.style.display='none'; Codehighlighter1_182_223_Closed_Image.style.display='inline'; Codehighlighter1_182_223_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_182_223_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_182_223_Closed_Text.style.display='none'; Codehighlighter1_182_223_Open_Image.style.display='inline'; Codehighlighter1_182_223_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top>        </SPAN><SPAN style="COLOR: #000000">||</SPAN><SPAN style="COLOR: #000000"> (obj2 </SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&&</SPAN><SPAN style="COLOR: #000000"> obj2.equals(obj1))) </SPAN><SPAN id=Codehighlighter1_182_223_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_182_223_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>      System.</SPAN><SPAN style="COLOR: #0000ff">out</SPAN><SPAN style="COLOR: #000000">.println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">equals</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>    }</SPAN></SPAN></DIV></DIV><BR>      q样的程序,读v来真是挺拗口。我一直没有想C么好的方法解册个问题,直到今天在看到JDK的AbstractList源码的equalsҎ的实现时Q看到这一D:<BR><BR> <DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <DIV><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">(o1</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">?</SPAN><SPAN style="COLOR: #000000"> o2</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000"> : o1.equals(o2)))<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">false</SPAN><SPAN style="COLOR: #000000">;</SPAN></DIV></DIV><BR>      原来用三元运符可以很好的解册个问题,呵呵Q我前面的程序可以改写成Q?BR><BR> <DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <DIV><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">    Object obj1 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">abc</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    Object obj2 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">cde</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (obj1 </SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">?</SPAN><SPAN style="COLOR: #000000"> obj2 </SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000"> : obj1.equals(obj2))<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>      System.</SPAN><SPAN style="COLOR: #0000ff">out</SPAN><SPAN style="COLOR: #000000">.println(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">equals</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);</SPAN></DIV></DIV><BR>      真是z多了!<IMG height=20 src="http://www.aygfsteel.com/Emoticons/QQ/05.gif" width=20 border=0><img src ="http://www.aygfsteel.com/georgehill/aggbug/5195.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/georgehill/" target="_blank">米</a> 2005-05-25 17:00 <a href="http://www.aygfsteel.com/georgehill/archive/2005/05/25/5195.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>从SocketChannel对象池中获取的实例,使用时应注意的问?/title><link>http://www.aygfsteel.com/georgehill/archive/2005/05/25/5180.html</link><dc:creator>米</dc:creator><author>米</author><pubDate>Wed, 25 May 2005 07:02:00 GMT</pubDate><guid>http://www.aygfsteel.com/georgehill/archive/2005/05/25/5180.html</guid><wfw:comment>http://www.aygfsteel.com/georgehill/comments/5180.html</wfw:comment><comments>http://www.aygfsteel.com/georgehill/archive/2005/05/25/5180.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/georgehill/comments/commentRss/5180.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/georgehill/services/trackbacks/5180.html</trackback:ping><description><![CDATA[      从对象池中获取的实例Q因为ƈ不清楚该channel是否已经讄成正的状态,所以在使用时最好重新设|一遍。有以下几点需要注意:<BR>      1.在用阻塞IOӞ需要把该channel讄成阻塞的Q即需要调用SocketChannel.configureBlocking(true);<BR>      2.在用非dIOӞ需要把该channel讄成非d的,即需要调用SocketChannel.configureBlocking(false);<BR>      3.如果该channel注册了selectorQ那么在q回该实例到对象池中Q需要把注册的selector清除Q即需要调用Selector的closeҎ?BR><BR>      下面是一D应用场景的例子Q?BR><BR> <DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <DIV><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000"><IMG src="http://www.aygfsteel.com/images/dot.gif"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 把命令输?/SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">        channel.configureBlocking(</SPAN><SPAN style="COLOR: #0000ff">true</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        PrintWriter writer </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> PrintWriter(channel.socket().getOutputStream(), </SPAN><SPAN style="COLOR: #0000ff">false</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        writer.write(command.endsWith(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">) </SPAN><SPAN style="COLOR: #000000">?</SPAN><SPAN style="COLOR: #000000"> command : command </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        writer.flush();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        channel.configureBlocking(</SPAN><SPAN style="COLOR: #0000ff">false</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 创徏Selector</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">        Selector selector </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> Selector.open();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 向Selector注册我们需要的READ事g</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">        SelectionKey skey </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> channel.register(selector, SelectionKey.OP_READ);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        boolean stop </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">false</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> n </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> read </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        ByteBuffer buffer </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> ByteBuffer.allocate(</SPAN><SPAN style="COLOR: #000000">1024</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 轮询</SPAN><SPAN style="COLOR: #008000"><BR><IMG id=Codehighlighter1_637_809_Open_Image onclick="this.style.display='none'; Codehighlighter1_637_809_Open_Text.style.display='none'; Codehighlighter1_637_809_Closed_Image.style.display='inline'; Codehighlighter1_637_809_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_637_809_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_637_809_Closed_Text.style.display='none'; Codehighlighter1_637_809_Open_Image.style.display='inline'; Codehighlighter1_637_809_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">stop) </SPAN><SPAN id=Codehighlighter1_637_809_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_637_809_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>          </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 获取Selectorq回的时间?/SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">          n </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> selector.select();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>          </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 当传回的值大?事,M件发生了</SPAN><SPAN style="COLOR: #008000"><BR><IMG id=Codehighlighter1_754_799_Open_Image onclick="this.style.display='none'; Codehighlighter1_754_799_Open_Text.style.display='none'; Codehighlighter1_754_799_Closed_Image.style.display='inline'; Codehighlighter1_754_799_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_754_799_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_754_799_Closed_Text.style.display='none'; Codehighlighter1_754_799_Open_Image.style.display='inline'; Codehighlighter1_754_799_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">          </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (n </SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">) </SPAN><SPAN id=Codehighlighter1_754_799_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_754_799_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>         </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 处理发生的事?/SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">         <IMG src="http://www.aygfsteel.com/images/dot.gif"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>          }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>        }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>        selector.close();</SPAN></DIV></DIV><img src ="http://www.aygfsteel.com/georgehill/aggbug/5180.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/georgehill/" target="_blank">米</a> 2005-05-25 15:02 <a href="http://www.aygfsteel.com/georgehill/archive/2005/05/25/5180.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JDK Dynamic Proxy模式的简单范?/title><link>http://www.aygfsteel.com/georgehill/archive/2005/05/24/5126.html</link><dc:creator>米</dc:creator><author>米</author><pubDate>Tue, 24 May 2005 09:47:00 GMT</pubDate><guid>http://www.aygfsteel.com/georgehill/archive/2005/05/24/5126.html</guid><wfw:comment>http://www.aygfsteel.com/georgehill/comments/5126.html</wfw:comment><comments>http://www.aygfsteel.com/georgehill/archive/2005/05/24/5126.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/georgehill/comments/commentRss/5126.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/georgehill/services/trackbacks/5126.html</trackback:ping><description><![CDATA[      在JDK1.3版本中引入了Dynamic Proxy的代理机Ӟ通过实现java.lang.reflect.InvocationHandler接口Q可以实现拦截需要改写的Ҏ。下面是一个简单范例?BR>      有下面一个接口TestInterface和它的一个实现TestImplQ?BR><BR> <DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <DIV><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">package sample.proxy;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_23_182_Open_Image onclick="this.style.display='none'; Codehighlighter1_23_182_Open_Text.style.display='none'; Codehighlighter1_23_182_Closed_Image.style.display='inline'; Codehighlighter1_23_182_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_23_182_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_23_182_Closed_Text.style.display='none'; Codehighlighter1_23_182_Open_Image.style.display='inline'; Codehighlighter1_23_182_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_23_182_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</SPAN><SPAN id=Codehighlighter1_23_182_Open_Text><SPAN style="COLOR: #008000">/*</SPAN><SPAN style="COLOR: #008000">*<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Title: </p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Description: </p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Copyright: Copyright (c) 2005</p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Company: </p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * @author George Hill<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * @version 1.0<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top> </SPAN><SPAN style="COLOR: #008000">*/</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_216_245_Open_Image onclick="this.style.display='none'; Codehighlighter1_216_245_Open_Text.style.display='none'; Codehighlighter1_216_245_Closed_Image.style.display='inline'; Codehighlighter1_216_245_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_216_245_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_216_245_Closed_Text.style.display='none'; Codehighlighter1_216_245_Open_Image.style.display='inline'; Codehighlighter1_216_245_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">interface</SPAN><SPAN style="COLOR: #000000"> TestInterface </SPAN><SPAN id=Codehighlighter1_216_245_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_216_245_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> String print();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN></DIV></DIV><BR> <DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <DIV><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">package sample.proxy;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_23_182_Open_Image onclick="this.style.display='none'; Codehighlighter1_23_182_Open_Text.style.display='none'; Codehighlighter1_23_182_Closed_Image.style.display='inline'; Codehighlighter1_23_182_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_23_182_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_23_182_Closed_Text.style.display='none'; Codehighlighter1_23_182_Open_Image.style.display='inline'; Codehighlighter1_23_182_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_23_182_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</SPAN><SPAN id=Codehighlighter1_23_182_Open_Text><SPAN style="COLOR: #008000">/*</SPAN><SPAN style="COLOR: #008000">*<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Title: </p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Description: </p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Copyright: Copyright (c) 2005</p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Company: </p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * @author George Hill<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * @version 1.0<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top> </SPAN><SPAN style="COLOR: #008000">*/</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_232_316_Open_Image onclick="this.style.display='none'; Codehighlighter1_232_316_Open_Text.style.display='none'; Codehighlighter1_232_316_Closed_Image.style.display='inline'; Codehighlighter1_232_316_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_232_316_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_232_316_Closed_Text.style.display='none'; Codehighlighter1_232_316_Open_Image.style.display='inline'; Codehighlighter1_232_316_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> TestImpl implements TestInterface </SPAN><SPAN id=Codehighlighter1_232_316_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_232_316_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  <BR><IMG id=Codehighlighter1_261_311_Open_Image onclick="this.style.display='none'; Codehighlighter1_261_311_Open_Text.style.display='none'; Codehighlighter1_261_311_Closed_Image.style.display='inline'; Codehighlighter1_261_311_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_261_311_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_261_311_Closed_Text.style.display='none'; Codehighlighter1_261_311_Open_Image.style.display='inline'; Codehighlighter1_261_311_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> String print() </SPAN><SPAN id=Codehighlighter1_261_311_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_261_311_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Hello, it's from TestImpl class</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN></DIV></DIV><BR>      下面拦截printҎQ调用自q实现Q这需要实现java.lang.reflect.InvocationHandler接口?BR><BR> <DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <DIV><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">package sample.proxy;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>import java.lang.reflect.</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_52_211_Open_Image onclick="this.style.display='none'; Codehighlighter1_52_211_Open_Text.style.display='none'; Codehighlighter1_52_211_Closed_Image.style.display='inline'; Codehighlighter1_52_211_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_52_211_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_52_211_Closed_Text.style.display='none'; Codehighlighter1_52_211_Open_Image.style.display='inline'; Codehighlighter1_52_211_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_52_211_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</SPAN><SPAN id=Codehighlighter1_52_211_Open_Text><SPAN style="COLOR: #008000">/*</SPAN><SPAN style="COLOR: #008000">*<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Title: </p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Description: </p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Copyright: Copyright (c) 2005</p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Company: </p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> *<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * @author George Hill<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * @version 1.0<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top> </SPAN><SPAN style="COLOR: #008000">*/</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_268_1110_Open_Image onclick="this.style.display='none'; Codehighlighter1_268_1110_Open_Text.style.display='none'; Codehighlighter1_268_1110_Closed_Image.style.display='inline'; Codehighlighter1_268_1110_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_268_1110_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_268_1110_Closed_Text.style.display='none'; Codehighlighter1_268_1110_Open_Image.style.display='inline'; Codehighlighter1_268_1110_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> TestHandler implements InvocationHandler </SPAN><SPAN id=Codehighlighter1_268_1110_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_268_1110_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  TestInterface test;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  <BR><IMG id=Codehighlighter1_300_416_Open_Image onclick="this.style.display='none'; Codehighlighter1_300_416_Open_Text.style.display='none'; Codehighlighter1_300_416_Closed_Image.style.display='inline'; Codehighlighter1_300_416_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_300_416_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_300_416_Closed_Text.style.display='none'; Codehighlighter1_300_416_Open_Image.style.display='inline'; Codehighlighter1_300_416_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN id=Codehighlighter1_300_416_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</SPAN><SPAN id=Codehighlighter1_300_416_Open_Text><SPAN style="COLOR: #008000">/*</SPAN><SPAN style="COLOR: #008000">*<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   * 动态代理绑定到指定的TestInterface<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   * @param test TestInterface<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   * @return TestInterface l定代理后的TestInterface<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>   </SPAN><SPAN style="COLOR: #008000">*/</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG id=Codehighlighter1_466_674_Open_Image onclick="this.style.display='none'; Codehighlighter1_466_674_Open_Text.style.display='none'; Codehighlighter1_466_674_Closed_Image.style.display='inline'; Codehighlighter1_466_674_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_466_674_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_466_674_Closed_Text.style.display='none'; Codehighlighter1_466_674_Open_Image.style.display='inline'; Codehighlighter1_466_674_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> TestInterface bind(TestInterface test) </SPAN><SPAN id=Codehighlighter1_466_674_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_466_674_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">.test </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> test;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    TestInterface proxyTest </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (TestInterface) Proxy.newProxyInstance(<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>      test.getClass().getClassLoader(), test.getClass().getInterfaces(), </SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> proxyTest;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  <BR><IMG id=Codehighlighter1_681_832_Open_Image onclick="this.style.display='none'; Codehighlighter1_681_832_Open_Text.style.display='none'; Codehighlighter1_681_832_Closed_Image.style.display='inline'; Codehighlighter1_681_832_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_681_832_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_681_832_Closed_Text.style.display='none'; Codehighlighter1_681_832_Open_Image.style.display='inline'; Codehighlighter1_681_832_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN id=Codehighlighter1_681_832_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</SPAN><SPAN id=Codehighlighter1_681_832_Open_Text><SPAN style="COLOR: #008000">/*</SPAN><SPAN style="COLOR: #008000">*<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   * Ҏ调用拦截器,拦截printҎ<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   * @param proxy Object<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   * @param method Method<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   * @param args Object[]<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   * @return Object<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   * @throws Throwable<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>   </SPAN><SPAN style="COLOR: #008000">*/</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG id=Codehighlighter1_918_1105_Open_Image onclick="this.style.display='none'; Codehighlighter1_918_1105_Open_Text.style.display='none'; Codehighlighter1_918_1105_Closed_Image.style.display='inline'; Codehighlighter1_918_1105_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_918_1105_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_918_1105_Closed_Text.style.display='none'; Codehighlighter1_918_1105_Open_Image.style.display='inline'; Codehighlighter1_918_1105_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> Object invoke(Object proxy, Method method, Object[] args) throws Throwable </SPAN><SPAN id=Codehighlighter1_918_1105_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_918_1105_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 如果调用的是printҎQ则替换?/SPAN><SPAN style="COLOR: #008000"><BR><IMG id=Codehighlighter1_988_1043_Open_Image onclick="this.style.display='none'; Codehighlighter1_988_1043_Open_Text.style.display='none'; Codehighlighter1_988_1043_Closed_Image.style.display='inline'; Codehighlighter1_988_1043_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_988_1043_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_988_1043_Closed_Text.style.display='none'; Codehighlighter1_988_1043_Open_Image.style.display='inline'; Codehighlighter1_988_1043_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">    </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">print</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.equals(method.getName())) </SPAN><SPAN id=Codehighlighter1_988_1043_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_988_1043_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>      </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">HaHa, It's come from TestHandler</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><IMG id=Codehighlighter1_1050_1101_Open_Image onclick="this.style.display='none'; Codehighlighter1_1050_1101_Open_Text.style.display='none'; Codehighlighter1_1050_1101_Closed_Image.style.display='inline'; Codehighlighter1_1050_1101_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_1050_1101_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1050_1101_Closed_Text.style.display='none'; Codehighlighter1_1050_1101_Open_Image.style.display='inline'; Codehighlighter1_1050_1101_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>    }</SPAN></SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN id=Codehighlighter1_1050_1101_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_1050_1101_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>      </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> method.invoke(</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">.test, args);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN></DIV></DIV><BR>      下面是测试用例:<BR><BR> <DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <DIV><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">package sample.test;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>import junit.framework.</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>import sample.proxy.</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_73_239_Open_Image onclick="this.style.display='none'; Codehighlighter1_73_239_Open_Text.style.display='none'; Codehighlighter1_73_239_Closed_Image.style.display='inline'; Codehighlighter1_73_239_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_73_239_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_73_239_Closed_Text.style.display='none'; Codehighlighter1_73_239_Open_Image.style.display='inline'; Codehighlighter1_73_239_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_73_239_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</SPAN><SPAN id=Codehighlighter1_73_239_Open_Text><SPAN style="COLOR: #008000">/*</SPAN><SPAN style="COLOR: #008000">*<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Title: </p> <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Description: </p> <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Copyright: Copyright (c) 2005</p> <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <p>Company: </p><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * @author George Hill<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> * @version 1.0<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top> </SPAN><SPAN style="COLOR: #008000">*/</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_289_669_Open_Image onclick="this.style.display='none'; Codehighlighter1_289_669_Open_Text.style.display='none'; Codehighlighter1_289_669_Closed_Image.style.display='inline'; Codehighlighter1_289_669_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_289_669_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_289_669_Closed_Text.style.display='none'; Codehighlighter1_289_669_Open_Image.style.display='inline'; Codehighlighter1_289_669_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> TestDynamicProxy extends TestCase </SPAN><SPAN id=Codehighlighter1_289_669_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_289_669_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> TestInterface test </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_374_504_Open_Image onclick="this.style.display='none'; Codehighlighter1_374_504_Open_Text.style.display='none'; Codehighlighter1_374_504_Closed_Image.style.display='inline'; Codehighlighter1_374_504_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_374_504_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_374_504_Closed_Text.style.display='none'; Codehighlighter1_374_504_Open_Image.style.display='inline'; Codehighlighter1_374_504_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">protected</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> setUp() throws Exception </SPAN><SPAN id=Codehighlighter1_374_504_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_374_504_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    super.setUp();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    TestHandler handler </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> TestHandler();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 用handlerȝ成实?/SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">    test </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> handler.bind(</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> TestImpl());<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_552_595_Open_Image onclick="this.style.display='none'; Codehighlighter1_552_595_Open_Text.style.display='none'; Codehighlighter1_552_595_Closed_Image.style.display='inline'; Codehighlighter1_552_595_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_552_595_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_552_595_Closed_Text.style.display='none'; Codehighlighter1_552_595_Open_Image.style.display='inline'; Codehighlighter1_552_595_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">protected</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> tearDown() throws Exception </SPAN><SPAN id=Codehighlighter1_552_595_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_552_595_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    test </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    super.tearDown();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_624_666_Open_Image onclick="this.style.display='none'; Codehighlighter1_624_666_Open_Text.style.display='none'; Codehighlighter1_624_666_Closed_Image.style.display='inline'; Codehighlighter1_624_666_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_624_666_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_624_666_Closed_Text.style.display='none'; Codehighlighter1_624_666_Open_Image.style.display='inline'; Codehighlighter1_624_666_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> testPrint() </SPAN><SPAN id=Codehighlighter1_624_666_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_624_666_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    System.</SPAN><SPAN style="COLOR: #0000ff">out</SPAN><SPAN style="COLOR: #000000">.println(test.print());<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN></DIV></DIV><BR>      q行试用例Q可以看到输出的是“HaHa, It's come from TestHandler”?img src ="http://www.aygfsteel.com/georgehill/aggbug/5126.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/georgehill/" target="_blank">米</a> 2005-05-24 17:47 <a href="http://www.aygfsteel.com/georgehill/archive/2005/05/24/5126.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用Jakarta Commons Pool创徏对象池的单例?/title><link>http://www.aygfsteel.com/georgehill/archive/2005/05/20/4993.html</link><dc:creator>米</dc:creator><author>米</author><pubDate>Fri, 20 May 2005 06:08:00 GMT</pubDate><guid>http://www.aygfsteel.com/georgehill/archive/2005/05/20/4993.html</guid><wfw:comment>http://www.aygfsteel.com/georgehill/comments/4993.html</wfw:comment><comments>http://www.aygfsteel.com/georgehill/archive/2005/05/20/4993.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/georgehill/comments/commentRss/4993.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/georgehill/services/trackbacks/4993.html</trackback:ping><description><![CDATA[     摘要:       使用Jakarta Commons Pool可以Ҏ需要快速的实现自己的对象池Q只需要实现PoolableObjectFactory或者KeyedPoolableObjectFactory接口。KeyedPoolableObjectFactory和PoolableObjectFactory的不同之处在于KeyedPoolabl...  <a href='http://www.aygfsteel.com/georgehill/archive/2005/05/20/4993.html'>阅读全文</a><img src ="http://www.aygfsteel.com/georgehill/aggbug/4993.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/georgehill/" target="_blank">米</a> 2005-05-20 14:08 <a href="http://www.aygfsteel.com/georgehill/archive/2005/05/20/4993.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用NIO实现的简单的|络服务器端http://www.aygfsteel.com/georgehill/archive/2005/05/18/4499.htmlWed, 18 May 2005 04:21:00 GMThttp://www.aygfsteel.com/georgehill/archive/2005/05/18/4499.htmlhttp://www.aygfsteel.com/georgehill/comments/4499.htmlhttp://www.aygfsteel.com/georgehill/archive/2005/05/18/4499.html#Feedback0http://www.aygfsteel.com/georgehill/comments/commentRss/4499.htmlhttp://www.aygfsteel.com/georgehill/services/trackbacks/4499.html

package sample.nio;

import java.io.
*;
import java.net.
*;
import java.nio.channels.
*;
import java.util.
*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: </p>
 *
 * @author George Hill
 * @version 1.0
 
*/


public class Server {

  
private int port;

  
public Server(int port) {
    
this.port = port;
  }


  
public void startServer() throws IOException {
    
// 创徏ServerSocketChannelq且l定到指定的端口
    ServerSocketChannel ssc = ServerSocketChannel.open();
    InetSocketAddress address 
= new InetSocketAddress(InetAddress.getLocalHost(), port);
    ssc.socket().bind(address);
    ssc.configureBlocking(
false);

    
// 创徏SelectorQƈ且注册ACCEPT事g
    Selector selector = Selector.open();
    SelectionKey skey 
= ssc.register(selector, SelectionKey.OP_ACCEPT);

    boolean stop 
= false;
    
int n = 0;

    System.
out.println("Server Start");

    
// 轮询
    while (!stop) {
      
// 获取Selectorq回的时间?/SPAN>
      n = selector.select();

      
// 当传回的值大?事,L间发生了
      if (n > 0{
        Set 
set = selector.selectedKeys();
        Iterator it 
= set.iterator();

        
while (it.hasNext()) {
          skey 
= (SelectionKey) it.next();
          it.remove();

          
if (skey.isAcceptable()) {
            
// 从channel()中取得刚刚注册的Channel
            Socket socket = ((ServerSocketChannel) skey.channel()).accept().socket();

            PrintWriter writer 
= new PrintWriter(socket.getOutputStream(), true);

            
// ?Hello, World"写入
            writer.write("Hello, World!\n");

            
// 睡眠3U?/SPAN>
            try {
              Thread.sleep(
3000);
            }
 catch (InterruptedException ie) {
            }


            
// ?EXIT"写入Buffer
            writer.write("EXIT");

            
// 退出程?/SPAN>
            writer.close();
            
// stop = true;
          }

        }

      }

    }


    ssc.close();
    System.
out.println("Server Stop");
  }


  
public static void main(String[] args) throws Exception {
    Server server 
= new Server(5000);
    server.startServer();
  }

}



2005-05-18 12:21 发表评论
]]>
用NIO实现的两U网l程序客Lhttp://www.aygfsteel.com/georgehill/archive/2005/05/18/4498.htmlWed, 18 May 2005 04:18:00 GMThttp://www.aygfsteel.com/georgehill/archive/2005/05/18/4498.htmlhttp://www.aygfsteel.com/georgehill/comments/4498.htmlhttp://www.aygfsteel.com/georgehill/archive/2005/05/18/4498.html#Feedback0http://www.aygfsteel.com/georgehill/comments/commentRss/4498.htmlhttp://www.aygfsteel.com/georgehill/services/trackbacks/4498.html阅读全文

2005-05-18 12:18 发表评论
]]>
如何使用JCE的DESq行加密解密http://www.aygfsteel.com/georgehill/archive/2005/05/18/4485.htmlWed, 18 May 2005 03:55:00 GMThttp://www.aygfsteel.com/georgehill/archive/2005/05/18/4485.htmlhttp://www.aygfsteel.com/georgehill/comments/4485.htmlhttp://www.aygfsteel.com/georgehill/archive/2005/05/18/4485.html#Feedback4http://www.aygfsteel.com/georgehill/comments/commentRss/4485.htmlhttp://www.aygfsteel.com/georgehill/services/trackbacks/4485.html      从JDK1.4开始,SUN提供了JCE包,可以实现多种加密法。下面是我的一个用JCEq行DES加密解密的程序:

package sample;

import java.security.
*;
import javax.crypto.
*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: </p>
 *
 * @author George Hill
 * @version 1.0
 
*/


public class Test {
  
  
// 加密使用的Key
  private SecretKey key;
  
  
// 加密法QJCE可用DES,DESede和Blowfish
  private static final String algorithm = "DES";
  
  
public Test() throws NoSuchAlgorithmException {
    KeyGenerator generator 
= KeyGenerator.getInstance(algorithm);
    key 
= generator.generateKey();
  }

  
  
/**
   * 利用DES法加密
   * @param s String 需要加密的字符?BR>   * @return String 加密后的字符?BR>   * @throws Exception
   
*/

  
public String encryptData(String s) throws Exception {
    Cipher c 
= Cipher.getInstance(algorithm);
    c.init(Cipher.ENCRYPT_MODE, key);

    
return new String(c.doFinal(s.getBytes()));
  }

  
  
/**
   * 利用DES法解密
   * @param s String 需要解密的字符?BR>   * @return String 解密后的字符?BR>   * @throws Exception
   
*/

  
public String decryptData(String s) throws Exception {
    Cipher c 
= Cipher.getInstance(algorithm);
    c.init(Cipher.DECRYPT_MODE, key);

    
return new String(c.doFinal(s.getBytes()));
  }

  
  
/**
   * 试E序
   * @param args String[]
   * @throws Exception
   
*/

  
public static void main(String[] args) throws Exception {
    String s 
= "Hello";
    Test test 
= new Test();
    String encrypt 
= test.encryptData(s);
    System.
out.println(encrypt);
    String decrypt 
= test.decryptData(encrypt);
    System.
out.println(decrypt);
  }

}



      在实际的使用中,往往需要对加密后的byte数组q行转换Q可以自己实现{换,或者用一些第三方的API?img src ="http://www.aygfsteel.com/georgehill/aggbug/4485.html" width = "1" height = "1" />

2005-05-18 11:55 发表评论
]]>
JBuilder 2005解决了以前版本中存在的编辑XML文g很慢的问?/title><link>http://www.aygfsteel.com/georgehill/archive/2005/05/16/4334.html</link><dc:creator>米</dc:creator><author>米</author><pubDate>Mon, 16 May 2005 06:04:00 GMT</pubDate><guid>http://www.aygfsteel.com/georgehill/archive/2005/05/16/4334.html</guid><wfw:comment>http://www.aygfsteel.com/georgehill/comments/4334.html</wfw:comment><comments>http://www.aygfsteel.com/georgehill/archive/2005/05/16/4334.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/georgehill/comments/commentRss/4334.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/georgehill/services/trackbacks/4334.html</trackback:ping><description><![CDATA[      在JBuilder X中编辑XML文gӞ每做修改都要停顿很长的时_可能是在查XML的格式是否正。例如我在编辑Struts的有效性校验文件validation.xml文gӞ常常写一段内容都要五六分钟的时候。我无法忍受,不得不用其它的Y件编辑,例如UltraEdit。现?005中已l没有这个问题。我感觉2005在编辑Struts的内ҎQ速度都比以前的版本要快?img src ="http://www.aygfsteel.com/georgehill/aggbug/4334.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/georgehill/" target="_blank">米</a> 2005-05-16 14:04 <a href="http://www.aygfsteel.com/georgehill/archive/2005/05/16/4334.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我的|页附加码实?/title><link>http://www.aygfsteel.com/georgehill/archive/2005/05/12/4228.html</link><dc:creator>米</dc:creator><author>米</author><pubDate>Thu, 12 May 2005 07:33:00 GMT</pubDate><guid>http://www.aygfsteel.com/georgehill/archive/2005/05/12/4228.html</guid><wfw:comment>http://www.aygfsteel.com/georgehill/comments/4228.html</wfw:comment><comments>http://www.aygfsteel.com/georgehill/archive/2005/05/12/4228.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/georgehill/comments/commentRss/4228.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/georgehill/services/trackbacks/4228.html</trackback:ping><description><![CDATA[     摘要:       在网늼E中Q经帔R要用到附加码这L一个东西,防止黑客用程序用ID法去破解密码。下面是我的一个附加码的Servlet实现?   1import java.awt.*;  2import java.awt.image.*;  3import...  <a href='http://www.aygfsteel.com/georgehill/archive/2005/05/12/4228.html'>阅读全文</a><img src ="http://www.aygfsteel.com/georgehill/aggbug/4228.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/georgehill/" target="_blank">米</a> 2005-05-12 15:33 <a href="http://www.aygfsteel.com/georgehill/archive/2005/05/12/4228.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何在JBuilder2005中新增Serverhttp://www.aygfsteel.com/georgehill/archive/2005/05/12/4215.htmlThu, 12 May 2005 03:56:00 GMThttp://www.aygfsteel.com/georgehill/archive/2005/05/12/4215.htmlhttp://www.aygfsteel.com/georgehill/comments/4215.htmlhttp://www.aygfsteel.com/georgehill/archive/2005/05/12/4215.html#Feedback0http://www.aygfsteel.com/georgehill/comments/commentRss/4215.htmlhttp://www.aygfsteel.com/georgehill/services/trackbacks/4215.html      最q把自己的IDE从JBuilderX升C2005Q虽然在~辑Struts的配|文件的时候感觉快了些Q但是Mq是很吃机器。以前的一些项目都是跑在Tomcat 4.0.6的环境下的,?005中却没有了Tomcat 4.0的Server。ؓ了让开发环境和q行环境一_我决定给2005加上Tomcat 4.0的Server。经q一天的摸烦Q终于成功?BR>      一开始我以ؓ用Configure Servers里面的Copy功能Q把Tomcat 4.1的拷贝成4.0的就可以了,但是Tomcat跑不hQ因?.1?.0的server.xml文g的格式是不一LQ在4.1中的server.xml文g格式如下Q?/P>
 1<?xml version="1.0" encoding="UTF-8"?>
 2<!--This comment marks this file as generated, so it may be deleted and regenerated at any time. To preserve manual changes to this file, delete this comment.-->
 3<Server debug="0" port="8081" shutdown="SHUTDOWN">
 4  <Service name="Tomcat-Standalone">
 5    <Connector acceptCount="10" className="org.apache.coyote.tomcat4.CoyoteConnector" connectionTimeout="60000" debug="0" maxProcessors="75" minProcessors="5" port="8080" useURIValidationHack="false"/>
 6    <Engine debug="0" defaultHost="localhost" name="Standalone">
 7      <Host appBase="D:\jbproject\xxxxx\Tomcat\webapps" debug="0" name="localhost" unpackWARs="true"/>
 8    </Engine>
 9  </Service>
10</Server>

?.0中的server.xml文g格式如下Q?/P>

 1<?xml version="1.0" encoding="UTF-8"?>
 2<!--This comment marks this file as generated, so it may be deleted and regenerated at any time. To preserve manual changes to this file, delete this comment.-->
 3<Server debug="0" port="8081" shutdown="SHUTDOWN">
 4  <Service name="Tomcat-Standalone">
 5    <Connector acceptCount="10" className="org.apache.catalina.connector.http.HttpConnector" connectionTimeout="60000" debug="0" maxProcessors="75" minProcessors="5" port="8080"/>
 6    <Engine debug="0" defaultHost="localhost" name="Standalone">
 7      <Host appBase="D:\jbproject\xxxxx\Tomcat\webapps" debug="0" name="localhost" unpackWARs="true">
 8        <Context debug="0" docBase="D:\jbproject\xxxxx\admin" path="/admin" reloadable="true" workDir="D:\jbproject\xxxxx\Tomcat\work\admin"/>
 9      </Host>
10    </Engine>
11  </Service>
12</Server>
13

?.1中把具体的Context攑ֈ了webapps目录下面Q所以ƈ不能单的copyq来可以用?BR>
      在JBuilder 2005中,每个Server都是以plugin的Ş式加入的Q具体的jar文g攑֜lib目录下面的servers目录里面。用WinRAR打开tomcat-jbsp.jar文gQ可以看到里面有Tomcat33*.class和Tomcat40*.classQ也是说其实JBuilder 2005其实是有q些server的配|信息的Q只是它隐藏了。那么怎么把它打开呢?{案在MANIFEST.MF文g里面Q修改前的文件内容如下:

1Implementation-Vendor: Borland Software Corp.
2Implementation-Version: 011.000.236.000
3Implementation-Title: JBuilder 2005, English Edition
4OpenTools-Servers: com.borland.jbuilder.server.tomcat.Tomcat50Server
5  com.borland.jbuilder.server.tomcat.Tomcat41Server
6

在后面再增加一行:com.borland.jbuilder.server.tomcat.Tomcat40Server。保存,q且重启JBuilder 2005Q点击Enterprise->Configure ServersQ你可以看到里面多了一个Tomcat4.0的Server。呵呵,大功告成Q?BR>
      cM的还可以d其它的ServerQ不q只限于JBuilder 2005本n有的Server。如果熟悉JBuilder 的plugin的大虑֮全可以自qE解冟?BR>

2005-05-12 11:56 发表评论
]]>
վ֩ģ壺 ƫ| ϽϽ| Զ| | | ˮ| | ɫ| | °Ͷ| ־| | »| Ϸ| | | | ²| | հ| ʡ| | | Ĭ| ӱʡ| | ٽ| | | | »Ȱ| | ƽ| ˱| ߮| ư| | ̶| | | |