panel display intro
This commit is contained in:
parent
31571fcd99
commit
a253732423
Binary file not shown.
|
After Width: | Height: | Size: 367 KiB |
|
|
@ -28,9 +28,12 @@ import java.awt.event.ActionEvent;
|
|||
import javax.swing.JList;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.AbstractListModel;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class MyInterface extends JFrame {
|
||||
|
||||
|
|
@ -161,14 +164,15 @@ public class MyInterface extends JFrame {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void clicButtonStart() {
|
||||
this.instantiateSimu();
|
||||
int introduction = introduction();
|
||||
int depth = askDifficulty();
|
||||
int time=askTime();
|
||||
game.setAutoPlayerDepth(depth);
|
||||
game.setDefaultSetup();
|
||||
}
|
||||
|
||||
public void clickButtonAdder() {
|
||||
panelDraw.toggleAdderMode();
|
||||
}
|
||||
|
|
@ -326,4 +330,37 @@ public class MyInterface extends JFrame {
|
|||
default: return 4; // 10 min
|
||||
}
|
||||
}
|
||||
private int introduction() {
|
||||
|
||||
int boardWidth = 600;
|
||||
int boardHeight = 600;
|
||||
String imagePath = "image_OOP.png"; // replace with your actual image path
|
||||
ImageIcon originalIcon = new ImageIcon(imagePath);
|
||||
|
||||
// Check if the image was loaded successfully
|
||||
if (originalIcon.getImageLoadStatus() != MediaTracker.COMPLETE) {
|
||||
JOptionPane.showMessageDialog(this, "Error loading image: " + imagePath, "Image Error", JOptionPane.ERROR_MESSAGE);
|
||||
return 0; // Return or handle the error as needed
|
||||
}
|
||||
|
||||
Image originalImage = originalIcon.getImage();
|
||||
Image resizedImage = originalImage.getScaledInstance(boardWidth, boardHeight, Image.SCALE_SMOOTH);
|
||||
ImageIcon resizedIcon = new ImageIcon(resizedImage);
|
||||
|
||||
Object[] options = {"Start"};
|
||||
|
||||
int choice = JOptionPane.showOptionDialog(
|
||||
this,
|
||||
" ",
|
||||
" ",
|
||||
JOptionPane.DEFAULT_OPTION,
|
||||
JOptionPane.PLAIN_MESSAGE,
|
||||
resizedIcon,
|
||||
options,
|
||||
options[0]
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue