Salmononius2
Salmononius2

Reputation: 295

Swing - Irregular button array layout

Is there some way to have a set of JButton objects that aren't in a standard 'Grid' shape? I'm specifically looking to make a set of buttons that are different shapes and sizes, like the bottom two rows of the Microsoft Calculator.

Here is an example of what I want the buttons to look like:

Bottom two rows, Microsoft Calculator

Upvotes: 3

Views: 89

Answers (1)

Alex
Alex

Reputation: 4473

GridBagLayout is natural choice for requested layout. You can spread buttons evenly, occupy range of cells or even choose size for each particular cell. Here is good example.

Upvotes: 2

Related Questions