com.alee.laf.progressbar.WebProgressBar Java Examples

The following examples show how to use com.alee.laf.progressbar.WebProgressBar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ADBPullFileMonitor.java    From CXTouch with GNU General Public License v3.0 6 votes vote down vote up
private void initView() {
    JPanel contentPane = (JPanel) getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.setBorder(BorderFactory.createEmptyBorder(6, 4, 6, 4));

    //title label
    titleText = new WebLabel(" ");
    contentPane.add(titleText, BorderLayout.NORTH);
    //progress bar
    progressBar = new WebProgressBar() {
        @Override
        public Dimension getPreferredSize ()
        {
            final Dimension ps = super.getPreferredSize ();
            if ( preferredProgressWidth > 0 )
            {
                ps.width = preferredProgressWidth;
            }
            return ps;
        }
    };
    progressBar.setStringPainted(true);
    progressBar.setMaximum(100);
    progressBar.setMinimum(0);
    contentPane.add(progressBar, BorderLayout.CENTER);
}
 
Example #2
Source File: ExplorationCustomInfoPanel.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor
 * @param siteName the site name.
 * @param completion the completion level.
 */
ExplorationSitePanel(String siteName, double completion) {
	// Use JPanel constructor.
	super();

	this.completion = completion;

	setLayout(new GridLayout(1, 2, 3, 3));

	WebPanel namePanel = new WebPanel(new FlowLayout(FlowLayout.RIGHT, 3, 3));
	namePanel.setAlignmentX(CENTER_ALIGNMENT);
	add(namePanel);

	WebLabel nameLabel = new WebLabel("  " + Conversion.capitalize(siteName), SwingConstants.RIGHT);
	nameLabel.setAlignmentX(CENTER_ALIGNMENT);
	namePanel.add(nameLabel);

	WebPanel barPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT, 3, 0));
	barPanel.setAlignmentX(CENTER_ALIGNMENT);
	add(barPanel);

	completionBar = new WebProgressBar(0, 100);
	completionBar.setAlignmentX(CENTER_ALIGNMENT);
	completionBar.setStringPainted(true);
	completionBar.setValue((int) (completion * 100D));
	barPanel.add(completionBar);
}
 
Example #3
Source File: MalfunctionPanel.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
	 * Constructs a MalfunctionPanel object with a name prefix.
	 * @param malfunction the malfunction to display
	 */
	public MalfunctionPanel(Malfunction malfunction) {

		// Call JPanel constructor.
		super();

		// Initialize data members.
		this.malfunction = malfunction;

		// Set layout
		setLayout(new GridLayout(3, 1, 0, 0));

		// Set border
		setBorder(new MarsPanelBorder());
		setOpaque(false);
		setBackground(new Color(0,0,0,128));

		// Prepare name label.
		nameLabel = new WebLabel(malfunction.getName(), WebLabel.CENTER);
		if (!malfunction.isEmergencyRepairDone()) {
			nameLabel.setText(malfunction.getName() + " - Emergency");
			nameLabel.setForeground(Color.red);
		}
		add(nameLabel);

		// Prepare repair pane.
		WebPanel repairPane = new WebPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
		add(repairPane);

		// Prepare repair progress bar.
		WebProgressBar repairBar = new WebProgressBar();
		repairBarModel = repairBar.getModel();
		repairBar.setStringPainted(true);
		repairPane.add(repairBar);

		// Set initial value for repair progress bar.
//		double totalRequiredWork = malfunction.getEmergencyWorkTime() + malfunction.getGeneralWorkTime()
//				+ malfunction.getEVAWorkTime();
//		double totalCompletedWork = malfunction.getCompletedEmergencyWorkTime() +
//				malfunction.getCompletedGeneralWorkTime() + malfunction.getCompletedEVAWorkTime();
//		int percentComplete = 0;
//		if (totalRequiredWork > 0D) percentComplete = (int) (100D * (totalCompletedWork / totalRequiredWork));
		repairBarModel.setValue((int)malfunction.getPercentageFixed());

		// Prepare repair parts label.
		partsLabel = new WebLabel(getPartsString(), WebLabel.CENTER);
		partsLabel.setPreferredSize(new Dimension(-1, -1));
		add(partsLabel);

		// Add tooltip.
		setToolTipText(getToolTipString());
	}
 
Example #4
Source File: MeteorologyStudyFieldMissionCustomInfoPanel.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor.
 * 
 * @param desktop the main desktop pane.
 */
