swing - Which Java text component should I be using to get it to resize to fit the frame as it is resized? -
i have jtabbedpane , jtextarea, want textareas/panes resize fit window when window resized. how do this? i'm fuzzy on if it's right text component use.
really muddled.
edit: setting explicit size dumb dumb. i've got worked out. did set viewport of jscrollpane jtextarea , remove explicit sizing.
thanks chaps!
you can use whatever components like. jcomponents
can resize resizing parent container. need choose correct layoutmanager
.
depending on how want set up, assume want add jtabbedpane jframe
so:
jtabbedpane jtp; jframe frame; // jframe's default layour border layout. frame.add(jtp, borderlayout.center);
this cause jtabbed
pane take of space of jframe
.
you need set jtabbedpane
's layout manager borderlayout
, , tab add jtabbedpane need have borderlayout
.
to set layout of components, do:
jcomponent anycomponent; anycomponent.setlayout(new borderlayout());
have @ java layoutmanager tutorials more information.
i should mention reason suggest borderlayout
because component added center
of borderlayout automatically take space not taken of borders. and, since aren't adding of other borders (north, south, east, west) component in center take entire space.
Comments
Post a Comment