Using JPanel to draw straight lines and get point coordinates
I am at a total loss right now. I haven't worked much with building GUIs in Java, I've been reading all about swing and JPanel, and I think what I am trying to do is possible, I just haven't figured out how . I'm trying to build a GUI in which you can draw straight lines within a certain drawing area, I would like to be able to get the start/endpoint coordinates in order to perform some math with those points. Any help would be greatly appreciated! I will leave the code to you so here is the algorithm: 1. Create a JFrame and add a JPanel to it. 2. Add a mouse listener for the JPanel 3. Every