Package ui.tabs

Source Code of ui.tabs.BandwidthTab

package ui.tabs;


import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;

import main.settings.Settings;

import bandwidth.network.ControlledInputStream;
import bandwidth.network.ControlledOutputStream;
import bandwidth.ui.GraphicManager;


public class BandwidthTab extends AbstractTab
{
  private static final long serialVersionUID = 315993929983569058L;

  private GraphicManager downloadGraphic;
  private GraphicManager uploadGraphic;

  public BandwidthTab()
  {
    GridLayout layout = new GridLayout(2, 1, 0, 0);
    layout.setVgap(4);
    setLayout(layout);

    JLabel downloadLabel = new JLabel("Download Bandwidth Usage");
    downloadGraphic = new GraphicManager(ControlledInputStream.getController());

    JPanel downloadPanel = new JPanel();
    downloadPanel.setLayout(new BorderLayout());
    downloadPanel.add(downloadLabel, BorderLayout.NORTH);
    downloadPanel.add(downloadGraphic, BorderLayout.CENTER);

    JLabel uploadLabel = new JLabel("Upload Bandwidth Usage");
    uploadGraphic = new GraphicManager(ControlledOutputStream.getController());

    JPanel uploadPanel = new JPanel();
    uploadPanel.setLayout(new BorderLayout());
    uploadPanel.add(uploadLabel, BorderLayout.NORTH);
    uploadPanel.add(uploadGraphic, BorderLayout.CENTER);

    add(downloadPanel);
    add(uploadPanel);

    if (!Settings.debug.deactivate_graphics_when_invisible)
    {
      downloadGraphic.activate();
      uploadGraphic.activate();
    }
  }

  public void onActivate()
  {
    if (Settings.debug.deactivate_graphics_when_invisible)
    {
      downloadGraphic.activate();
      uploadGraphic.activate();
    }
  }

  public void onDeactivate()
  {
    if (Settings.debug.deactivate_graphics_when_invisible)
    {
      downloadGraphic.deactivate();
      uploadGraphic.deactivate();
    }
  }

}
TOP

Related Classes of ui.tabs.BandwidthTab

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.