package control; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileNotFoundException; //import gui.ConnectionPanel; import gui.LabeledProgressBar; import gui.LabeledTextField; import gui.ListPanel; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import objects.Database; public class MainClass extends JFrame implements ActionListener{ private Controller controller; private JPanel mainPanel; private LabeledTextField urlPanel; private ListPanel urlListPanel; private ListPanel mailListPanel; // private ConnectionPanel connectionPanel; private LabeledProgressBar progressingPanel; private Database db=null; public MainClass(){ mainPanel=new JPanel(); urlPanel=new LabeledTextField("Url",20); urlListPanel=new ListPanel("Urls"); mailListPanel=new ListPanel("E-mails"); // connectionPanel=new ConnectionPanel(); progressingPanel=new LabeledProgressBar("Progress"); mainPanel.setLayout(new GridLayout(4,1)); setSize(600,500); setResizable(true); mainPanel.add(urlPanel); mainPanel.add(urlListPanel); mainPanel.add(mailListPanel); //mainPanel.add(connectionPanel); mainPanel.add(progressingPanel); setContentPane(mainPanel); pack(); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); // actionlisteners this.urlPanel.getJButton().addActionListener(this); this.urlPanel.getStopButton().addActionListener(this); // this.connectionPanel.getConnectButton().addActionListener(this); } public static void main(String[] args) { new MainClass(); /*Vector<String> mailList; mailList=new Vector(); mailList=Page.extractMails(ListPanel urlGuiList,ListPanel mailGuiList,Database db);*/ } // actions public void actionPerformed(ActionEvent src) { JButton source=(JButton)src.getSource(); if(source.getText().equals("Commencer")){ controller =Controller.getInstance(this.getUrlPanel().getText(),0,db); try { controller.process(this.getUrlListPanel(),this.getMailListPanel()); } catch (FileNotFoundException e) { e.printStackTrace(); } } if(source.getText().equals("Arréter")){ controller=null; } } // getters & setters public Controller getController() { return controller; } public void setController(Controller controller) { this.controller = controller; } public JPanel getMainPanel() { return mainPanel; } public void setMainPanel(JPanel mainPanel) { this.mainPanel = mainPanel; } public LabeledTextField getUrlPanel() { return urlPanel; } public void setUrlPanel(LabeledTextField urlPanel) { this.urlPanel = urlPanel; } public ListPanel getUrlListPanel() { return urlListPanel; } public void setUrlListPanel(ListPanel urlListPanel) { this.urlListPanel = urlListPanel; } public ListPanel getMailListPanel() { return mailListPanel; } public void setMailListPanel(ListPanel mailListPanel) { this.mailListPanel = mailListPanel; } public LabeledProgressBar getProgressingPanel() { return progressingPanel; } public void setProgressingPanel(LabeledProgressBar progressingPanel) { this.progressingPanel = progressingPanel; } }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question