hi i am having a bit of trouble displaying the mouse position in JTextField. i have currently done this code. i need to display the x and y positions inside the textfield.
private JTextField xTextField, yTextField;
private int mouseX, mouseY;
JPanel mousePanel = new JPanel();
xTextField = new JTextField (10);
yTextField = new JTextField (10);
mousePanel.add(xTextField);
mousePanel.add(yTextField);
visibleArea.add(mousePanel, BorderLayout.NORTH);
addMouseListener(this);
public void mousePressed(MouseEvent e) {
mouseX = e.getX();
mouseY = e.getY();
repaint();
}
i am sure i am forgeting something very straight forward but if anyone knows how i can do this it would be greatly appreciated.
cheers