how to move a jframe which has no taskbar?

frame.addmousemotionlistener(this);

public void mousedragged(MouseEvent e)
{
   // What to write here
}

I tried setBounds of jframe but it flicker when we try to move the frame.

mKorbel commented: good question +1 +9

Recommended Answers

All 6 Replies

Member Avatar for hfx642

try... frame.setLocation (x, y);

@Majestics

I really can't ...(better ask question in all your cases), not sure if with mouse or as suggested @hfx642 ???

both ways are pretty simple,

you must waiting for some of profesional, because your last waiting moved you wrong way :-)

Sorry its title bar.... I am trying different codes , some are working but really slow. I will post the code which suit best for this situation, if i get it before professionals... :)

I recently posted a little sample for moving a Swing component with a mouse here
http://www.daniweb.com/software-development/java/threads/375002
it drags a JLabel in a JFrame, but the original version used to drag an undecorated window around the screen. You should be able to use it with almost zero changes.
J

try this

frame.addmousemotionlistener(this);
public void mousedragged(MouseEvent e)
{
   frame.setLocation(frame.getX()+e.getX(),frame.getY()+e.getY());
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.