1
0

Fix focus component

This commit is contained in:
Victor 2014-03-22 22:03:05 +02:00
parent 9a34bfda4a
commit 3cd0451765

View File

@ -4,7 +4,6 @@ import com.annimon.turrets.util.GuiUtil;
import java.awt.Component; import java.awt.Component;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JLayer; import javax.swing.JLayer;
import javax.swing.WindowConstants;
/** /**
* *
@ -27,7 +26,6 @@ public class Main extends JFrame {
public Main() { public Main() {
super("Turrets"); super("Turrets");
setFocusable(true);
setResizable(Constants.RESIZABLE); setResizable(Constants.RESIZABLE);
setLocationByPlatform(true); setLocationByPlatform(true);
setDefaultCloseOperation(EXIT_ON_CLOSE); setDefaultCloseOperation(EXIT_ON_CLOSE);
@ -44,6 +42,8 @@ public class Main extends JFrame {
public void switchLayout(Component component) { public void switchLayout(Component component) {
getContentPane().removeAll(); getContentPane().removeAll();
getContentPane().add(component); getContentPane().add(component);
component.setFocusable(true);
component.requestFocus();
pack(); pack();
} }
} }