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

📄 annealingpanel.java

📁 eclispse下运行 模拟退火算法的java源代码
💻 JAVA
字号:
package org.theblueplanet.annealing.ui;import java.awt.BorderLayout;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JSplitPane;import org.theblueplanet.annealing.AnnealingScheme;/** *  This JSplitPane displays initial offset parameters on the left *  (through the OffsetChooser) and the temperature schedule on the *  right ( through the SliderPanel and the Summarypanel). * * @see org.theblueplanet.annealing.ui.OffsetChooser * @see org.theblueplanet.annealing.ui.SliderPanel * @see org.theblueplanet.annealing.ui.SummaryPanel * * @author     Charles M間nin * @since    October 29, 2001 * @version    1.0 */public class AnnealingPanel extends JSplitPane {    private SliderPanel sliderPanel;    private OffsetChooser offsetChooser;    private SummaryPanel summaryPanel;    private JPanel rightPanel;    private JScrollPane scrollPane;    private static final int topBorderPadding    = 5;    private static final int leftBorderPadding   = 5;    private static final int bottomBorderPadding = 5;    private static final int rightBorderPadding  = 5;    private static final int DIVIDER_LOCATION    = 175;    /**     *  Constructor for the AnnealingPanel object     *     * @param  scheme  The Object that encapsulates the annealing parameters     */    public AnnealingPanel(AnnealingScheme scheme) {        super(JSplitPane.HORIZONTAL_SPLIT);        init(scheme);        display();    }    /**     *  Sets layout & initial parameters.     *     * @param  scheme  The Object that encapsulates the annealing parameters     */    private void init(AnnealingScheme scheme) {        this.setOneTouchExpandable(true);        this.setDividerLocation(DIVIDER_LOCATION);        try {            offsetChooser = new OffsetChooser(scheme);            scrollPane    = new JScrollPane(offsetChooser);            scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);            scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);            rightPanel   = new JPanel(new BorderLayout());            sliderPanel  = new SliderPanel(this, scheme);            summaryPanel = new SummaryPanel(scheme);            rightPanel.add(sliderPanel, BorderLayout.CENTER);            rightPanel.add(summaryPanel, BorderLayout.SOUTH);        } catch (Exception e) {            e.printStackTrace();        }    }    protected void refresh(AnnealingScheme scheme) {        offsetChooser.refresh(scheme);        display();    }    private void display() {        this.setTopComponent(scrollPane);        this.setBottomComponent(rightPanel);    }    /**     *  Resets the SummaryPanel     *     * @param  scheme  The Object that encapsulates the annealing parameters     */    public void updateSummaryPanel(AnnealingScheme scheme) {        this.remove(rightPanel);        this.setDividerLocation(DIVIDER_LOCATION);        rightPanel = new JPanel(new BorderLayout());        rightPanel.add(sliderPanel, BorderLayout.CENTER);        summaryPanel = new SummaryPanel(scheme);        rightPanel.add(summaryPanel, BorderLayout.SOUTH);        this.setBottomComponent(rightPanel);    }}

⌨️ 快捷键说明

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