membigger.java

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

JAVA
81
字号
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.PourcentFichier;/** * 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 HUANG Wei & MA Xiao Jun * @see fr.umlv.projet.fenetre.preformance.bigger.Card#CreatCard(JFrame). */public class MemBigger extends JPanel {	private PourcentFichier Mem;	private Historique Histo;		public MemBigger(){		JPanel p1 = new JPanel();		JPanel p2 = new JPanel();		this.Mem = new PourcentFichier() ;		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.du fichier",				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 d'utlisation du ficher dechange",				javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,				javax.swing.border.TitledBorder.DEFAULT_POSITION,				new java.awt.Font("Arial", 0, 10)));		p1.add(Mem,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 MemBigger.	 * @param free the value of the memory free.	 * @param total the value of the memory total.	 * @param d the posision where begin to draw cell.	 * @param data the value of percent of memory used to draw lines(image histroy).	 */	public void refresh(int free ,int total,int d,int data){		this.Histo.refresh(d,data,Color.YELLOW);		this.Mem.refresh(free,total);	}}

⌨️ 快捷键说明

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