paneltotal.java

来自「这是一个在linux环境下」· Java 代码 · 共 47 行

JAVA
47
字号
package fr.umlv.projet.fenetre.preformance;

import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JPanel;

/**
 * The Panel to display the "totaux" in the Panel 
 * {@link fr.umlv.projet.fenetre.preformance.Preformance Preformance}. 
 * @author HUANG Wei & MA Xiao Jun
 */

public class PanelTotal extends JPanel {
private String Handles = " ";
private String Threads = " ";
private String Processus = " ";
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("Handles",5,15);
		g.drawString(Handles,w-5-Handles.length()*7,15);
		
		g.drawString("Threads",5,15+(h-25)/2);
		g.drawString(Threads,w-5-Threads.length()*7,15+(h-25)/2);
		
		g.drawString("Processus",5,h-10);
		g.drawString(Processus,w-5-Processus.length()*7,h-10);		
	}
	
	/**
	 * to refresh the datas of the Panel "totaux".
	 * @param Handles the number of Handles. 
	 * @param Threads the number of Threads.
	 * @param Processus the number of Processus.
	 */
	public void refresh(String Handles,String Threads,String Processus){
		this.Handles = Handles;
		this.Threads = Threads;
		this.Processus = Processus;
	}

}

⌨️ 快捷键说明

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