一段让我困惑的程序,望知道的各位帮我看看!!! 对了还有二句没写: prevLabel = new Label("<\u2014\u2014"); //\u2014 为字符- nextLabel = new Label("\u2014\u2014>"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><body><applet code=ChartLine.class name="ChartLine" width=200 height=170><param name=rows value="6"><param name=columns value="10"> <param name=hscale value=16><param name=vscale value=16><param name=hstart value=6><param name=vstart value=32> </applet></body></html> 下面取上面的参数的部分程序 s1 = getParameter("rows"); if(s1 != null && !s1.equals("")) { rows = (new Integer(s1)).intValue(); } else { rows = 5; } s1 = getParameter("columns"); if(s1 != null && !s1.equals("")) { cols = (new Integer(s1)).intValue(); } else { cols = 6; } s1 = getParameter("hstart"); if(s1 != null && !s1.equals("")) { hstart = (new Integer(s1)).intValue(); } else { hstart = 10; } s1 = getParameter("vstart"); if(s1 != null && !s1.equals("")) { vstart = (new Integer(s1)).intValue(); } else { vstart = 40; } s1 = getParameter("hscale"); if(s1 != null && !s1.equals("")) { hscale = (new Integer(s1)).intValue(); } else { hscale = 30; } s1 = getParameter("vscale"); if(s1 != null && !s1.equals("")) { vscale = (new Integer(s1)).intValue(); } else { vscale = 30; } prevLabel = new Label("<\u2014\u2014"); //\u2014 为字符- nextLabel = new Label("\u2014\u2014>"); int j = (cols * hscale - 120) / 2; //为什么要减去120 ??? prevLabel.setBounds(hstart + j, vstart + rows * vscale + 16, 50, 18); //得到的是什么?? nextLabel.setBounds(hstart + j + 70, vstart + rows * vscale + 16, 50, 18); 对于最后三句话看不懂。望高手给我指点。非常感谢! j是用来定位的,每次位置不一样后两句设置了这两个Label的位置。 那为什么要减120呀。可以减别的数。 能否说说setBounds()函数的用法?刚学java,望高手不要笑我的问题我太菜!我真的不懂。 晕,你这个程序是干吗的哦?你这个问题实在无聊,这是在设置label的边界(bounds),就是lable,到底从什么坐标开始,长多少,宽多少。至于为什么减120,那是因为写这个程序的人想减120,当然如果不减120,肯定得不到效果。这个问题好比房子为什么要修3层,不修5层,人家本来就是想修3层而已。prevLabel = new Label("<\u2014\u2014"); //\u2014 为字符nextLabel = new Label("\u2014\u2014>");这是在设置label上面的文本,为了避免中文化问题(也许是日文和韩文),特意写的是UNICODE的编码。 这些是用来设置边界的,没有什么别的意思,不要惊慌失乱。http://xieweibbs.topcities.com 我的Tomcat服务器有6个IP,目前需要服务3个域名,请问如何配置最简单呢? 求霍夫曼代码 文本文档数据怎么导入EXCEL表格中? 类似QQ的好友的树该怎么创建呢? 关于Jfreechart 谁来帮帮我呀 GUI界面中使用输入输出流 初学者求教! 如何用java实现修改本地机IP? JApplet中sql数据库访问的问题??? 为什么标签面板很小,怎么样叫标签面板大大的,有线等待? 怎么去掉“最大最小和关闭”按钮! 用什么方法能将EUC编码的文件以UNICODE的方式读到一个String里去?
<applet code=ChartLine.class name="ChartLine" width=200 height=170>
<param name=rows value="6">
<param name=columns value="10">
<param name=hscale value=16>
<param name=vscale value=16>
<param name=hstart value=6>
<param name=vstart value=32>
</applet>
</body>
</html> 下面取上面的参数的部分程序
s1 = getParameter("rows");
if(s1 != null && !s1.equals(""))
{
rows = (new Integer(s1)).intValue();
} else
{
rows = 5;
}
s1 = getParameter("columns");
if(s1 != null && !s1.equals(""))
{
cols = (new Integer(s1)).intValue();
} else
{
cols = 6;
}
s1 = getParameter("hstart");
if(s1 != null && !s1.equals(""))
{
hstart = (new Integer(s1)).intValue();
} else
{
hstart = 10;
}
s1 = getParameter("vstart");
if(s1 != null && !s1.equals(""))
{
vstart = (new Integer(s1)).intValue();
} else
{
vstart = 40; }
s1 = getParameter("hscale");
if(s1 != null && !s1.equals(""))
{
hscale = (new Integer(s1)).intValue();
} else
{
hscale = 30;
}
s1 = getParameter("vscale");
if(s1 != null && !s1.equals(""))
{
vscale = (new Integer(s1)).intValue();
} else
{
vscale = 30;
}
prevLabel = new Label("<\u2014\u2014"); //\u2014 为字符-
nextLabel = new Label("\u2014\u2014>"); int j = (cols * hscale - 120) / 2; //为什么要减去120 ???
prevLabel.setBounds(hstart + j, vstart + rows * vscale + 16, 50, 18); //得到的是什么??
nextLabel.setBounds(hstart + j + 70, vstart + rows * vscale + 16, 50, 18);
对于最后三句话看不懂。望高手给我指点。非常感谢!
后两句设置了这两个Label的位置。
能否说说setBounds()函数的用法?刚学java,望高手不要笑我的问题我太菜!我真的不懂。
prevLabel = new Label("<\u2014\u2014"); //\u2014 为字符
nextLabel = new Label("\u2014\u2014>");
这是在设置label上面的文本,为了避免中文化问题(也许是日文和韩文),特意写的是UNICODE的编码。