1
0

Add method to switch layouts

This commit is contained in:
Victor 2014-03-12 23:14:17 +02:00
parent 1c2861f04f
commit f23f409164

View File

@ -1,6 +1,6 @@
package com.annimon.turrets;
import java.awt.Dimension;
import java.awt.Component;
import javax.swing.JFrame;
import javax.swing.JLayer;
import javax.swing.WindowConstants;
@ -24,7 +24,6 @@ public class Main extends JFrame {
public Main() {
super("Turrets");
setPreferredSize(new Dimension(Constants.WIDTH, Constants.HEIGHT));
setResizable(Constants.RESIZABLE);
setLocationByPlatform(true);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
@ -32,4 +31,10 @@ public class Main extends JFrame {
add(new JLayer<>(new MenuPanel(), new LayerUI.GradientBackground()));
pack();
}
public void switchLayout(Component component) {
getContentPane().removeAll();
getContentPane().add(component);
pack();
}
}