skip to main | skip to sidebar

Java Programs and Examples with Output

Pages

▼
 
  • RSS
  • Twitter
Friday, October 5, 2012

Process Tracker in Java

Posted by Raju Gupta at 10:55 PM – 0 comments
 
Process Tracker is a java tool, using which we can map excel sheets present in different shared folders of the project/domain and access them through a single user interface

package src;
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class SimpleButtonAction extends JFrame {

 JButton butt1 = new JButton(prop.getProperty("nameOfButton1"));
 JButton butt2 = new JButton(prop.getProperty("nameOfButton2"));
 JButton butt3 = new JButton(prop.getProperty("nameOfButton3"));
 JButton butt4 = new JButton(prop.getProperty("nameOfButton4")); 
 JButton butt5 = new JButton(prop.getProperty("nameOfButton5"));
 JButton butt6 = new JButton(prop.getProperty("nameOfButton6"));
 JButton butt7 = new JButton(prop.getProperty("nameOfButton7"));
 
 JLabel label = new JLabel("");
 protected Object parentJFrame;
 private static Properties prop = new Properties();
 
 public SimpleButtonAction() {
  super("Process Tracker");  
  setSize(300,150);
  setLayout(new FlowLayout());
  add(butt1);
  add(butt2);
  add(butt3);
  add(butt4);
  add(butt5);
  add(butt6); 
  add(butt7);  
  add(label);
  setVisible(true);
  
  final String pathOfExcel = prop.getProperty("EXCEL");
  butt1.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent ae) {    
    try {
     Runtime.getRuntime().exec(pathOfExcel +" " +prop.getProperty("Java"));
    } catch (IOException e1) {
     e1.printStackTrace();
    }   
   }
  });
  
  butt2.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent ae) {    
    try {
     Runtime.getRuntime().exec(pathOfExcel +" " +prop.getProperty("Certifications"));
    } catch (IOException e1) {
     e1.printStackTrace();
    }
   }
  });
  
  butt3.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent ae) {    
    try {
     Runtime.getRuntime().exec(pathOfExcel +" " +prop.getProperty("Clarity"));
    } catch (IOException e1) {
     e1.printStackTrace();
    }
   }
  });
  
  butt4.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent ae) {    
    try {
     Runtime.getRuntime().exec(pathOfExcel +" " +prop.getProperty("JSP"));
    } catch (IOException e1) {
     e1.printStackTrace();
    }
   }
  });
  
  butt5.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent ae) {    
    try {
     Runtime.getRuntime().exec(pathOfExcel +" " +prop.getProperty("SERVLET"));
    } catch (IOException e1) {
     e1.printStackTrace();
    }
   }
  });
  
  butt6.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent ae) {    
    try {
     Runtime.getRuntime().exec(pathOfExcel +" " +prop.getProperty("JSF"));
    } catch (IOException e1) {
     e1.printStackTrace();
    }
   }
  });
  
  butt7.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent ae) {    
    try {
     Runtime.getRuntime().exec(pathOfExcel +" " +prop.getProperty("Struts"));
    } catch (IOException e1) {
     e1.printStackTrace();
    }
   }
  }); 
  label.setText("Click a button to open the appropriate excel sheet");
 }
 
 public static void main(String[] args) {
  try {
   FileInputStream fIn = new FileInputStream("D:\\Tools\\ProcessTracker\\ProcessTrackerPaths.properties");
   prop.load(fIn);
  } catch(Exception e) {
   System.out.println("Cannot read Property file.. ");
   e.printStackTrace();
  }
  new SimpleButtonAction();  
 }
}

Leave a Reply

Newer Post Older Post
Subscribe to: Post Comments ( Atom )
  • Popular
  • Recent
  • Archives
Powered by Blogger.
 
 
 
© 2011 Java Programs and Examples with Output | Designs by Web2feel & Fab Themes

Bloggerized by DheTemplate.com - Main Blogger