anon
anon

Reputation: 3

Simple java layout question

I have a somewhat simple question, but I have been looking for a solution and not finding it, since I am having some time problems I will ask here

I am programming a simple game in java(since I am still learning), and in the using a borderlayout, since it fits perfectly what I want, 3 buttons on the bottom and a internalframe in the north with the game screen, however I also require a toolbar on the top,is there anyway I can change the layout so it allows me to do this, or a any simple workaround? This type of layout is perfect for what I want and the others ones don't really please me.

I know this is probably a silly question but any help would be welcome

Upvotes: 0

Views: 123

Answers (2)

ebeprogrammer
ebeprogrammer

Reputation: 36

If I am not mistaken, you may add a menu to a JFrame and still have the borderlayout be in the frame. The menu would be above the top internal panel and the three buttons (having to be in a panel themselves) could be put into the south section of the frame. All of this should work without any problems. Just wondering, how bug is the internal panel? Is it the entire rest of the screen or only the top sliver? If its the rest of the screen, then put it in center, and for a sliver, put it in the north section.

Upvotes: 0

alexcoco
alexcoco

Reputation: 6665

What if you add a JPanel that contains two other panels: one for your buttons and one for the content you want above north? Or you can similarly split up other regions by putting a panel that contains other panels or components.

Edit: You can put your toolbar in the north and the rest of your components can sit in a new panel which can be placed in the center.

Upvotes: 2

Related Questions