User draws selection rectangle over components?

From: Andreas Schmidt (schmidt.2002_at_gmx.de)
Date: 11/22/03


Date: Sat, 22 Nov 2003 14:33:34 +0100


I have a JPanel with a bunch of JComponents inside. Now I want that the
user can drag the mouse over all of them and draw a selection rectangle
over them.

How do I do that? Do I have to use and implement the glassPane?

Isn't there a standard method? It's what every File Explorer does: There
are some Icons and you draw a selection rectangle to select some of
them... I can handle the selection later. Now I just want to draw the
selection rectangle.

Thanks!
Andi



Relevant Pages

  • Re: User draws selection rectangle over components?
    ... add MouseListener and MouseMotionListener to your JPanel. ... oldDragPoint = dragPoint; ... rect draw 4 lines. ... > user can drag the mouse over all of them and draw a selection rectangle ...
    (comp.lang.java.gui)
  • Re: CStatic and selection box
    ... You will definitely have to draw the selection rectangle each time you ... CRect member for the selection rect. ... void CXXX::OnLButtonDown(UINT nFlags, CPoint point) ...
    (microsoft.public.vc.mfc)
  • ControlPaint.DrawReversibleRectangle
    ... This method, found via google, appears to be the recommended way to ... draw a selection rectangle in a windows.forms control; ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Drawing lines in a CListCtrl
    ... I would simply use a CWnd or CStatic as the container. ... As far as drag and drop goes. ... container owns, and draw them. ...
    (microsoft.public.vc.mfc)
  • Re: Drawing lines in a CListCtrl
    ... would use a CWnd or CStatic, but a CButton should also be fine. ... As far as drag and drop goes. ... container owns, and draw them. ... place buttons with Icons to behave like the CListCtrl items? ...
    (microsoft.public.vc.mfc)