java - Resize a JFrame, which has no border, using a mouse -
i working on java desktop application using javax.swing. want make application border-less , @ same time resizeable. when remove border using frame.setundecorated(true); method can no longer resize frame using mouse clicks , drags.
how can hide border of frame , still let user resize it?
frames allow user interact jframe using mouse. if remove frame cannot use move or resize frame. can reimplement functionality (not sure why you'd want of course experimenting fun!).
first must somehow user mouse events. creating custom jcomponent, maybe called resizegrip, , placing in bottom right of frame can visually show user can still resize frame. can implement mouselistener see when user has clicked , dragged resizegrip.
then need turn event detections instructions resize frame pragmatically, via somejframe.setsize(newwidth, newheight);. need similar if want move frame.
Comments
Post a Comment