package ruscz.game.gameOfProd.Dialog; import ruscz.game.gameOfProd.Image.ImageDialog; import ruscz.game.gameOfProd.Windows.WindowOfFreeMove; import javax.swing.*; import java.awt.*; public class DialogBar extends JPanel { private ImageDialog imageDialog; public void setImageDialog(ImageDialog imageDialog) { this.imageDialog = imageDialog; } public void unsetImageDialog(){ imageDialog = null; } @Override public void paint(Graphics g) { super.paint(g); ImageDialog.parseBackground(); g.drawImage(ImageDialog.getDialogBack(), 0, 0, WindowOfFreeMove.CELL_SIZE * WindowOfFreeMove.WINDOW_WIDTH, WindowOfFreeMove.CELL_SIZE * WindowOfFreeMove.WINDOW_HEIGHT / 4, this); if (imageDialog != null){ g.drawImage(imageDialog.getImage(), WindowOfFreeMove.CELL_SIZE / 4, WindowOfFreeMove.CELL_SIZE / 4 + 3, WindowOfFreeMove.CELL_SIZE * WindowOfFreeMove.WINDOW_HEIGHT / 4 - WindowOfFreeMove.CELL_SIZE / 2, WindowOfFreeMove.CELL_SIZE * WindowOfFreeMove.WINDOW_HEIGHT / 4 - WindowOfFreeMove.CELL_SIZE / 2 - 3, this); } this.paintChildren(g); } }