diff --git a/src/main/java/ruscz/game/gameOfProd/Dialog/Dialog.java b/src/main/java/ruscz/game/gameOfProd/Dialog/Dialog.java index 19c9705..d15a2d2 100644 --- a/src/main/java/ruscz/game/gameOfProd/Dialog/Dialog.java +++ b/src/main/java/ruscz/game/gameOfProd/Dialog/Dialog.java @@ -1,6 +1,7 @@ package ruscz.game.gameOfProd.Dialog; import ruscz.game.gameOfProd.Image.ImageDialog; +import ruscz.game.gameOfProd.Windows.WindowOfFreeMove; import javax.swing.*; import java.awt.*; @@ -38,20 +39,21 @@ public class Dialog { public JLabel prepareDialogBar(String string) { - Font f1 = new Font("Times New Roman", Font.PLAIN, 20); + int cellSize = WindowOfFreeMove.CELL_SIZE; + Font f1 = new Font("Times New Roman", Font.PLAIN, cellSize / 2); JLabel text = new JLabel(); text.setText(string); text.setFont(f1); - text.setForeground(Color.BLUE.darker().darker().darker().darker().darker().darker().darker().darker().darker().darker().darker().darker()); + text.setForeground(Color.BLACK); text.setVisible(true); Dimension size = text.getPreferredSize(); if (imageDialog != null) { - text.setBounds(120, 20, size.width, size.height); + text.setBounds(cellSize * 3, cellSize / 2, size.width, size.height); dialogBar.setImageDialog(imageDialog); } else { - text.setBounds(20, 20, size.width, size.height); + text.setBounds(cellSize / 2, cellSize / 2, size.width, size.height); dialogBar.unsetImageDialog(); } @@ -67,7 +69,6 @@ public class Dialog { if (dialogBar.getComponentCount() != 0) dialogBar.remove(0); dialogBar.add(textToShow); - dialogBar.revalidate(); charNumber++; if (charNumber == textLength) { timer.stop(); diff --git a/src/main/java/ruscz/game/gameOfProd/Dialog/DialogBar.java b/src/main/java/ruscz/game/gameOfProd/Dialog/DialogBar.java index b9773b5..f662339 100644 --- a/src/main/java/ruscz/game/gameOfProd/Dialog/DialogBar.java +++ b/src/main/java/ruscz/game/gameOfProd/Dialog/DialogBar.java @@ -19,11 +19,16 @@ public class DialogBar extends JPanel { @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); + 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(), 10, 10, 91,91, this); + g.drawImage(imageDialog.getImage(), WindowOfFreeMove.CELL_SIZE / 4, WindowOfFreeMove.CELL_SIZE / 4, + WindowOfFreeMove.CELL_SIZE * WindowOfFreeMove.WINDOW_HEIGHT / 4 - WindowOfFreeMove.CELL_SIZE / 2, + WindowOfFreeMove.CELL_SIZE * WindowOfFreeMove.WINDOW_HEIGHT / 4 - WindowOfFreeMove.CELL_SIZE / 2, + this); } + this.paintChildren(g); } }