I'm having some problem using JCEF with a "frameless JFrame", this is, without the Window menu who includes close and minimize button. I've implemented a way of closing and minimizing the Jframe with cefQuery on click of a HTML Button element, like this:
- Code: Select all
$('#close-window').on('click', function() {
window.cefQuery({
request: 'CLOSE',
onSuccess: function(response) {
console.log('Response: '+response);
},
onFailure: function(error_code, error_message) {}
});
});
In this case, I utilize a MessageHandler to receive the "CLOSE" string, and then, in Java, I close the Jframe.
My doubt, however, rests in how can I make a HTML element, like a div, to be draggable and then, drag all the Window (by consequence, the Jframe) around, like if I dragged the JFrame top frame.
After some research, i've come across this implementation of DragHandler on CEFSharp:
- Code: Select all
virtual bool OnDragEnter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDragData> dragData,
CefRefPtr<CefDragData> dragData,
DragOperationsMask mask) { return false; }
DragOperationsMask mask) { return false; }
///
// Called whenever draggable regions for the browser window change. These can
// be specified using the '-webkit-app-region: drag/no-drag' CSS-property. If
// draggable regions are never defined in a document this method will also
// never be called. If the last draggable region is removed from a document
// this method will be called with an empty vector.
///
/*--cef()--*/
virtual void OnDraggableRegionsChanged(
CefRefPtr<CefBrowser> browser,
const std::vector<CefDraggableRegion>& regions) {}
};
};
However, as many knows, in Java CEF we only have the method OnDragEnter, and not the OnDraggableRegionsChanged. So, my question is: there is a way for me to make a DIV HTML element, who, on drag, drag the Jframe around? Or a implementation like that from CEFSharp, where you simply put a '-webkit-app-region: drag/no-drag' CSS-property and it drags the frame?