java - Setting the size of panels -
I have 3 panels, a main panel with 2 small panels.
For the main panel, I used
setPreferredSize (new dimension (350, 190));
For the small left panel, I used
setPreferredSize (new dimension (100, 190));
For the small right panel, I used
setPreferredSize (new dimension (250, 190));
But smaller panels reside in the same size. How can I fix this?
This is my main code in the panel
import model. *; Import java.awt. *; Import javax.swing. *; Jepailel spreads in the public category panel {public panel (jail gel) {setup}; Construction (jail); } Private zero setup () {setBorder (BorderFactory.createLineBorder (Color.blue)); Set Layout (new border layout (1, 1)); Setpriffer Size (new dimension (350, 190)); } Private Zero Construction (Prison Gel) {JetBuddPan Tab = New JetBubben (); Tab.addTab ("Input", blank, new input pin (), "input"); Tab.addTab ("display", blank, new display panel (), "display"); (Tab); }}
Do not do that.
The overall position of layout managers is to allow dynamic resizing, not just for user-resetable windows, but also for texts (internationalization) and various default font sizes and fonts. Change is necessary.
If you simply, they will take care of the size of the panel when the user increases the size of the window, to avoid spreading its components across the screen, with the left-left flow layout an external The panel and the rest of the single UI have to be kept as a single child - which is filled with its preferred size and any surplus background color.
Comments
Post a Comment