java - JMenuBar makes JFrame "jump" -


i creating java application of sea map, use jframe canvas draw sea itself. have gui on top of jpanel. added jmenubar jpanel different functions. however, noticed the newly added menubar 'pushes application' downwards ~10-15 pixels — , when zoom/pan map, map makes weird 'jumps' – trying readjust.

does know why happens?

nine out of ten, need looking @ insets.

it's been while since used swing directly, containers have method called getinsets(). returns insets object, describing size of border of container--including jframe. jmenubars tend nudge insets bit, leaving 2 two main options.

what recommend doing drawing jpanel, placed in jframe; don't have worry jmenubar. use panel canvas instead.

the other option poll insets @ time of drawing, , alter coordinates accordingly; have recommend against if can still avoid it, runs against of modular programming instincts.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -