java - how the size of jpanel components in a specific layout can be set? -


I am making a beginning and I want to design a GUI of Windows Calculator in Java. I have set some granutout with some pockets in each I set the size of such buttons:

  jButton [i] .setPreferredSize (new dimension (42, 42 ));   

But the differen jpanels buttons do not have the same size. What should I do?

  pocket [i] .setPreferredSize (new dimension (42, 42));   

There are 3 easy ways to maximize the button.

  • Use a large sign for the button
  • Use a large font for the button ( Preferably through a PLF)
  • Set a large margin around text and icons.

    To set the preferred size, look (yes.)

    If you still intend to go that route, consult @trashgod and < Em> Override Choose the preferred size instead

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -