Java Code Examples for com.alee.laf.label.WebLabel#setText()

The following examples show how to use com.alee.laf.label.WebLabel#setText() . 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: TabPanelFavorite.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
/**
		 * Renderer the specified Table Header cell
		 **/
		public Component getTableCellRendererComponent(JTable table,
				Object value,
				boolean isSelected,
				boolean hasFocus,
				int row,
				int column) {

			Component theResult = defaultRenderer.getTableCellRendererComponent(
					table, value, isSelected, hasFocus,
					row, column);

			if (theResult instanceof WebLabel) {
				WebLabel cell = (WebLabel) theResult;
				cell.setText((String)value);
			}

//			WebTableHeader tableHeader = table.getTableHeader();
//		    if (tableHeader != null) {
//		    	tableHeader.setForeground(TableStyle.getHeaderForegroundColor());
//		    	tableHeader.setBackground(TableStyle.getHeaderBackgroundColor());
//		    }

			return theResult;
		}
 
Example 2
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());
	}