⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 charge.java

📁 这是一个在linux环境下
💻 JAVA
字号:
package fr.umlv.projet.fenetre.preformance;

import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JPanel;
/** 
 *  This class is used to display the "Charge dediee" in the Panel 
 *  {@link fr.umlv.projet.fenetre.preformance.Preformance Preformance}.
 * @author HUANG Wei & Ma Xiao Jun
 * 
 */
public class Charge extends JPanel {
	private int Total = 0;
	private int Limite = 0;
	private int Pic = 0;
	private int w = 0;
	private int h = 0;
	
	protected@Override void paintComponent(Graphics graphic){
		Graphics2D g = (Graphics2D)graphic; 
		super.paintComponent(g);
		w = this.getWidth();
		h = this.getHeight();
		g.drawString("Total",5,15);
		g.drawString(Total+"",w-6-String.valueOf(Total).length()*7,15);
		
		g.drawString("Limite",5,15+(h-25)/2);
		g.drawString(Limite+"",w-6-String.valueOf(Limite).length()*7,15+(h-25)/2);
		
		g.drawString("Pic",5,h-10);
		g.drawString(Pic+"",w-6-String.valueOf(Pic).length()*7,h-10);		
	}
	
	/**
	 * to refresh the datas of the Panel "Charge dediee".
	 * @param Total the memory used of the computer.
	 * @param Limite the limit of de memory of the computer.
	 * @param Pic the biggest value of the memory used.
	 */
	
	public void refresh(int Total,int Limite,int Pic){
		this.Total = Total;
		this.Limite = Limite;
		if(this.Pic < Pic)
		this.Pic = Pic;
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -