Fullscreen demo and JFram without title
This commit is contained in:
parent
5e92ce66d0
commit
ebc662ffa0
@ -28,6 +28,7 @@ public class WindowOfFreeMove extends JFrame {
|
|||||||
public static final int KEY_RIGHT = 39;
|
public static final int KEY_RIGHT = 39;
|
||||||
public static final int KEY_DOWN = 40;
|
public static final int KEY_DOWN = 40;
|
||||||
public static final int KEY_EVENT = 69;
|
public static final int KEY_EVENT = 69;
|
||||||
|
public static final int KEY_FULLSCREEN = 115;
|
||||||
|
|
||||||
private Canvas canvas;
|
private Canvas canvas;
|
||||||
private DialogBar dialogBar;
|
private DialogBar dialogBar;
|
||||||
@ -109,6 +110,14 @@ public class WindowOfFreeMove extends JFrame {
|
|||||||
addKeyListener(new KeyAdapter() {
|
addKeyListener(new KeyAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
|
if (e.getKeyCode() == KEY_FULLSCREEN){
|
||||||
|
if (getExtendedState() == MAXIMIZED_BOTH)
|
||||||
|
setExtendedState(NORMAL);
|
||||||
|
else
|
||||||
|
setExtendedState(MAXIMIZED_BOTH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (canPersonMove) {
|
if (canPersonMove) {
|
||||||
nextMove = e.getKeyCode();
|
nextMove = e.getKeyCode();
|
||||||
inputTimer.start();
|
inputTimer.start();
|
||||||
@ -130,10 +139,9 @@ public class WindowOfFreeMove extends JFrame {
|
|||||||
lp.add(canvas, JLayeredPane.PALETTE_LAYER);
|
lp.add(canvas, JLayeredPane.PALETTE_LAYER);
|
||||||
lp.add(dialogBar, JLayeredPane.POPUP_LAYER);
|
lp.add(dialogBar, JLayeredPane.POPUP_LAYER);
|
||||||
|
|
||||||
|
|
||||||
setTitle("Ahoj");
|
|
||||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||||
setBounds(0, 0, CELL_SIZE * WINDOW_WIDTH, CELL_SIZE * WINDOW_HEIGHT + CELL_SIZE / 2);
|
setUndecorated(true);
|
||||||
|
setBounds(0, 0, CELL_SIZE * WINDOW_WIDTH, CELL_SIZE * WINDOW_HEIGHT);
|
||||||
setLocationRelativeTo(null);
|
setLocationRelativeTo(null);
|
||||||
setResizable(false);
|
setResizable(false);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user