java类java.awt.event.MouseMotionAdapter的实例源码

InGateWaySectionPanel.java 文件源码 项目:jmt 阅读 39 收藏 0 点赞 0 评论 0
public GlassPane()
{
    setOpaque(false);
    setVisible(false);
    Color base = UIManager.getColor("inactiveCaptionBorder");
    base = (base == null) ? Color.LIGHT_GRAY : base;
    Color background = new Color(base.getRed(), base.getGreen(), base.getBlue(), 128);
    setBackground(background);

    // Disable Mouse events for the panel
    addMouseListener(new MouseAdapter() {});
    addMouseMotionListener(new MouseMotionAdapter() {});
}
KMeansInfoClustering.java 文件源码 项目:QN-ACTR-Release 阅读 23 收藏 0 点赞 0 评论 0
private JLabel setPie1() {
    int[] angle = new int[numClust];
    double[] prc = info.percent;
    int i;

    angle[0] = 0;
    for (i = 1; i < numClust; i++) {
        angle[i] = angle[i - 1] + (int) ((360) * prc[i - 1]);
    }
    for (; i < angle.length; i++) {
        angle[i] = 360;
    }
    final JLabel l = new JLabel();
    final pieChartIcon p = new pieChartIcon(numClust);
    l.addMouseMotionListener(new MouseMotionAdapter() {
        @Override
        public void mouseMoved(MouseEvent e) {
            int pos;

            pos = p.getPosXY(e.getX(), e.getY());

            if (pos != -1) {
                l.setToolTipText(tableClusters.getValueAt(pos, 2).toString());
            } else {
                l.setToolTipText("");
            }
        }
    });
    p.setAngle(angle);
    l.setIcon(p);
    return l;
}
KMeansInfoClustering.java 文件源码 项目:QN-ACTR-Release 阅读 25 收藏 0 点赞 0 评论 0
private JLabel setPie2(int var) {
    int[] angle = new int[numClust];
    int i;

    angle[0] = 0;
    for (i = 1; i < numClust; i++) {
        angle[i] = angle[i - 1] + (int) ((360) * info.infoCluster[i].percVar[var]);
    }
    for (; i < angle.length; i++) {
        angle[i] = 360;
    }

    final JLabel l = new JLabel();
    pieChartVars = new pieChartIcon(numClust);
    l.addMouseMotionListener(new MouseMotionAdapter() {
        @Override
        public void mouseMoved(MouseEvent e) {
            int pos;

            pos = pieChartVars.getPosXY(e.getX(), e.getY());

            if (pos != -1) {
                l.setToolTipText(tableVars.getValueAt(pos, 1).toString());
            } else {
                l.setToolTipText("");
            }
        }
    });
    pieChartVars.setAngle(angle);
    l.setIcon(pieChartVars);
    return l;
}
Sectors3DPanel.java 文件源码 项目:QN-ACTR-Release 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Builds a new Sectors3D Panel to show results of 3-class models
 * @param s3d results vector
 * @param classNames array with class names
 */
