Java basics
getX()
Returns the horizontal x position of the event relative to the source component.x an integer indicating horizontal position relative to the component
Syntax:public int getX()
Example:public MainClass() {
setLayout(null);
add(button);
button.setSize(button.getPreferredSize());
button.setLocation(20, 20);
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
button.setLocation(e.getX(), e.getY());
}
});
Content
License.
All information of this service is derived from the free sources and is provided solely in the form of quotations.
This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 120 / 159177939. Delta: 0.00297 с