I also want if i do left-click inside the window, there would be a choice just like the usual left click menu, containing properties and some other custom choices
You can use a JPopupMenu for this. The tutorial has a relevant section (see below). The mouse button that triggers the popup, the popupTrigger, varies by platform.
i havent find any way to process whether the MouseEvent input is a left or right click
One of the easier ways is with SwingUtilities. It has three methods, eg,
SwingUtilities.isLeftMouseButton(aMouseEvent). The MouseEvent api has more info in the comments section.
Aside from the focus problem (see below) this might be difficult. You could try working with the MouseInfo and PointerInfo classes (j2se 1.5+). And the other helpful resource is again SwingUtilities which has some convenience methods such as
convertPointToScreen.
none of the MouseMotionListener implementation worked at all
Focus is an issue beginning with j2se 1.4. Look in the Window class api for the method
isFocusableWindow. For the window, its JRootPane or any child components to be able to send Input/MouseEvents it/they must have the focus. This method lists the requirements for this to happen.
Here are a couple of links into the tutorial that may be helpful.
How to Use Menus
esp,
Bringing Up a Popup Menu
How to Use the Focus Subsystem
esp,
Making a Custom Component Focusable