Skip to content
Snippets Groups Projects
Commit 98751da3 authored by PIQUEREZ Corentin's avatar PIQUEREZ Corentin
Browse files

updated ShukanViewBar.java

parent b4c49a30
No related branches found
No related tags found
No related merge requests found
.idea
.out
out
sae2.01-developpement-application.iml
\ No newline at end of file
......@@ -29,6 +29,7 @@ public class Shukan
ShukanData data = new ShukanData ();
ShukanIO io = new ShukanIO (data);
// Handling edition mode
if (args.length > 0)
if (args[0].equals ("edit"))
......@@ -40,6 +41,7 @@ public class Shukan
// Creating Shukan viewer
JFrame frame = new JFrame ("SHUKAN 1.6");
ShukanView canvas = new ShukanView (data, io);
ShukanViewBar barre = new ShukanViewBar(io, data);
// Getting the display size
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
......@@ -66,6 +68,7 @@ public class Shukan
}
});
// Setting the window geometry
frame.add (canvas);
Insets ins = frame.getInsets ();
......
package shukan;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.io.File;
public class ShukanViewBar extends JPanel {
/** File manager */
private ShukanIO myIO = null;
/** Displayed data */
private ShukanData data = null;
private String[] imagesName = {"save", "back", "plus", "delete", "left", "right", "export", "parameter"};
private String imagesExtension = ".png";
public ShukanViewBar(ShukanIO myIO, ShukanData data){
this.myIO = myIO;
......@@ -15,9 +19,31 @@ public class ShukanViewBar extends JPanel {
}
@Override
public void paintComponents(Graphics g) {
public void paintComponent(Graphics g) {
super.paintComponents(g);
setSize(getWidth(), 80);
// load images
try{
for(int i = 0; i<imagesName.length; i++){
Image im = ImageIO.read(new File("data/images/"+imagesName[i]+imagesExtension));
g.drawImage(im, i*(100), 0, this);
}
}
catch(Exception e){System.out.println("Image manquante");}
}
public static void main(String args[]){
ShukanData data = new ShukanData ();
ShukanIO io = new ShukanIO (data);
EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame f = new JFrame("esssai");
ShukanViewBar s = new ShukanViewBar (io,data);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(s);
f.pack();
f.setVisible(true);
}
});
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment