java - Add component to top of JPanel -
i have vertically aligned elements in jpanel
, , want add 1 first position, not last one. there way that?
i tried using borderlayout
, adding elements borderlayout.north
replaced it.
use gridbaglayout or gridlayout jpanel. allow align elements vertically. can use add(component component, int index)
method provided component
class add new component first position.