package net.oryanmat.gui.util.layout;

import javax.swing.*;
import java.awt.*;

@SuppressWarnings("UnusedDeclaration")
public class BorderLayoutBuilder<T extends JPanel> {
	private T panel;

	protected BorderLayoutBuilder(T panel, int horizontalGap, int verticalGap) {
		this.panel = panel;
		this.panel.setLayout(new BorderLayout(horizontalGap, verticalGap));
	}

	public T getPanel() {
		return this.panel;
	}

	public BorderLayoutBuilder<T> setCenter(Component component) {
		this.panel.add(component, BorderLayout.CENTER);
		return this;
	}

	public BorderLayoutBuilder<T> setNorth(Component component) {
		this.panel.add(component, BorderLayout.NORTH);
		return this;
	}

	public BorderLayoutBuilder<T> setSouth(Component component) {
		this.panel.add(component, BorderLayout.SOUTH);
		return this;
	}

	public BorderLayoutBuilder<T> setEast(Component component) {
		this.panel.add(component, BorderLayout.EAST);
		return this;
	}

	public BorderLayoutBuilder<T> setWest(Component component) {
		this.panel.add(component, BorderLayout.WEST);
		return this;
	}
}

@@ -36,30 +36,8 @@
 t;%0A%0A
-import javax.swing.*;%0A
 impo
@@ -138,14 +138,17 @@
 nds 
-JPanel
+Container
 %3E %7B%0A
@@ -158,21 +158,25 @@
 ivate T 
-panel
+container
 ;%0A%0A%09prot
@@ -203,21 +203,25 @@
 ilder(T 
-panel
+container
 , int ho
@@ -263,21 +263,29 @@
 his.
-panel = panel
+container = container
 ;%0A%09%09
@@ -289,21 +289,25 @@
 %0A%09%09this.
-panel
+container
 .setLayo
@@ -377,13 +377,17 @@
  get
-Panel
+Container
 () %7B
@@ -401,21 +401,25 @@
 rn this.
-panel
+container
 ;%0A%09%7D%0A%0A%09p
@@ -479,37 +479,41 @@
 onent) %7B%0A%09%09this.
-panel
+container
 .add(component, 
@@ -615,37 +615,41 @@
 onent) %7B%0A%09%09this.
-panel
+container
 .add(component, 
@@ -750,37 +750,41 @@
 onent) %7B%0A%09%09this.
-panel
+container
 .add(component, 
@@ -884,37 +884,41 @@
 onent) %7B%0A%09%09this.
-panel
+container
 .add(component, 
@@ -1029,13 +1029,17 @@
 his.
-panel
+container
 .add

replace JPanel with Container