Rectangle2D rect = new Rectangle2D.Double( leftX, topY, width, height ); g2.draw( rect );}
to sdjiang2004() 我使用的是128码,12位的。由于打印机,和扫描器的问题,当BarPixels参数为1时,生成的条形码打印出来模糊了点,扫描困难;而参数为2时,生成的条形码由太长了,扫描不过来,最好是参数是1.5 而fillRect又不接受为这个参数。 所以呢,想通过缩小(或放大)graphics画出来的图像来实现了。
java.awt.geom.Rectangle2D.Float
或
java.awt.geom.Rectangle2D.Double=================
public void paintComponent( Graphics g ){
super.paintComponent( g );
Graphics2D g2 = (Graphics2D)g;
// draw a rectangle
double leftX = 100;
double topY = 100;
double width = 200;
double height = 200;
Rectangle2D rect = new Rectangle2D.Double( leftX, topY, width, height );
g2.draw( rect );}
我使用的是128码,12位的。由于打印机,和扫描器的问题,当BarPixels参数为1时,生成的条形码打印出来模糊了点,扫描困难;而参数为2时,生成的条形码由太长了,扫描不过来,最好是参数是1.5 而fillRect又不接受为这个参数。
所以呢,想通过缩小(或放大)graphics画出来的图像来实现了。
double X = 100;
double Y = 50;
double width = 0.5; //这就是你想要的吧:)
double height = 200;
Rectangle2D rect = new Rectangle2D.Double( X, Y, width, height );
g2.draw( rect );这样不就搞定了?