diff --git a/JAVA/PROJET-PMT_STRI1A/.classpath b/JAVA/PROJET-PMT_STRI1A/.classpath index a6fa10e..a36a9e1 100644 --- a/JAVA/PROJET-PMT_STRI1A/.classpath +++ b/JAVA/PROJET-PMT_STRI1A/.classpath @@ -1,20 +1,23 @@ - + - + - + + + + diff --git a/JAVA/PROJET-PMT_STRI1A/.settings/org.eclipse.jdt.core.prefs b/JAVA/PROJET-PMT_STRI1A/.settings/org.eclipse.jdt.core.prefs index e256158..af07d5f 100644 --- a/JAVA/PROJET-PMT_STRI1A/.settings/org.eclipse.jdt.core.prefs +++ b/JAVA/PROJET-PMT_STRI1A/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,12 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.release=enabled -org.eclipse.jdt.core.compiler.source=11 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/JAVA/PROJET-PMT_STRI1A/TeamCristal_0.png b/JAVA/PROJET-PMT_STRI1A/TeamCristal_0.png new file mode 100644 index 0000000..80db681 Binary files /dev/null and b/JAVA/PROJET-PMT_STRI1A/TeamCristal_0.png differ diff --git a/JAVA/PROJET-PMT_STRI1A/src/.classpath b/JAVA/PROJET-PMT_STRI1A/src/.classpath new file mode 100755 index 0000000..3f3893a --- /dev/null +++ b/JAVA/PROJET-PMT_STRI1A/src/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/JAVA/PROJET-PMT_STRI1A/src/.project b/JAVA/PROJET-PMT_STRI1A/src/.project new file mode 100755 index 0000000..0f6f6a7 --- /dev/null +++ b/JAVA/PROJET-PMT_STRI1A/src/.project @@ -0,0 +1,17 @@ + + + src + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/JAVA/PROJET-PMT_STRI1A/src/gui/Background.java b/JAVA/PROJET-PMT_STRI1A/src/gui/Background.java new file mode 100644 index 0000000..12dbc41 --- /dev/null +++ b/JAVA/PROJET-PMT_STRI1A/src/gui/Background.java @@ -0,0 +1,33 @@ +/** + * + */ +package gui; + +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.GridBagLayout; + +import javax.swing.ImageIcon; +import javax.swing.JPanel; + +/** + * @author nicolas + * + */ +public class Background extends JPanel{ + private ImageIcon image; + public Background(String path) { + super(); + //this.setLayout(new FlowLayout()); + this.image=new ImageIcon(path); + } + public void setBackground(ImageIcon back) { + this.image=back; + } + public void paintComponent(Graphics gr) { + super.paintComponent(gr); + gr.drawImage(image.getImage(),0,0,this); + + } + +} diff --git a/JAVA/PROJET-PMT_STRI1A/src/gui/Boutton.java b/JAVA/PROJET-PMT_STRI1A/src/gui/Boutton.java new file mode 100644 index 0000000..56b4361 --- /dev/null +++ b/JAVA/PROJET-PMT_STRI1A/src/gui/Boutton.java @@ -0,0 +1,30 @@ +/** + * + */ +package gui; + +import java.awt.Color; +import java.awt.FlowLayout; + +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.SwingConstants; + +/** + * @author nicolas + * + */ +public class Boutton extends JButton { + public Boutton(String txt) { + super(txt); + //this.setLayout(new FlowLayout()); + setForeground(Color.WHITE); + setOpaque(true); + setContentAreaFilled(false); + setBorderPainted(true); + setFocusPainted(false); + setHorizontalAlignment(SwingConstants.CENTER); + setVerticalAlignment(SwingConstants.CENTER); + + } +} diff --git a/JAVA/PROJET-PMT_STRI1A/src/gui/jeu.java b/JAVA/PROJET-PMT_STRI1A/src/gui/jeu.java index 5d53b49..7fb064e 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/gui/jeu.java +++ b/JAVA/PROJET-PMT_STRI1A/src/gui/jeu.java @@ -4,12 +4,23 @@ package gui; import java.awt.BorderLayout; +import java.awt.Color; + +import gui.Boutton; +import gui.Background; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GraphicsConfiguration; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; import java.awt.HeadlessException; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; import java.nio.file.attribute.AclEntry.Builder; +import javax.imageio.ImageIO; +import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; @@ -24,34 +35,46 @@ import org.eclipse.swt.SWT; public class jeu extends JFrame { - public jeu() { + public jeu() throws IOException { super(); build(); } - public void build() { + public void build() throws IOException{ setTitle("Jeu"); - setSize(800,600); + setSize(593,283); setLocationRelativeTo(null); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel center = new JPanel(); - Dimension taille = new Dimension(200,200); - center.setPreferredSize(taille); - center.add(new JButton("Jouer")); - this.setLayout(new BorderLayout()); - this.getContentPane().add(buildContentPane(), BorderLayout.NORTH); - this.getContentPane().add(center, BorderLayout.CENTER); + + + JLabel container = new JLabel(new ImageIcon(this.image())); + + + container.setLayout(new GridBagLayout()); + JButton test2 = new JButton("Nouvelle Partie"); + JButton test =new JButton("Continuer"); + + GridBagConstraints c = new GridBagConstraints(); + c.gridx = 0; + c.gridy = 0; + container.add(test); + + c.gridx = 1; + c.gridy=0; + container.add(test2); + + this.setContentPane(container); + this.setVisible(true); } public JPanel buildContentPane() { - JPanel panel =new JPanel(); - Dimension preferredSize = new Dimension(200,200); - panel.setLayout(new FlowLayout()); - JLabel label = new JLabel("Jeu Dragon Donjon"); - panel.add(label); - return panel; + + } + public BufferedImage image() throws IOException { + BufferedImage image = ImageIO.read(new File("/home/nicolas/eclipse-workspace/Projet_Java/JAVA/PROJET-PMT_STRI1A/test.jpg")); + return image; } diff --git a/JAVA/PROJET-PMT_STRI1A/src/gui/main.java b/JAVA/PROJET-PMT_STRI1A/src/gui/main.java index 61f7e89..37b5714 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/gui/main.java +++ b/JAVA/PROJET-PMT_STRI1A/src/gui/main.java @@ -4,6 +4,7 @@ package gui; import java.awt.Dialog; +import java.io.IOException; import javax.swing.SwingUtilities; @@ -21,7 +22,13 @@ public class main { SwingUtilities.invokeLater(new Runnable(){ public void run(){ //On crée une nouvelle instance de notre JDialog - jeu fenetre = new jeu(); + jeu fenetre = null; + try { + fenetre = new jeu(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } fenetre.setVisible(true);//On la rend visible } }); diff --git a/JAVA/PROJET-PMT_STRI1A/swing2swt.jar b/JAVA/PROJET-PMT_STRI1A/swing2swt.jar new file mode 100644 index 0000000..0c090c4 Binary files /dev/null and b/JAVA/PROJET-PMT_STRI1A/swing2swt.jar differ diff --git a/JAVA/PROJET-PMT_STRI1A/test.jpg b/JAVA/PROJET-PMT_STRI1A/test.jpg new file mode 100755 index 0000000..5adc90b Binary files /dev/null and b/JAVA/PROJET-PMT_STRI1A/test.jpg differ