Java Code Examples for javax.swing.JProgressBar#setToolTipText()

The following examples show how to use javax.swing.JProgressBar#setToolTipText() . 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: CommunityDialog.java    From WorldGrower with GNU General Public License v3.0 7 votes vote down vote up
private void createDeitiesPanel(World world, int infoPanelWidth, int infoPanelHeight, JPanel infoPanel) {
	JPanel deitiesPanel = JPanelFactory.createJPanel("Deities");
	deitiesPanel.setLayout(null);
	deitiesPanel.setBounds(510, 363, infoPanelWidth + 5, infoPanelHeight);
	infoPanel.add(deitiesPanel, DEITIES_KEY);
	
	DeityAttributes deityAttributes = GroupPropertyUtils.getVillagersOrganization(world).getProperty(Constants.DEITY_ATTRIBUTES);
	String deityTooltip = "deity hapiness indicator: if a deity becomes unhappy, they may lash out against the population";
	
	for(int i=0; i<Deity.ALL_DEITIES.size(); i++) {
		Deity deity = Deity.ALL_DEITIES.get(i);
		Image image = imageInfoReader.getImage(deity.getBoonImageId(), null);
		JLabel nameLabel = JLabelFactory.createJLabel(deity.getName(), image);
		nameLabel.setBounds(15, 30 + 40 * i, 150, 50);
		nameLabel.setHorizontalAlignment(SwingConstants.LEFT);
		nameLabel.setToolTipText(deityTooltip);
		deitiesPanel.add(nameLabel);
		
		JProgressBar relationshipProgresBar = JProgressBarFactory.createHorizontalJProgressBar(deityAttributes.getMinHapinessValue(), deityAttributes.getMaxHapinessValue(), imageInfoReader);
		relationshipProgresBar.setBounds(175, 40 + 40 * i, 300, 30);
		relationshipProgresBar.setValue(deityAttributes.getHappiness(deity));
		relationshipProgresBar.setToolTipText(deityTooltip);
		deitiesPanel.add(relationshipProgresBar);
	}
}
 
Example 2
Source File: CreateKeyView.java    From pgptool with GNU General Public License v3.0 6 votes vote down vote up
private JPanel buildPanelButtons() {
	JPanel whole = new JPanel(new BorderLayout());

	progressBar = new JProgressBar(0, 100);
	progressBar.setToolTipText(Messages.text("phrase.generatingYourSecureKey"));
	progressBar.setIndeterminate(true);

	JPanel btns = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0));
	btns.setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10));
	btns.add(progressBar);
	btns.add(new JLabel("  "));
	btns.add(btnCreate = new JButton());
	btns.add(btnCancel = new JButton());
	whole.add(btns, BorderLayout.EAST);

	return whole;
}
 
Example 3
Source File: SpecialAttributesListCellRenderer.java    From WorldGrower with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList<? extends SpecialAttribute> list, SpecialAttribute item, int index, boolean isSelected, boolean cellHasFocus) {
	JPanel panel = JPanelFactory.createBorderlessPanel();
	panel.setToolTipText(item.getLongDescription());
	panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
	
	JLabel lblItem = JLabelFactory.createJLabel(item.getDescription());
	lblItem.setBounds(3, 13, 80, 20);
	lblItem.setToolTipText(item.getLongDescription());
	panel.add(lblItem);
	
	JProgressBar itemProgressBar = JProgressBarFactory.createHorizontalJProgressBar(0, item.getMaxValue(), imageInfoReader);
	itemProgressBar.setBounds(120, 13, 110, 20);
	itemProgressBar.setValue(item.getCurrentValue());
	itemProgressBar.setToolTipText(item.getLongDescription());
	panel.add(itemProgressBar);
	
	return panel;
}
 
Example 4
Source File: CharacterDialog.java    From WorldGrower with GNU General Public License v3.0 6 votes vote down vote up
private void createSkillBlock(SkillProperty skillProperty, JPanel parentPanel, int x, int y) {
	
	String skillDescription = skillProperty.getName();
	skillDescription = Character.toUpperCase(skillDescription.charAt(0)) + skillDescription.substring(1);
	JLabel lblSkill = JLabelFactory.createJLabel(skillDescription);
	lblSkill.setBounds(x, y, 110, 20);
	lblSkill.setToolTipText(skillProperty.getLongDescription());
	parentPanel.add(lblSkill);
	
	JLabel lblSkillValue = JLabelFactory.createJLabel(playerCharacter.getProperty(skillProperty).toString());
	lblSkillValue.setBounds(x + 115, y, 15, 20);
	lblSkillValue.setToolTipText(skillProperty.getLongDescription());
	parentPanel.add(lblSkillValue);
	
	JProgressBar skillProgressBar = JProgressBarFactory.createHorizontalJProgressBar(0, 100, imageInfoReader);
	skillProgressBar.setBounds(x + 130, y, 130, 20);
	skillProgressBar.setToolTipText(skillProperty.getLongDescription());
	skillProgressBar.setValue(playerCharacter.getProperty(skillProperty).getPercentageUntilNextLevelUp());
	parentPanel.add(skillProgressBar);
}
 
Example 5
Source File: JVMemoryPanel.java    From MtgDesktopCompanion with GNU General Public License v3.0 5 votes vote down vote up
public JVMemoryPanel() {
	setLayout(new BorderLayout(0, 0));
	progressBar = new JProgressBar();
	progressBar.setMinimum(0);
	progressBar.setMaximum(toMB(Runtime.getRuntime().totalMemory()));
	progressBar.setStringPainted(true);
	progressBar.setToolTipText(tooltip);
	add(progressBar);
	defaultBack = progressBar.getBackground();
	defaultFront = progressBar.getForeground();
	refresh();
}
 
Example 6
Source File: GUIFrame.java    From jaamsim with Apache License 2.0 5 votes vote down vote up
private void addRunProgress(JToolBar mainToolBar, Insets margin) {
	progressBar = new JProgressBar( 0, 100 );
	progressBar.setPreferredSize( new Dimension( 120, controlRealTime.getPreferredSize().height ) );
	progressBar.setValue( 0 );
	progressBar.setStringPainted( true );
	progressBar.setToolTipText(formatToolTip("Run Progress",
			"Percent of the present simulation run that has been completed."));
	mainToolBar.add( progressBar );
}
 
Example 7
Source File: MemoryWatcher.java    From Spade with GNU General Public License v3.0 5 votes vote down vote up
public MemoryWatcher()
{
	// Create the progressbar that is to be used as memory state display.
	PB = new JProgressBar(0, 100);
	PB.setStringPainted(true);
	PB.addMouseListener(new MouseAdapter()
	{
		public void mousePressed(MouseEvent e)
		{
			System.gc();
		}
	});
	PB.setToolTipText("<html><body><b>Memory Display</b><br>Display's the state of the memory in the Application.<br>Click to run the Garbage-Collector</body></html>");
	
	// Add Progressbar to this JPanel
	this.add(PB, BorderLayout.CENTER);
	this.setBackground(PaintCanvas.TRANSPARENT);
	
	// Create the Memory-Watcher Thread
	THIS = new Thread(this);
	THIS.setDaemon(true);
	THIS.setName("MemoryWatcherThread");
	
	// Get the Runtime object.
	RUNTIME = Runtime.getRuntime();
	
	// Start the watcher-thread!
	THIS.start();
}