Thursday 15 April 2010

JavaFX 8 hiding side panel and mini window with button -



JavaFX 8 hiding side panel and mini window with button -

good evening.

after playing around few java fx 8 tutorials , making simple applications, decided take more hard project.

i had old swing map application displayed maps, layers , meteorological info db using map objects , taking maps local map server. wish update application pure java fx 8 , geoserver java api, added old swing app.

the first thing did, seek build model application in scene builder 2.0, have general idea. since making scratch, wished create little more modern.

and here problem. wish have map in tabbed pane, taking whole screen, minor panel bellow displaying info ( have yet decide of old info useful), , menu bar on top. user border pane central app, menu bar north, pane south , tab in center.

so far good. but, cannot figure out how add together button user can hide/unhide accordion pane , minimap of whole world, image bellow show:

i think accordion panel map within hbox, map panel having hgrow set , button resizing accordion panel hide/unhide it. also, want mini-map on top of both windows.

however, have no thought how set buttons there. tried many different layouts , tricks, have found no actual solution. cannot find examples, , unfortunately 2 books bought not go beyond given layouts. there way this?

also, while not priority, javafx have capability drag , drop components (p.ex. minimap) , lock on place? user perhaps want minimap down-right corner instead?

i suggest using/writing custom pane.

add map, sidebar, sidebar togglebutton, minimap togglebutton , minimap children. (don't forget phone call tofront() , toback accordingly set the elements in right layers.)

now there 2 ways on how position elements:

overwrite layoutchildren() method of stackpane , set coordinate of components there relocate(x,y) or resizerelocate(x,y,width,height). or set managed property of aforementioned elements false (setmanaged(false)) , bind layoutx , layouty properties desired values.

if going #1 (not code, idea):

the minimap button, should left bottom so: x = 0 | y = pane.getheight() - button.getheight() the sidebar button should left center: x = sidebar.getwidth() - button.getwidth() | y = pane.getheight() / 2 - button.getheight() / 2 and on...

if going #2 (again not tested code):

the minimap button: setlayoutx(0) | layouty.bind(pane.heightproperty()) the sidebar button: layoutxproperty.bind(sidebar.widthproperty().subtract(button.widthproperty)) | `layoutyproperty.bind(pane.heightproperty().divide(2).subtract(button.heightproperty().divide(2))) and on...

and yes can move minimap mouse gestures have @ setonmousepressed , setonmousedragged. first event typically store current coordinate , sec event calculate delta adjust layoutx/layouty values.

edit:

you might have @ controlsfx, have hiddensidespane , masterdetailpane might (partly) looking for.

javafx

No comments:

Post a Comment