📄 cpubigger.java
字号:
package fr.umlv.projet.fenetre.preformance.bigger;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JPanel;
import fr.umlv.projet.fenetre.preformance.Historique;
import fr.umlv.projet.fenetre.preformance.PourcentCpu;
/**
* This class is used to display un Panel contains the images bigger
* (Histroy of the memory used and percent of memory used)
* It's contained by another Panel which use CardLayout.
* @author Owner
*@see fr.umlv.projet.fenetre.preformance.bigger.Card#CreatCard(JFrame).
*/
public class CpuBigger extends JPanel {
private PourcentCpu pourcent;
private Historique Histo;
public CpuBigger(){
JPanel p1 = new JPanel();
JPanel p2 = new JPanel();
this.pourcent = new PourcentCpu() ;
this.Histo = new Historique();
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
p1.setLayout(new BorderLayout());
p2.setLayout(new BorderLayout());
p1.setBorder(javax.swing.BorderFactory.createTitledBorder(
javax.swing.BorderFactory.createEtchedBorder(),
"Util de l'UC",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION,
new java.awt.Font("Arial", 0, 10)));
p2.setBorder(javax.swing.BorderFactory.createTitledBorder(
javax.swing.BorderFactory.createEtchedBorder(),
"Historique de l'Utilisation de l'UC",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION,
new java.awt.Font("Arial", 0, 10)));
p1.add(pourcent,BorderLayout.CENTER);
p2.add(Histo,BorderLayout.CENTER);
this.setLayout(gbl);
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 12;
gbc.weighty = 25;
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.gridheight =1;
gbl.setConstraints(p1,gbc);
this.add(p1);
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 84;
gbc.weighty = 25;
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridwidth = 7;
gbc.gridheight =1;
gbl.setConstraints(p2,gbc);
this.add(p2);
}
/**
* to refresh the Panel CpuBigger.
* @param pc the value of percent of cpu used.
* @param pourcent the character string to display the percent.
* @param d the posision where begin to draw cell.
* @param data the value of percent of cpu used to draw lines(image histroy).
*/
public void refresh(int pc ,String pourcent,int d,int data){
this.Histo.refresh(d,data,Color.GREEN);
this.pourcent.refresh(pc,pourcent);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -