Dialog Background
This commit is contained in:
parent
ffa592bc3e
commit
b5064f6484
@ -43,7 +43,7 @@ public class Dialog {
|
|||||||
JLabel text = new JLabel();
|
JLabel text = new JLabel();
|
||||||
text.setText(string);
|
text.setText(string);
|
||||||
text.setFont(f1);
|
text.setFont(f1);
|
||||||
text.setForeground(Color.red);
|
text.setForeground(Color.yellow);
|
||||||
text.setVisible(true);
|
text.setVisible(true);
|
||||||
Dimension size = text.getPreferredSize();
|
Dimension size = text.getPreferredSize();
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package ruscz.game.gameOfProd.Dialog;
|
package ruscz.game.gameOfProd.Dialog;
|
||||||
|
|
||||||
import ruscz.game.gameOfProd.Image.ImageDialog;
|
import ruscz.game.gameOfProd.Image.ImageDialog;
|
||||||
|
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@ -19,8 +20,10 @@ public class DialogBar extends JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
super.paint(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){
|
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 {
|
public class ImageDialog {
|
||||||
private String name;
|
private String name;
|
||||||
private Image image;
|
private Image image;
|
||||||
|
private static Image dialogBack;
|
||||||
|
|
||||||
public Image getImage() {
|
public Image getImage() {
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Image getDialogBack() {return dialogBack;}
|
||||||
|
|
||||||
public ImageDialog(String name){
|
public ImageDialog(String name){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
parseImage();
|
parseImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void parseBackground() {
|
||||||
|
try {
|
||||||
|
dialogBack = ImageIO.read(new File("src/main/resources/DialogBox.png"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void parseImage(){
|
private void parseImage(){
|
||||||
try {
|
try {
|
||||||
image = ImageIO.read(new File("src/main/resources/" + name));
|
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