用了清风兄的方法解决第四个问题的时候﹐出现了下面的错误﹕ --------------------Configuration: Example5 - JDK version 1.4 <Default>-------------------- C:\JCreator\MyProjects\Example5\Example5.java:21: variable buffer might not have been initialized buffer.append("is not Bold"); ^ C:\JCreator\MyProjects\Example5\Example5.java:22: variable buffer might not have been initialized else buffer.append("is not Bold"); ^ 2 errors Process completed. 怎幺办﹖还有人有其它办法吗﹖ 第二个问题还有其它方法解决吗﹖ 晚上10点结帖
不好意思,没有测试 还是第四个问题: StringBuffer buffer;改成 StringBuffer buffer = new StringBuffer();variable buffer might not have been initialized 说的是没有初始化。 比如我们用一个已经写好的类要 Classname xx = new Classname(); 用他里面的方法就xx.methordname(); 就可以了。
第二个问题: Color c(0.5,0.3,0.7);确实没有这么用的,和第四个问题一样。 你必须 Color c = new Color(211,109,222); 好象里面的值要大于1, 不过我查了一下color 的结构体,好象也可以。 public Color(float r, float g, float b) 要求在(0 -1.0)之间,不知道为什么c(0.5,0.3,0.7)不对。
byte[] b={'a','b','c','d','1'};
问题二:Color c=new Color(0.5,0.3,0.7);//注意创建对象的方法!没有象你那样的简写问题三:和问题2是一样的错误。问题四:s=buffer;这是错误的!s是String类型,而buffer是StringBuffer类型,它们的类型不匹配!
byte[] b={'a','b','c','d','1'};
问题二:Color c=new Color(0.5,0.3,0.7);//注意创建对象的方法!没有象你那样的简写问题三:和问题2是一样的错误。问题四:s=buffer;这是错误的!s是String类型,而buffer是StringBuffer类型,它们的类型不匹配!
byte[] b={'a','b','c','d','1'};
问题二:Color c=new Color(0.5,0.3,0.7);//注意创建对象的方法!没有象你那样的简写问题三:和问题2是一样的错误。问题四:s=buffer;这是错误的!s是String类型,而buffer是StringBuffer类型,它们的类型不匹配!
不用建立同名的.htm文件。只能如此调用。你还想怎么样??
应该是g.drawBytes(b,0,5,100,75);少了一个s。
把s =buffer,改为。
char[] b;
buffer.getChars( 0 , buffer.length( ), b, 0 );该用法的具体描述:请看
http://www.servertec.com/products/iscript/docs/StringBuffer_getChars.html别忘了给加分啊。哈哈
s=buffer.toString();
--------------------Configuration: Example5 - JDK version 1.4 <Default>--------------------
C:\JCreator\MyProjects\Example5\Example5.java:21: variable buffer might not have been initialized
buffer.append("is not Bold");
^
C:\JCreator\MyProjects\Example5\Example5.java:22: variable buffer might not have been initialized
else buffer.append("is not Bold");
^
2 errors
Process completed.
怎幺办﹖还有人有其它办法吗﹖
第二个问题还有其它方法解决吗﹖
晚上10点结帖
不好意思,没有测试
还是第四个问题:
StringBuffer buffer;改成
StringBuffer buffer = new StringBuffer();variable buffer might not have been initialized 说的是没有初始化。
比如我们用一个已经写好的类要
Classname xx = new Classname();
用他里面的方法就xx.methordname();
就可以了。
Color c(0.5,0.3,0.7);确实没有这么用的,和第四个问题一样。
你必须 Color c = new Color(211,109,222);
好象里面的值要大于1,
不过我查了一下color 的结构体,好象也可以。
public Color(float r,
float g,
float b)
要求在(0 -1.0)之间,不知道为什么c(0.5,0.3,0.7)不对。
只要在jcreator里面设置一个工具石塔对应的是jdk\bin里面的appletviewer就行了
arguement:filename
initial:filedirectory
例如:Color color1=new Clor(0.2f,0.6f,0.8f);