public MeteorologyStudyFieldMissionCustomInfoPanel(MainDesktopPane desktop) {
	// Use MissionCustomInfoPanel constructor.
	super();

	// Initialize data members.
	this.desktop = desktop;

	// Set layout.
	setLayout(new BorderLayout());

	// Create content panel.
	WebPanel contentPanel = new WebPanel(new GridLayout(3, 1));
	add(contentPanel, BorderLayout.NORTH);

	// Create study panel.
	WebPanel studyPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentPanel.add(studyPanel);

	// Create science tool button.
	WebButton scienceToolButton = new WebButton(ImageLoader.getIcon(Msg.getString("img.science"))); //$NON-NLS-1$
	scienceToolButton.setMargin(new Insets(1, 1, 1, 1));
	scienceToolButton
			.setToolTipText(Msg.getString("MeteorologyStudyFieldMissionCustomInfoPanel.tooltip.openInScienceTool")); //$NON-NLS-1$
	scienceToolButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent arg0) {
			displayStudyInScienceTool();
		}
	});
	studyPanel.add(scienceToolButton);

	// Create study title label.
	WebLabel studyTitleLabel = new WebLabel(
			Msg.getString("MeteorologyStudyFieldMissionCustomInfoPanel.meteorologyFieldStudy")); //$NON-NLS-1$
	studyPanel.add(studyTitleLabel);

	// Create study name label.
	studyNameLabel = new WebLabel(""); //$NON-NLS-1$
	studyPanel.add(studyNameLabel);

	// Create researcher panel.
	WebPanel researcherPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentPanel.add(researcherPanel);

	// Create researcher title label.
	WebLabel researcherTitleLabel = new WebLabel(
			Msg.getString("MeteorologyStudyFieldMissionCustomInfoPanel.leadResearcher")); //$NON-NLS-1$
	researcherPanel.add(researcherTitleLabel);

	// Create researcher name label.
	researcherNameLabel = new WebLabel(""); //$NON-NLS-1$
	researcherPanel.add(researcherNameLabel);

	// Create study research panel.
	WebPanel studyResearchPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentPanel.add(studyResearchPanel);

	// Create study research title label.
	WebLabel studyResearchTitleLabel = new WebLabel(
			Msg.getString("MeteorologyStudyFieldMissionCustomInfoPanel.researchCompletion")); //$NON-NLS-1$
	studyResearchPanel.add(studyResearchTitleLabel);

	// Create study research progress bar.
	studyResearchBar = new WebProgressBar(0, 100);
	studyResearchBar.setStringPainted(true);
	studyResearchPanel.add(studyResearchBar);
}
 
Example #5
Source File: AreologyStudyFieldMissionCustomInfoPanel.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor.
 * @param desktop the main desktop pane.
 */
public AreologyStudyFieldMissionCustomInfoPanel(MainDesktopPane desktop) {
	// Use MissionCustomInfoPanel constructor.
	super();

	// Initialize data members.
	this.desktop = desktop;

	// Set layout.
	setLayout(new BorderLayout());

	// Create content panel.
	WebPanel contentPanel = new WebPanel(new GridLayout(3, 1));
	add(contentPanel, BorderLayout.NORTH);

	// Create study panel.
	WebPanel studyPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentPanel.add(studyPanel);

	// Create science tool button.
	WebButton scienceToolButton = new WebButton(ImageLoader.getIcon(Msg.getString("img.science"))); //$NON-NLS-1$
	scienceToolButton.setMargin(new Insets(1, 1, 1, 1));
	scienceToolButton.setToolTipText(Msg.getString("AreologyStudyFieldMissionCustomInfoPanel.tooltip.openInScienceTool")); //$NON-NLS-1$
	scienceToolButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent arg0) {
			displayStudyInScienceTool();
		}
	});
	studyPanel.add(scienceToolButton);

	// Create study title label.
	WebLabel studyTitleLabel = new WebLabel(Msg.getString("AreologyStudyFieldMissionCustomInfoPanel.areologyFieldStudy")); //$NON-NLS-1$
	studyPanel.add(studyTitleLabel);

	// Create study name label.
	studyNameLabel = new WebLabel(""); //$NON-NLS-1$
	studyPanel.add(studyNameLabel);

	// Create researcher panel.
	WebPanel researcherPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentPanel.add(researcherPanel);

	// Create researcher title label.
	WebLabel researcherTitleLabel = new WebLabel(Msg.getString("AreologyStudyFieldMissionCustomInfoPanel.leadResearcher")); //$NON-NLS-1$
	researcherPanel.add(researcherTitleLabel);

	// Create researcher name label.
	researcherNameLabel = new WebLabel(""); //$NON-NLS-1$
	researcherPanel.add(researcherNameLabel);

	// Create study research panel.
	WebPanel studyResearchPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentPanel.add(studyResearchPanel);

	// Create study research title label.
	WebLabel studyResearchTitleLabel = new WebLabel(Msg.getString("AreologyStudyFieldMissionCustomInfoPanel.researchCompletion")); //$NON-NLS-1$
	studyResearchPanel.add(studyResearchTitleLabel);

	// Create study research progress bar.
	studyResearchBar = new WebProgressBar(0, 100);
	studyResearchBar.setStringPainted(true);
	studyResearchPanel.add(studyResearchBar);
}
 
