joueur posé (à redimensionner avec bufferedimage) et icone jeu
This commit is contained in:
parent
bfc7fb6379
commit
3853b91635
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
|
|
@ -1,6 +1,8 @@
|
|||
package graphique;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class JPanelDessin extends JPanel {
|
||||
|
|
@ -30,10 +32,12 @@ public class JPanelDessin extends JPanel {
|
|||
int x, y;
|
||||
width = this.getWidth();
|
||||
height = this.getHeight();
|
||||
System.out.println("width = "+width);
|
||||
System.out.println("height = "+height);
|
||||
x=0;
|
||||
y=0;
|
||||
while (y<height) {
|
||||
g.setColor(new Color(235, 235, 235));
|
||||
g.setColor(new Color(1, 255, 0));
|
||||
g.drawLine(0, y, width, y);
|
||||
y= y + height/11;
|
||||
}
|
||||
|
|
@ -42,6 +46,7 @@ public class JPanelDessin extends JPanel {
|
|||
g.drawLine(x, 0, x, height);
|
||||
x= x + width/11;
|
||||
}
|
||||
|
||||
|
||||
// // Affiche un cercle noir au centre
|
||||
// g.setColor(Color.black);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ public class JPanelImage extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//import java.awt.*;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class MaJFrame extends JFrame {
|
|||
private JLabel lblZombicide;
|
||||
private JPanel panelInfo;
|
||||
private JButton btnDeplacer;
|
||||
private JButton btnTuer;
|
||||
private JButton btnAttaquer;
|
||||
private JSpinner deplacementX;
|
||||
private JSpinner deplacementY;
|
||||
private JLabel lblDepX;
|
||||
|
|
@ -94,6 +94,7 @@ public class MaJFrame extends JFrame {
|
|||
* @throws IOException
|
||||
*/
|
||||
public MaJFrame() throws IOException {
|
||||
setIconImage(Toolkit.getDefaultToolkit().getImage(MaJFrame.class.getResource("/images/zombie.png")));
|
||||
// création et variable contentPane
|
||||
setTitle("Zombicide");
|
||||
setBackground(new Color(128, 0, 0));
|
||||
|
|
@ -159,11 +160,10 @@ public class MaJFrame extends JFrame {
|
|||
|
||||
|
||||
//ajout joueur
|
||||
lblJoueur = new JLabel();//"map1.jpg"
|
||||
lblJoueur.setText("J");
|
||||
lblJoueur = new JLabel();
|
||||
lblJoueur.setForeground(new Color(255, 128, 0));
|
||||
joueurIcon = new ImageIcon("joueur.png");
|
||||
lblJoueur.setIcon(joueurIcon);
|
||||
//joueurIcon = new ImageIcon("joueur.png");
|
||||
lblJoueur.setIcon(new ImageIcon(MaJFrame.class.getResource("/images/joueur.png")));
|
||||
GridBagConstraints gbc_joueur = new GridBagConstraints();
|
||||
gbc_joueur.fill = GridBagConstraints.CENTER;
|
||||
gbc_joueur.gridx = 2;
|
||||
|
|
@ -337,17 +337,17 @@ public class MaJFrame extends JFrame {
|
|||
gbc_deplacementY.gridy = 8;
|
||||
panelInfo.add(deplacementY, gbc_deplacementY);
|
||||
|
||||
//création boutonTuer
|
||||
btnTuer = new JButton("Tuer");
|
||||
btnTuer.addActionListener(new ActionListener() {
|
||||
//création boutonAttaquer
|
||||
btnAttaquer = new JButton("Attaquer");
|
||||
btnAttaquer.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
});
|
||||
GridBagConstraints gbc_btnTuer = new GridBagConstraints();
|
||||
gbc_btnTuer.fill = GridBagConstraints.BOTH;
|
||||
gbc_btnTuer.gridx = 0;
|
||||
gbc_btnTuer.gridy = 10;
|
||||
panelInfo.add(btnTuer, gbc_btnTuer);
|
||||
GridBagConstraints gbc_btnAttaquer = new GridBagConstraints();
|
||||
gbc_btnAttaquer.fill = GridBagConstraints.BOTH;
|
||||
gbc_btnAttaquer.gridx = 0;
|
||||
gbc_btnAttaquer.gridy = 10;
|
||||
panelInfo.add(btnAttaquer, gbc_btnAttaquer);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Loading…
Reference in New Issue