Package placeholder.ui

Source Code of placeholder.ui.TabbedSimpleUI

package placeholder.ui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.io.PrintStream;
import java.util.ArrayList;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;

import placeholder.check.CheckServices;
import placeholder.ui.panel.SimplePanel;
import placeholder.website.queue.WebsiteQueue;
import placeholder.website.queue.WebsiteResultQueue;
import placeholder.website.queue.http.HttpWebsiteQueue;
import placeholder.website.queue.http.HttpWebsiteResultQueue;

/**
* @author Heiko Bornholdt
*/
public class TabbedSimpleUI extends JFrame {
  private static final long serialVersionUID = 1L;

  protected final ArrayList<SimplePanel> tabs = new ArrayList<SimplePanel>();
  protected JTabbedPane tabbedPane;
 
  public static void main(String[] args) {
    try {
      CheckServices.load();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }

    PrintStream out = System.out;
    final WebsiteQueue queue = new HttpWebsiteQueue(out);
    final WebsiteResultQueue resultQueue = new HttpWebsiteResultQueue(out);

    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        new TabbedSimpleUI(queue, resultQueue);
      }
    });
  }
 
  public TabbedSimpleUI(WebsiteQueue queue, WebsiteResultQueue resultQueue) {
    super("Plaecholder");
    this.setLayout(new BorderLayout());
   
    this.createTabbedPanel();
   
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.setPreferredSize(new Dimension(400, 225));
    this.pack();
    this.setLocationRelativeTo(null);
    this.setVisible(true);

    int number = new Integer(JOptionPane.showInputDialog("Enter number of crawlers you want start:"));
   
    for (int i = 0; i < number; i++) {
      SimplePanel panel = new SimplePanel(queue, resultQueue);
      this.tabs.add(panel);
      this.tabbedPane.addTab(new Integer(i + 1).toString(), (Component)panel);
    }
  }

  private void createTabbedPanel() {
    this.tabbedPane = new JTabbedPane();
    this.add(BorderLayout.CENTER, this.tabbedPane);
  }
}
TOP

Related Classes of placeholder.ui.TabbedSimpleUI

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.