Example #6
Source File: BiologyStudyFieldMissionCustomInfoPanel.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor.
 * 
 * @param desktop the main desktop pane.
 */
public BiologyStudyFieldMissionCustomInfoPanel(MainDesktopPane desktop) {
	// Use MissionCustomInfoPanel constructor.
	super();

	// Initialize data members.
	this.desktop = desktop;

	// Set layout.
	setLayout(new BorderLayout());

	// Create content panel.
	WebPanel contentPanel = new WebPanel(new GridLayout(3, 1));
	add(contentPanel, BorderLayout.NORTH);

	// Create study panel.
	WebPanel studyPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentPanel.add(studyPanel);

	// Create science tool button.
	WebButton scienceToolButton = new WebButton(ImageLoader.getIcon(Msg.getString("img.science"))); //$NON-NLS-1$
	scienceToolButton.setMargin(new Insets(1, 1, 1, 1));
	scienceToolButton
			.setToolTipText(Msg.getString("BiologyStudyFieldMissionCustomInfoPanel.tooltip.openInScienceTool")); //$NON-NLS-1$
	scienceToolButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent arg0) {
			displayStudyInScienceTool();
		}
	});
	studyPanel.add(scienceToolButton);

	// Create study title label.
	WebLabel studyTitleLabel = new WebLabel(
			Msg.getString("BiologyStudyFieldMissionCustomInfoPanel.biologyFieldStudy")); //$NON-NLS-1$
	studyPanel.add(studyTitleLabel);

	// Create study name label.
	studyNameLabel = new WebLabel(""); //$NON-NLS-1$
	studyPanel.add(studyNameLabel);

	// Create researcher panel.
	WebPanel researcherPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentPanel.add(researcherPanel);

	// Create researcher title label.
	WebLabel researcherTitleLabel = new WebLabel(
			Msg.getString("BiologyStudyFieldMissionCustomInfoPanel.leadResearcher")); //$NON-NLS-1$
	researcherPanel.add(researcherTitleLabel);

	// Create researcher name label.
	researcherNameLabel = new WebLabel(""); //$NON-NLS-1$
	researcherPanel.add(researcherNameLabel);

	// Create study research panel.
	WebPanel studyResearchPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentPanel.add(studyResearchPanel);

	// Create study research title label.
	WebLabel studyResearchTitleLabel = new WebLabel(
			Msg.getString("BiologyStudyFieldMissionCustomInfoPanel.researchCompletion")); //$NON-NLS-1$
	studyResearchPanel.add(studyResearchTitleLabel);

	// Create study research progress bar.
	studyResearchBar = new WebProgressBar(0, 100);
	studyResearchBar.setStringPainted(true);
	studyResearchPanel.add(studyResearchBar);
}
 
Example #7
Source File: ConstructionMissionCustomInfoPanel.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor.
 * @param desktop the main desktop panel.
 */
public ConstructionMissionCustomInfoPanel(MainDesktopPane desktop) {
    // Use MissionCustomInfoPanel constructor.
    super();

    // Initialize data members.
    this.desktop = desktop;

    // Set layout.
    setLayout(new BorderLayout());

    WebPanel contentsPanel = new WebPanel(new GridLayout(4, 1));
    add(contentsPanel, BorderLayout.NORTH);

    WebPanel titlePanel = new WebPanel(new FlowLayout(FlowLayout.CENTER));
    contentsPanel.add(titlePanel);

    String titleLabelString = Msg.getString("ConstructionMissionCustomInfoPanel.titleLabel"); //$NON-NLS-1$
    WebLabel titleLabel = new WebLabel(titleLabelString);
    titlePanel.add(titleLabel);

    WebPanel settlementPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
    contentsPanel.add(settlementPanel);

    String settlementLabelString = Msg.getString("ConstructionMissionCustomInfoPanel.settlementLabel"); //$NON-NLS-1$
    WebLabel settlementLabel = new WebLabel(settlementLabelString);
    settlementPanel.add(settlementLabel);

    settlementButton = new WebButton("   ");
    settlementPanel.add(settlementButton);
    settlementButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (mission != null) {
                Settlement settlement = mission.getAssociatedSettlement();
                if (settlement != null) getDesktop().openUnitWindow(settlement, false);
            }
        }
    });

    WebPanel stagePanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
    contentsPanel.add(stagePanel);

    String stageLabelString = Msg.getString("ConstructionMissionCustomInfoPanel.stageLabel"); //$NON-NLS-1$
    stageLabel = new WebLabel(stageLabelString);
    stagePanel.add(stageLabel);

    WebPanel progressBarPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
    contentsPanel.add(progressBarPanel);

    WebProgressBar progressBar = new WebProgressBar();
    progressBarModel = progressBar.getModel();
    progressBar.setStringPainted(true);
    progressBarPanel.add(progressBar);

    WebPanel lowerContentsPanel = new WebPanel(new BorderLayout(0, 0));
    add(lowerContentsPanel, BorderLayout.CENTER);
    
    // Create remaining construction materials label panel.
    WebPanel remainingMaterialsLabelPane = new WebPanel(new FlowLayout(FlowLayout.LEFT));
    lowerContentsPanel.add(remainingMaterialsLabelPane, BorderLayout.NORTH);

    // Create remaining construction materials label.
    String remainingMaterialsLabelString = Msg.getString("ConstructionMissionCustomInfoPanel.remainingMaterialsLabel"); //$NON-NLS-1$
    WebLabel remainingMaterialsLabel = new WebLabel(remainingMaterialsLabelString);
    remainingMaterialsLabelPane.add(remainingMaterialsLabel);

    // Create a scroll pane for the remaining construction materials table.
    WebScrollPane remainingMaterialsScrollPane = new WebScrollPane();
    remainingMaterialsScrollPane.setPreferredSize(new Dimension(-1, -1));
    lowerContentsPanel.add(remainingMaterialsScrollPane, BorderLayout.CENTER);

    // Create the remaining construction materials table and model.
    remainingMaterialsTableModel = new RemainingMaterialsTableModel();
    WebTable remainingMaterialsTable = new WebTable(remainingMaterialsTableModel);
    remainingMaterialsScrollPane.setViewportView(remainingMaterialsTable);

    // Add tooltip.
    setToolTipText(getToolTipString());
}
 
Example #8
Source File: SalvageMissionCustomInfoPanel.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor.
 * @param desktop the main desktop panel.
 */
public SalvageMissionCustomInfoPanel(MainDesktopPane desktop) {
	// Use MissionCustomInfoPanel constructor.
	super();

	// Initialize data members.
	this.desktop = desktop;

	// Set layout.
	setLayout(new BorderLayout());

	WebPanel contentsPanel = new WebPanel(new GridLayout(4, 1));
	add(contentsPanel, BorderLayout.NORTH);

	WebPanel titlePanel = new WebPanel(new FlowLayout(FlowLayout.CENTER));
	contentsPanel.add(titlePanel);

	WebLabel titleLabel = new WebLabel("Salvage Construction Site");
	titlePanel.add(titleLabel);

	WebPanel settlementPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentsPanel.add(settlementPanel);

	WebLabel settlementLabel = new WebLabel("Settlement: ");
	settlementPanel.add(settlementLabel);

	settlementButton = new WebButton("   ");
	settlementPanel.add(settlementButton);
	settlementButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			if (mission != null) {
				Settlement settlement = mission.getAssociatedSettlement();
				if (settlement != null) getDesktop().openUnitWindow(settlement, false);
			}
		}
	});

	WebPanel stagePanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentsPanel.add(stagePanel);

	stageLabel = new WebLabel("Stage:");
	stagePanel.add(stageLabel);

	WebPanel progressBarPanel = new WebPanel(new FlowLayout(FlowLayout.LEFT));
	contentsPanel.add(progressBarPanel);

	WebProgressBar progressBar = new WebProgressBar();
	progressBarModel = progressBar.getModel();
	progressBar.setStringPainted(true);
	progressBarPanel.add(progressBar);

	// Add tooltip.
	setToolTipText(getToolTipString());
}
 
Example #9
Source File: WebProgressDialog.java    From weblaf with GNU General Public License v3.0 4 votes vote down vote up
public WebProgressBar getProgressBar ()
{
    return progressBar;
}