java - Creating a GUI using setBounds() -


i read bad use setbounds() command creating guis.

i know how use layout managers , have have disadvantages.

i'm programming game @ moment , need stack components above each other. found no way using layout managers, setbounds() works perfectly.

could explain how can stack components using layout managers , tell me why bad use setbounds() method purpose? or fine, in conjunction game guis coded in java?

layoutmanagers take lot of weight off shoulders when comes stuff calculating correct size of control, position in right place when gui resized etc.

basically tell layout manager "i want control on there in corner" , layout manager responsible keeping there, whatever happens window, whether user resizes it, moves around,...

a game interface more dynamically elements moving around. layout managers not particularly @ stuff, designed static user interfaces. desktop software (citation needed? ;) ) utilizes such static interfaces , layout managers there programmers of such interfaces don't have bother details stated above.

as game interface use case thats not ideal layout manager, absolutely justifiable not use everything. still use combination of both techniques - use layout manager position static interface elements (you ought have menu button somewhere or similar?) use absolute positioning dynamic elements moving around.

still, i'd recommend looking javafx, stated in comment above. more better suited draw animated, moving components , should save lot of work.

of course there exceptions - example sudoku interface can layout managers, although game.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -