objselectionpanel.java

来自「简介: 今天为网友提供的是JAVA源码」· Java 代码 · 共 74 行

JAVA
74
字号
package com.power.pipeengine.EngineUI;/** * <p>Title: PIPE Engine</p> * <p>Description: Global Planning Optimization Engine</p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: Paraster, Inc.</p> * @author Wei Tan * @version 1.0 */import java.awt.*;import javax.swing.*;import java.awt.event.*;import com.power.pipeengine.*;import java.util.ResourceBundle;/** * ObjectiveValue is a one line JPanel that displays current iteration number * and objective value from the LP engine. It has a label and a field for the * iteration and objective value. * It is a singular class. */public class ObjSelectionPanel extends JPanel {  static ResourceBundle res = ResourceBundle.getBundle("com.power.pipeengine.Res",                                                          EngineConfig.getInstance().getLocale() );  private JLabel _selectionLabel = new JLabel( res.getString("Choose_an_objective") );  private String[] _objFunctions = { res.getString("MAXIMIZE_ON_TIME"), res.getString("_disabled_MAXIMIZE") };  private JComboBox _selectionComboBox = new JComboBox( _objFunctions );  private static final ObjSelectionPanel INSTANCE =                              new ObjSelectionPanel();  /**   * class constructor   */  private ObjSelectionPanel() {    init();  }  /**   * Gets the global instance of the singular class object.   * @return the global instance.   */  public static ObjSelectionPanel getInstance( ) {        return INSTANCE;  }  //initialize the class  private void init() {    _selectionComboBox.setSelectedIndex( 0 ); //show "MAXIMIZE ON-TIME DELIVERY"    _selectionComboBox.setEditable( false );    _selectionComboBox.setEnabled( true );    _selectionComboBox.setToolTipText( res.getString("Choose_an_objective1") );    _selectionComboBox.addActionListener(  new ActionListener() {			public void actionPerformed( ActionEvent e ) {                _selectionComboBox.setSelectedIndex( 0 );                String selection = (String) _selectionComboBox.getSelectedItem();				EngineConfig.getInstance().setObjType( selection );			}    });    this.setLayout( new FlowLayout() );    //this.add( _selectionLabel );    this.setToolTipText( res.getString("Choose_an_objective1") );    this.setBorder( BorderFactory.createTitledBorder( res.getString("Objective_to_optimize") ));    this.add( _selectionComboBox );  }}

⌨️ 快捷键说明

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