0% found this document useful (0 votes)
38 views4 pages

MAin

This document defines a Java class called Main that provides a graphical user interface for analyzing bug datasets. The interface contains buttons to upload a bug dataset, calculate fix durations, perform DBSCAN and SOM clustering algorithms, view clustering results, complexity mappings, and execution time charts. It uses Swing components like JFrames, JPanels, JLabels, JButtons to build the interface.

Uploaded by

Sinduja Baskaran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views4 pages

MAin

This document defines a Java class called Main that provides a graphical user interface for analyzing bug datasets. The interface contains buttons to upload a bug dataset, calculate fix durations, perform DBSCAN and SOM clustering algorithms, view clustering results, complexity mappings, and execution time charts. It uses Swing components like JFrames, JPanels, JLabels, JButtons to build the interface.

Uploaded by

Sinduja Baskaran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

package com;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JPanel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JPasswordField;
import javax.swing.JOptionPane;
import java.io.File;
import javax.swing.JFileChooser;
import java.awt.Cursor;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.FileReader;
import java.awt.Cursor;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
import java.util.Map;
import org.jfree.ui.RefineryUtilities;
import javax.swing.UIManager;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
public class Main extends JFrame{
LineBorder border;
TitledBorder title;
JPanel p1;
JPanel p2;
JLabel l1,l2;
JButton b1,b2,b3,b4,b5,b6,b7,b8,b9;
Font f1;
JFileChooser chooser;
File file;
JScrollPane jsp;
static JTextArea area;
static long db,som;
ViewComplexity vcc;
public Main(){
super("Bug Estimation");

p1 = new JPanel();
p1.setLayout(null);
border = new LineBorder(new Color(42,140,241),1,true);
title = new TitledBorder (border,"Modules
Information",TitledBorder.CENTER,TitledBorder.DEFAULT_POSITION, new
Font("Tahoma",Font.BOLD,16),Color.darkGray);
p1.setBorder(title);
f1 = new Font("Times New Roman",Font.BOLD,14);
p2 = new TitlePanel(600,60);
p2.setBackground(new Color(204, 110, 155));
l1 = new JLabel("<HTML><BODY><CENTER>Predicting Software Defect Complexity
and Accuracy Using<br/>Bug Estimation and
Clustering</CENTER></BODY></HTML>".toUpperCase());
l1.setFont(new Font("Courier New",Font.BOLD,16));
p2.add(l1);
l1.setForeground(Color.white);

l2 = new JLabel("Upload Bugzilla Dataset");


l2.setFont(new Font("Courier New",Font.BOLD,13));
l2.setBounds(330,20,300,30);
p1.add(l2);

b1 = new JButton("Upload Bug Dataset");


b1.setFont(f1);
b1.setBounds(280,60,420,30);
p1.add(b1);
b1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
int option = chooser.showOpenDialog(Main.this);
if(option == chooser.APPROVE_OPTION){
file = chooser.getSelectedFile();
JOptionPane.showMessageDialog(Main.this,"Dataset
Uploaded");
}
}
});

b5 = new JButton("Calculate Fix Duration");


b5.setFont(f1);
b5.setBounds(280,110,420,30);
p1.add(b5);
b5.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
Cursor hourglassCursor = new Cursor(Cursor.WAIT_CURSOR);
setCursor(hourglassCursor);
ReadDataset.readDataset(file.getPath());
Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
setCursor(normalCursor);

}
});

b2 = new JButton("Estimate Fix Duration & Dbscan Clustering");


b2.setFont(f1);
b2.setBounds(280,160,420,30);
p1.add(b2);
b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
long start = System.currentTimeMillis();
ViewClusters vc = new ViewClusters();
vcc = new ViewComplexity();
DBScan.readData(vc);
DBScan.estimate();
DBScan.assignComplexity(vcc);
long end = System.currentTimeMillis();
db = end - start;
JOptionPane.showMessageDialog(Main.this,"Estimate process
completed\nDBScan Run Time : "+db+" Milli.Sec");
vc.setVisible(true);
vc.setSize(800,600);
}
});
b8 = new JButton("SOM Clustering");
b8.setFont(f1);
b8.setBounds(280,210,420,30);
p1.add(b8);
b8.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
try{
ProcessData.process(file.getPath());
long start = System.currentTimeMillis();
SOMCluster.som(new File("dataset/temp.txt"));
long end = System.currentTimeMillis();
som = end - start;
JOptionPane.showMessageDialog(Main.this,"SOM Run Time :
"+som+" Milli.Sec");
}catch(Exception e){
e.printStackTrace();
}
}
});

b3 = new JButton("Complexity Cluster Mapping");


b3.setFont(f1);
b3.setBounds(280,260,420,30);
p1.add(b3);
b3.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
vcc.setVisible(true);
vcc.setSize(600,400);
}
});

b6 = new JButton("Cluster Identity");


b6.setFont(f1);
b6.setBounds(280,310,420,30);
p1.add(b6);
b6.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
ClusterIdentity ci = new ClusterIdentity();
ci.setVisible(true);
ci.setSize(600,400);
}
});

b4 = new JButton("Complexity Cluster Chart");


b4.setFont(f1);
b4.setBounds(280,360,420,30);
p1.add(b4);
b4.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
Chart chart1 = new Chart("Complexity Cluster Chart");
chart1.pack();
RefineryUtilities.centerFrameOnScreen(chart1);
chart1.setVisible(true);
}
});

b4 = new JButton("DBscan & SOM Clustering Execution Time Chart");


b4.setFont(f1);
b4.setBounds(280,410,420,30);
p1.add(b4);
b4.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
TimeChart chart1 = new TimeChart("Complexity Cluster Chart");
chart1.pack();
RefineryUtilities.centerFrameOnScreen(chart1);
chart1.setVisible(true);
}
});

b7 = new JButton("Exit");
b7.setFont(f1);
b7.setBounds(280,460,420,30);
p1.add(b7);
b7.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
System.exit(0);
}
});

area = new JTextArea();


area.setEditable(false);
area.setFont(f1);
jsp = new JScrollPane(area);
jsp.setBounds(100,510,600,130);
p1.add(jsp);

chooser = new JFileChooser(new File("dataset"));


getContentPane().add(p1,BorderLayout.CENTER);
getContentPane().add(p2,BorderLayout.NORTH);
}
public static void main(String a[])throws Exception{
UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
Main pr = new Main();
pr.setVisible(true);
pr.setExtendedState(JFrame.MAXIMIZED_BOTH);
}
}

You might also like