Sectors3DPanel.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:QN-ACTR-Release 作者:
/**
 * 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));
                }
            }
        }
    });
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号