用Graphics的drawLine画线或圆,怎么设置线宽? 用Graphics的drawLine画线或圆,怎么设置线宽?默认的总是1个象素,怎么修改或设置线宽属性?谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //Graphics不行,Graphics2D可以,利用setStroke()方法设置Graphics g;g=cv.getGraphics(); Graphics2D g2d = (Graphics2D)g;BasicStroke bs=new BasicStroke(width);//width是线宽,float型g2d.setStroke(bs); g2d.drawRect(10,10,80,80); private void drawNet( Graphics g ){ int height = getHeight(); int width = getWidth(); Graphics2D g2=(Graphics2D)g; coord.setNet(yUnit , xUnit); coord.setNetColor( Color.gray ); g2.setStroke( new BasicStroke(1)); //这局话 coord.drawNet(g); } c#的问题 多线程数据加锁 JTextField的奇怪问题,谢谢各位了 Sun ONE Studio 4 Community Edition的安装? 高手来看了 一个项目问题(聊天室 ) 如何在java 内调用外部dll啊? java新手的问题,java高手帮忙... 用jet 2.5制作可执行文件的问题~~~~ 一个Java编译的问题,急,急 请教一个正则表达式问题 我的Eclipse怎么不支持中文呢? 有点疑惑,帮我看看!
Graphics g;
g=cv.getGraphics(); Graphics2D g2d = (Graphics2D)g;
BasicStroke bs=new BasicStroke(width);//width是线宽,float型g2d.setStroke(bs);
g2d.drawRect(10,10,80,80);
int height = getHeight();
int width = getWidth();
Graphics2D g2=(Graphics2D)g;
coord.setNet(yUnit , xUnit);
coord.setNetColor( Color.gray );
g2.setStroke( new BasicStroke(1)); //这局话
coord.drawNet(g);
}