Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.kinjerjs.os;
- import java.awt.Color;
- import java.awt.Graphics;
- import java.util.Calendar;
- import java.util.GregorianCalendar;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- import javax.swing.JTextField;
- import fr.kinjerjs.fenetre.FenetreFrame;
- import fr.theshark34.swinger.Swinger;
- import fr.theshark34.swinger.event.SwingerEvent;
- import fr.theshark34.swinger.event.SwingerEventListener;
- import fr.theshark34.swinger.textured.STexturedButton;
- @SuppressWarnings("serial")
- public class OSPanel extends JPanel implements SwingerEventListener{
- private STexturedButton background = new STexturedButton(Swinger.getResource("background.png"),Swinger.getResource("ostache.png"));
- private JTextField rechercheapp = new JTextField();
- private STexturedButton application = new STexturedButton(Swinger.getResource("app.png"));
- private JLabel titleapplication = new JLabel("Fenetre");
- private STexturedButton ostache = new STexturedButton(Swinger.getResource("ostache.png"),Swinger.getResource("ostache.png"));
- private STexturedButton offtache = new STexturedButton(Swinger.getResource("off.png"));
- private STexturedButton offarrowtache = new STexturedButton(Swinger.getResource("offarrow.png"));
- private STexturedButton os = new STexturedButton(Swinger.getResource("os bouton.png"),Swinger.getResource("os bouton hide.png"));
- private STexturedButton btbureau = new STexturedButton(Swinger.getResource("barretache.png"));
- private STexturedButton barretache = new STexturedButton(Swinger.getResource("barretache.png"),Swinger.getResource("ostache.png"));
- private JLabel heure = new JLabel("00:00");
- private JLabel date = new JLabel("04/04/2004");
- public OSPanel() {
- date();
- ostache();
- setLayout(null);
- offtache.setBounds(250,520,50,15);
- offtache.addEventListener(this);
- offtache.setVisible(false);
- add(offtache);
- offarrowtache.setBounds(300,520,10,15);
- offarrowtache.addEventListener(this);
- offarrowtache.setVisible(false);
- add(offarrowtache);
- rechercheapp.setForeground(Color.BLACK);
- rechercheapp.setBounds(18, 518, 210, 20);
- rechercheapp.setVisible(false);
- add(rechercheapp);
- application.setBounds(10,10);
- application.addEventListener(this);
- add(application);
- titleapplication.setBounds(22,60,50,50);
- titleapplication.setFont(titleapplication.getFont().deriveFont(13.0F));
- titleapplication.setForeground(Color.WHITE);
- add(titleapplication);
- heure.setBounds(900, 540, 50, 50);
- add(heure);
- date.setBounds(885, 555, 70, 50);
- add(date);
- os.setBounds(0, 547);
- os.addEventListener(this);
- add(os);
- btbureau.setBounds(960, 547,10,50);
- btbureau.addEventListener(this);
- add(btbureau);
- barretache.setBounds(0, 547);
- add(barretache);
- ostache.setBounds(0, 131,0,0);
- ostache.addEventListener(this);
- add(ostache);
- background.setBounds( 0, 0,1600,900 );
- background.addEventListener(this);
- add(background);
- }
- public void ostache() {
- }
- //public static boolean ostachebool = false;
- public static boolean osclic = true;
- @Override
- public void onEvent(SwingerEvent e) {
- if(e.getSource() == os && osclic == true) {
- OSPanel.this.setOstache(true);
- osclic = false;
- }else if(e.getSource() == os && osclic == false){
- OSPanel.this.setOstache(false);
- osclic = true;
- }
- if(e.getSource() == background) {
- OSPanel.this.setOstache(false);
- osclic = true;
- }
- if(e.getSource() == offtache) {
- System.exit(0);
- }
- if(e.getSource() == application) {
- FenetreFrame fen= new FenetreFrame();
- }
- }
- public void setOstache(boolean t) {
- if(t == false) {
- ostache.setBounds(0, 131,0,0);
- rechercheapp.setVisible(t);
- offtache.setVisible(t);
- offarrowtache.setVisible(t);
- }else if (t == true) {
- ostache.setBounds(0, 131);
- rechercheapp.setVisible(t);
- offtache.setVisible(t);
- offarrowtache.setVisible(t);
- }
- }
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- //g.drawImage(ostache, 0, 131, this);
- }
- public void date() {
- Thread clock = new Thread(){
- public void run() {
- for(;;) {
- Calendar Cal = new GregorianCalendar();
- //int sconde = Cal.get(Calendar.SECOND);
- int minute = Cal.get(Calendar.MINUTE);
- int hour = Cal.get(Calendar.HOUR);
- int jour = Cal.get(Calendar.DATE);
- int mois = Cal.get(Calendar.MONTH)+1;
- int an = Cal.get(Calendar.YEAR);
- if (hour == 1) {
- }
- heure.setText(hour + ":"+ minute);
- date.setText(" "+jour +"/"+ mois+"/"+an);
- try {
- sleep(1000);
- }catch(InterruptedException ex){
- Logger.getLogger(Calendar.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
- };
- clock.start();
- }
- }
- --------------------------------------------------------------------------------------------------------------
- package fr.kinjerjs.fenetre;
- import javax.swing.JFrame;
- import fr.theshark34.swinger.Swinger;
- public class FenetreFrame extends JFrame {
- private static final long serialVersionUID = 519422512460448887L;
- private static FenetreFrame instance;
- private FenetrePanel fenetrepanel;
- public FenetreFrame() {
- setTitle("Fenetre test");
- setSize(975, 625);
- setDefaultCloseOperation(3);
- setLocationRelativeTo(null);
- setIconImage(Swinger.getResource("os bouton.png"));
- setContentPane(this.fenetrepanel = new FenetrePanel());
- setResizable(false);
- setVisible(true);
- }
- public static void main(String[] args) {
- Swinger.setSystemLookNFeel();
- Swinger.setResourcePath("/src/");
- instance = new FenetreFrame();
- }
- public static FenetreFrame getInstance() {
- return instance;
- }
- public FenetrePanel getLauncherPanel() {
- return this.fenetrepanel;
- }
- }
- -----------------------------------------------------------------------------------------------
- package fr.kinjerjs.fenetre;
- import java.awt.Graphics;
- import javax.swing.JPanel;
- import fr.theshark34.swinger.Swinger;
- import fr.theshark34.swinger.event.SwingerEvent;
- import fr.theshark34.swinger.event.SwingerEventListener;
- import fr.theshark34.swinger.textured.STexturedButton;
- @SuppressWarnings("serial")
- public class FenetrePanel extends JPanel implements SwingerEventListener {
- private STexturedButton background = new STexturedButton(Swinger.getResource("background.png"));
- public FenetrePanel() {
- setLayout(null);
- }
- @Override
- public void onEvent(SwingerEvent e) {
- }
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- // g.drawImage(ostache, 0, 131, this);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement