i've got problem mouse cursor. set inside mousemotion event of jpanel this.setcursor(), dosen't changed. after getting out ouf window example on desktop , go inside , cursor changed motion.
the code of mouse event of jpanel this:
public void mousemoved(mouseevent e) { this.requestfocusinwindow(); this.requestfocus(); this.cl.domousemoved(e); }
the code of method domousemoved this:
public void domousemoved(mouseevent e) { this.lastmouseevent = e; this.slist.setcurrentelements(e.getpoint()); this.setmovedcursor(e); }
an code of method setmovedcursor:
public void setmovedcursor(mouseevent e) { java.awt.cursor cu = new java.awt.cursor(java.awt.cursor.sw_resize_cursor); view.setcursor(cu); }
(i know isn't best way)
i hope can me. sorry mistakes, it's first post @ stackoverflow.
if (slist.getcurrentshapetype() == "rec") {
not sure if fix problem don't use "==" compare objects.
instead should using equals(...)
method.
if ("rec".equals(slist.getcurrentshapetype()) {
note: changed order of test don't have worry getcurrentshapetype() method returning null value.
else if (k.getborderbypoint(e.getpoint()) == 4)
also, don't know getborderbypoint() method why comparing integer value. have no idea "4" means. don't use "magic numbers. instead create variables like: cursor_north. or better yet why not return cursor method don't have check value twice.
Comments
Post a Comment