java - How to add a JPanel in the center of another JPanel? -


i want add jpanel map on top of jpanel worldview in it's center

example

here code:

public class worldview extends jpanel implements actionlistener{  private jpanel map;  public worldview() throws ioexception{     this.setsize(1024,768);     this.setbackground(color.black);     map = new jpanel();     this.add(map); } 

you use gridbaglayout , modify gridbagconstraints#insets or emptyborder generate whitespace around component in combination gridbaglayout or other layout borderlayout example

see how use gridbaglayout , how use borders more details


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -