public ArenaFrame(String title, Arena arena, String background, String battleBG, String cardBG) { setTitle(title); this.arena = arena; Toolkit tk = Toolkit.getDefaultToolkit(); Dimension screenSize = tk.getScreenSize(); width = (int) screenSize.getWidth(); height = (int) screenSize.getHeight(); posX = (width - Constant.BATTLEFIELD_WIDTH) / 2; posY = (height - Constant.BATTLEFIELD_HEIGHT - Constant.CARDPANEL_HEIGHT) / 2; skill_id = 0; addKeyListener(this); addMouseListener(this); addMouseMotionListener(this); setUndecorated(true); setExtendedState(JFrame.MAXIMIZED_BOTH); c = getContentPane(); c.setPreferredSize(new Dimension(width, height)); c.setLayout(null); battle_field = new BattleFieldPanel(Constant.BATTLEFIELD_WIDTH, Constant.BATTLEFIELD_HEIGHT, arena); battle_field.setBounds(posX, posY, Constant.BATTLEFIELD_WIDTH, Constant.BATTLEFIELD_HEIGHT); battle_field.setOpaque(false); c.add(battle_field); card_panel = new CardPanel(Constant.CARDPANEL_WIDTH, Constant.CARDPANEL_HEIGHT, arena); card_panel.setBounds( posX, posY + Constant.BATTLEFIELD_HEIGHT, Constant.CARDPANEL_WIDTH, Constant.CARDPANEL_HEIGHT); card_panel.setOpaque(false); c.add(card_panel); setSize(width, height); setBackground(background); setBattleFieldBackground(battleBG); setCardPanelBackground(cardBG); setResizable(false); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); setFocusable(true); }