Dialog Background
This commit is contained in:
parent
ffa592bc3e
commit
b5064f6484
@ -43,7 +43,7 @@ public class Dialog {
|
||||
JLabel text = new JLabel();
|
||||
text.setText(string);
|
||||
text.setFont(f1);
|
||||
text.setForeground(Color.red);
|
||||
text.setForeground(Color.yellow);
|
||||
text.setVisible(true);
|
||||
Dimension size = text.getPreferredSize();
|
||||
|
||||
|
||||
@ -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.*;
|
||||
@ -19,8 +20,10 @@ 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);
|
||||
if (imageDialog != null){
|
||||
g.drawImage(imageDialog.getImage(), 0, 0, this);
|
||||
g.drawImage(imageDialog.getImage(), 10, 10, 91,91, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,16 +8,27 @@ import java.io.IOException;
|
||||
public class ImageDialog {
|
||||
private String name;
|
||||
private Image image;
|
||||
private static Image dialogBack;
|
||||
|
||||
public Image getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public static Image getDialogBack() {return dialogBack;}
|
||||
|
||||
public ImageDialog(String name){
|
||||
this.name = name;
|
||||
parseImage();
|
||||
}
|
||||
|
||||
public static void parseBackground() {
|
||||
try {
|
||||
dialogBack = ImageIO.read(new File("src/main/resources/DialogBox.png"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void parseImage(){
|
||||
try {
|
||||
image = ImageIO.read(new File("src/main/resources/" + name));
|
||||
@ -27,4 +38,6 @@ public class ImageDialog {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
BIN
src/main/resources/DialogBox.png
Normal file
BIN
src/main/resources/DialogBox.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Loading…
x
Reference in New Issue
Block a user