小编zha*_*ing的帖子

多个列表框同时滚动?

我有3个列表框,我想滚动一个,而其他人也滚动.我可以通过鼠标滚动滚动并拖动滚动条.

c# wpf

5
推荐指数
1
解决办法
4161
查看次数

鼠标的坐标?

public class mouse extends JFrame {
    private int x, y;
    private JLabel label;

    public mouse() {
        JPanel panel = new JPanel();
         addMouseMotionListener(new MouseMotion());
         label = new JLabel();
         panel.add(label);
         setPreferredSize(new Dimension(400, 200));
         add(panel, BorderLayout.SOUTH);
         pack();
         setVisible(true);
    }
    private class MouseMotion extends MouseMotionAdapter {
        public void mouseMoved(MouseEvent e) {
            x = e.getX();
            y = e.getY();
            label.setText("mouse coordinate " + "(" + x + "," + y + ")");
    }}
    public static void main(String[]args) {
        mouse a = new mouse();
    }
}
Run Code Online (Sandbox Code Playgroud)

当我将鼠标移动到边框时,它不是(0,0).为什么?例如,我将鼠标移动到左上角,它显示(4,30)而不是(0,0).

java mouse swing

2
推荐指数
1
解决办法
164
查看次数

标签 统计

c# ×1

java ×1

mouse ×1

swing ×1

wpf ×1