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

📄 summarypanel.java

📁 eclispse下运行 模拟退火算法的java源代码
💻 JAVA
字号:
package org.theblueplanet.annealing.ui;import java.awt.GridLayout;import javax.swing.BorderFactory;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.border.EtchedBorder;import org.theblueplanet.annealing.AnnealingScheme;import org.theblueplanet.util.NumberFormatUtil;/** *  The Panel that reflects the values selected in the SliderPanel. This JPanel *  is instantiated by the AnnealingPanel * * @see org.theblueplanet.annealing.ui.AnnealingPanel * @see org.theblueplanet.annealing.ui.SliderPanel * * @author     Charles M間nin * @since    October 29, 2001 * @version    1.0 */public class SummaryPanel extends JPanel {    /**     *  Constructor for the SummaryPanel object     *     * @param  scheme  The Object that encapsulates the annealing parameters     */    public SummaryPanel(AnnealingScheme scheme) {        super();        init(scheme);    }    /**     *  Sets the SummaryPanel Layout     *     * @param  scheme  The Object that encapsulates the annealing parameters     */    private void init(AnnealingScheme scheme) {        this.setLayout(new GridLayout(1, 4));        this.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));        display(scheme);    }    /**     *  Refreshes the SummaryPanel     *     * @param  scheme  The Object that encapsulates the annealing parameters     */    private void display(AnnealingScheme scheme) {        this.removeAll();        addLabel("T=" + NumberFormatUtil.format(scheme.getTemperature(),"0.0#E0") + " K", 20);        addLabel("Cooling=" + scheme.getCoolingRate() + "%", 20);        addLabel("# iterations=" + scheme.getNIterations(), 20);        addLabel("Tolerance=" + NumberFormatUtil.format(scheme.getTolerance(),"0.0#E0"), 20);    }    /**     *  Adds a feature to the Label attribute of the SummaryPanel object     *     * @param  text  The test String to be added to the JLabel     * @param  size  The JLabel size     */    private void addLabel(String text, int size) {        JLabel label;        label = new JLabel(text);        this.add(label);    }}

⌨️ 快捷键说明

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