Java: mouseDragged and moving around in a graphical interface
Based on this example, the following program allows the user to drag the axes’ intersection to an arbitrary point, origin, which starts at the center of the panel. import java.awt.Cursor; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.JFrame; import javax.swing.JPanel; /** * @see https://stackoverflow.com/a/15576413/230513 * @see https://stackoverflow.com/a/5312702/230513 … Read more