import java.awt.*;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.event.*;
public class View extends JFrame{
private static final String INIT_VALUE = "1";
private JButton createBtn = new JButton("Create");
private JButton modifyBtn = new JButton("Modify");
private JButton deleteBtn = new JButton("Delete");
private JButton checkVulBtn = new JButton("Check Vulnerabilities");
private JButton searchVulBtn = new JButton("Search Vulnerabilities");
private JTextField choiceTxt = new JTextField(10);
private JTextField fileNameTxt = new JTextField(10);
private Model mod;
public View(Model model){ //constructor
mod = model;
setBounds(100, 100, 450, 300);
JPanel content = new JPanel();
content.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(content);
content.setLayout(new FlowLayout());
createBtn.setBounds(98, 66, 264, 29);
modifyBtn.setBounds(98, 66, 264, 29);
deleteBtn.setBounds(98, 66, 264, 29);
checkVulBtn.setBounds(98, 107, 264, 29);
searchVulBtn.setBounds(98, 148, 264, 29);
content.add(new JLabel("What would you like to do?"));
content.add(createBtn);
content.add(modifyBtn);
content.add(deleteBtn);
content.add(checkVulBtn);
content.add(searchVulBtn);
this.setContentPane(content);
this.pack();
this.setTitle("Vulnerability Assessment Tool");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void modifyView(){
setBounds(100, 100, 450, 300);
JPanel content = new JPanel();
content.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(content);
content.setLayout(new FlowLayout());
modifyBtn.setBounds(98, 66, 264, 29);
content.add(new JLabel("Enter the name of the profile you would like to modify: "));
content.add(fileNameTxt);
}
public String getInput(){
return fileNameTxt.getText();
}
public void addModifyListener(ActionListener modl){
modifyBtn.addActionListener(modl);
}
}