public Sectors3DPanel(Vector<Object> s3d, String[] classNames) {
    super(new BorderLayout());
    this.s3d = s3d;
    this.classNames = classNames;
    this.setBackground(BGCOLOR);
    this.setBorder(BorderFactory.createEtchedBorder());

    // Label to show coordinates
    coordLabel = new JLabel();
    coordLabel.setBorder(BorderFactory.createEtchedBorder());
    coordLabel.setVisible(false);
    coordLabel.setOpaque(true);
    // Puts label on south-east corner
    JPanel tmp = new JPanel(new BorderLayout());
    tmp.add(coordLabel, BorderLayout.EAST);
    tmp.setOpaque(false);
    this.add(tmp, BorderLayout.SOUTH);

    // Adds a mouseListener to show graph coordinates
    this.addMouseMotionListener(new MouseMotionAdapter() {
        @Override
        public void mouseMoved(MouseEvent e) {
            if (isShown) {
                String coord = getCoordinates(e.getX(), e.getY());
                if (coord != null) {
                    coordLabel.setText(coord);
                    coordLabel.setVisible(true);
                    Sectors3DPanel.this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
                } else {
                    coordLabel.setText("");
                    coordLabel.setVisible(false);
                    Sectors3DPanel.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            }
        }
    });
}
TopTablePanel.java 文件源码 项目:ramus 阅读 22 收藏 0 点赞 0 评论 0
public TopTablePanel(final ElistTablePanel panel, JTable table) {
    super(table.getColumnModel());
    this.panel = panel;
    this.table = table;
    this.addMouseMotionListener(new MouseMotionAdapter() {
        @Override
        public void mouseMoved(MouseEvent e) {
            setToolTipText(panel.getToolTipText(getHeight() - e.getY(), e
                    .getX()));
        }
    });
    setResizingAllowed(false);
    panel.setSize(getSize().height, getSize().width);
}
BusyGlassPane.java 文件源码 项目:WordnetLoom 阅读 27 收藏 0 点赞 0 评论 0
public BusyGlassPane() {
    initializeComponents();
    addMouseListener(new MouseAdapter() {
    });
    addMouseMotionListener(new MouseMotionAdapter() {
    });
    addKeyListener(new KeyAdapter() {
    });
}
GetMousePositionWithPopup.java 文件源码 项目:jdk8u-jdk 阅读 24 收藏 0 点赞 0 评论 0
private static void constructTestUI() {
    frame1 = new Frame();
    frame1.setBounds(100, 100, 100, 100);
    frame1.addMouseMotionListener(new MouseMotionAdapter() {

        private boolean shown = false;

        @Override
        public void mouseMoved(MouseEvent e) {
            if (shown) {
                return;
            }

            shown = true;

            frame2 = new Frame();
            frame2.setBounds(120, 120, 120, 120);
            frame2.setVisible(true);

            Point positionInFrame2 = frame2.getMousePosition();
            if (positionInFrame2.x != 30 || positionInFrame2.y != 30) {
                throw new RuntimeException("Wrong position reported. Should be [30, 30] but was [" +
                        positionInFrame2.x + ", " + positionInFrame2.y + "]");
            }

            Point positionInFrame1 = frame1.getMousePosition();
            if (positionInFrame1 != null) {
                throw new RuntimeException("Wrong position reported. Should be null");
            }

        }
    });
    frame1.setVisible(true);
}
GetMousePositionWithPopup.java 文件源码 项目:openjdk9 阅读 23 收藏 0 点赞 0 评论 0
private static void constructTestUI() {
    frame1 = new Frame();
    frame1.setBounds(100, 100, 100, 100);
    frame1.addMouseMotionListener(new MouseMotionAdapter() {

        private boolean shown = false;

        @Override
        public void mouseMoved(MouseEvent e) {
            if (shown) {
                return;
            }

            shown = true;

            frame2 = new Frame();
            frame2.setBounds(120, 120, 120, 120);
            frame2.setVisible(true);

            Point positionInFrame2 = frame2.getMousePosition();
            if (positionInFrame2.x != 30 || positionInFrame2.y != 30) {
                throw new RuntimeException("Wrong position reported. Should be [30, 30] but was [" +
                        positionInFrame2.x + ", " + positionInFrame2.y + "]");
            }

            Point positionInFrame1 = frame1.getMousePosition();
            if (positionInFrame1 != null) {
                throw new RuntimeException("Wrong position reported. Should be null");
            }

        }
    });
    frame1.setVisible(true);
}
SB_TabbedCanvas.java 文件源码 项目:SimBionic 阅读 21 收藏 0 点赞 0 评论 0
protected void initializeMouseMotionListener() {
    addMouseMotionListener(new MouseMotionAdapter()
    {
        public void mouseDragged(MouseEvent e)
        {
            SB_TabbedCanvas tabbedCanvas = (SB_TabbedCanvas) e.getSource();
            if (!tabbedCanvas._dragging && tabbedCanvas._downIndex != -1)
            {
                tabbedCanvas._dragging = true;
                setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            }
        }
    });
}
GetMousePositionWithPopup.java 文件源码 项目:jdk8u_jdk 阅读 24 收藏 0 点赞 0 评论 0
private static void constructTestUI() {
    frame1 = new Frame();
    frame1.setBounds(100, 100, 100, 100);
    frame1.addMouseMotionListener(new MouseMotionAdapter() {

        private boolean shown = false;

        @Override
        public void mouseMoved(MouseEvent e) {
            if (shown) {
                return;
            }

            shown = true;

            frame2 = new Frame();
            frame2.setBounds(120, 120, 120, 120);
            frame2.setVisible(true);

            Point positionInFrame2 = frame2.getMousePosition();
            if (positionInFrame2.x != 30 || positionInFrame2.y != 30) {
                throw new RuntimeException("Wrong position reported. Should be [30, 30] but was [" +
                        positionInFrame2.x + ", " + positionInFrame2.y + "]");
            }

            Point positionInFrame1 = frame1.getMousePosition();
            if (positionInFrame1 != null) {
                throw new RuntimeException("Wrong position reported. Should be null");
            }

        }
    });
    frame1.setVisible(true);
}


问题


面经


文章

微信
公众号

扫码关注公众号