- import java.awt.*;
- import java.awt.geom.*;
- public class TestPort2 {
- private Frame frame = null; // @jve:decl-index=0:visual-constraint="114,42"
- public TestPort2() {
- getFrame().setVisible(true);
- }
- /**
- * This method initializes frame
- *
- * @return java.awt.Frame
- */
- private Frame getFrame() {
- if (frame == null) {
- frame = new Frame();
- frame.setSize(new Dimension(353, 199));
- frame.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentResized(java.awt.event.ComponentEvent e) {
- Graphics2D g2d = (Graphics2D)frame.getGraphics();
- //注意下面一行代码
- Line2D l = new Line2D.Double(30,0,0,25000);
- g2d.draw(l);
- }
- });
- }
- return frame;
- }
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO 自动生成方法存根
- new TestPort2();
- }
- }
复制代码 当拖动Frame时应该显示一条竖线,而这段代码不行.
当把Line2D l = new Line2D.Double(30,0,0,25000);
换成Line2D l = new Line2D.Double(30,0,0,2500);
以及其它的参数就没有问题.
我百思不得其解,为什么呢?
请教高手!!!!!!!!!!!!!!!!!!!! |
|