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

📄 engineapplet.java

📁 著名IT公司ILog的APS高级排产优化引擎
💻 JAVA
字号:
package com.power.pipeengine;import java.awt.*;import javax.swing.*;import javax.swing.event.*;import java.awt.event.*;import java.util.*;import java.awt.geom.*;import java.applet.*;import com.power.util.Message.*;import com.power.util.graph2D.*;import com.power.pipeengine.EngineUI.*;import com.power.pipeengine.InputData.*;import com.power.pipeengine.Entity.*;import com.power.pipeengine.*;import com.power.lpsolver.LPSolve.*;public class EngineApplet	extends JApplet{    static ResourceBundle res = null;    // This is a hack to avoid an ugly error message in 1.1.    public EngineApplet() {        getRootPane().putClientProperty("defeatSystemEventQueueCheck",                                        Boolean.TRUE);    }    private boolean isReseted = false;    public void init() {        try {            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());            SwingUtilities.updateComponentTreeUI(getContentPane());        } catch (Exception e) {        //unsupported UI exception        }        res = ResourceBundle.getBundle("com.power.pipeengine.Res",                                        EngineConfig.getInstance().getLocale() );        int xOffset = 75;        int yOffset = 60;        Color bkgrdColor = new Color(203,208,222);		//getContentPane().setLayout( null );		//getContentPane().setBackground( Color.white );        getContentPane().setLayout( new BorderLayout() );        final PrettyPanel pp = new PrettyPanel( this );        getContentPane().add( BorderLayout.CENTER, pp );/*        ObjSelectionPanel objSelectionPanel = ObjSelectionPanel.getInstance();        objSelectionPanel.setLocation( xOffset, yOffset );        objSelectionPanel.setSize( 245, 60 );        objSelectionPanel.setBackground( bkgrdColor );        //getContentPane().add( objSelectionPanel );        pp.add( objSelectionPanel );        UpdateFreqSelectionPanel updFreqSelPanel = UpdateFreqSelectionPanel.getInstance();        updFreqSelPanel.setLocation( 255 + xOffset, yOffset );        updFreqSelPanel.setSize( 245, 60 );        updFreqSelPanel.setBackground( bkgrdColor );        //getContentPane().add( updFreqSelPanel );        pp.add( updFreqSelPanel ); */		final JButton optBtn = new JButton( res.getString("Optimize_My_Supply") );		optBtn.setLocation( xOffset, 10 + yOffset);		optBtn.setSize( 240, 35 );        optBtn.setBackground( bkgrdColor );        //getContentPane().add(optBtn);        pp.add( optBtn );        //ATP button		final JButton atpBtn = new JButton( res.getString("ATPScheduling") );		atpBtn.setLocation( xOffset + 260, 10 + yOffset);		atpBtn.setSize( 240, 35 );        atpBtn.setBackground( bkgrdColor );        //getContentPane().add(optBtn);        pp.add( atpBtn );        JLabel aLabel = new JLabel(res.getString( "EngineRunTime" ) );        aLabel.setLocation( xOffset, 50 + yOffset );        aLabel.setSize( 100, 35 );        pp.add( aLabel );        //stopwatch display for engine run time        final JLabel engineRunTimeLabel = EngineRunTime.getInstance().getLabel();        engineRunTimeLabel.setLocation( xOffset + 150, 50 + yOffset );        engineRunTimeLabel.setSize( 100, 35 );        pp.add( engineRunTimeLabel );        /*final JButton resetBtn = new JButton( "Reset" );        resetBtn.setLocation( 400, 50 + yOffset );        resetBtn.setSize( 100, 35 );        pp.add( resetBtn );        resetBtn.addActionListener(  new ActionListener() {			public void actionPerformed( ActionEvent e ) {				PIPEMain.getInstance().reset();				optBtn.setEnabled( true );                isReseted = true;			}        });*/        PIPEMain.getInstance().setEngineApplet( this );        atpBtn.addActionListener(  new ActionListener() {			public void actionPerformed( ActionEvent e ) {                EngineConfig.getInstance().setATPScheduling();                optBtn.setEnabled( false );                PIPEMain.getInstance().start();                atpBtn.setEnabled( false );            }        });        final JOptionPane confirm = new JOptionPane( "ConfirmationWarning");		optBtn.addActionListener(  new ActionListener() {			public void actionPerformed( ActionEvent e ) {                int status = confirm.showConfirmDialog( pp,                        res.getString( "DeleteDispatchRecords" ),                        res.getString( "Warning" ),                        JOptionPane.YES_NO_OPTION );                if( !( status ==  JOptionPane.YES_OPTION ) ) return;                EngineConfig.getInstance().setRunFlag( true );                atpBtn.setEnabled( false );                //if( ! isReseted ) {                    PIPEMain.getInstance().start();                //}				optBtn.setEnabled( false );			}        });        //plotting objective values on a line chart        //Color bkgrdColor = Color.white;        /*JPanel aPanel = new JPanel();        aPanel.setBackground( bkgrdColor.darker() );        aPanel.setLocation( xOffset, 110 + yOffset);        aPanel.setSize( 500, 25 );        aPanel.add( new JLabel( res.getString("OBJECTIVE_VALUE_CHART") ) );        //getContentPane().add( aPanel );        pp.add( aPanel );        ObjectiveValuePlot objValuePlot = ObjectiveValuePlot.getInstance();        objValuePlot.setOrigin( new Point2D.Double(30,165) );        objValuePlot.setDimension( new Dimension(500,190) );        objValuePlot.setDoubleBuffered(true);		objValuePlot.setLocation( xOffset, 135 + yOffset);		objValuePlot.setSize( 500, 190 );		objValuePlot.setBackground( bkgrdColor );        //getContentPane().add( objValuePlot ) ;        pp.add( objValuePlot );*/        //display the message area window		MessageArea msgArea = MessageArea.getInstance();		JScrollPane scrollPane = new JScrollPane( msgArea.getTextArea() );		scrollPane.setVerticalScrollBarPolicy(			JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);		scrollPane.setLocation( xOffset, 90 + yOffset);		scrollPane.setSize( 500, 350 );        scrollPane.setName( res.getString("Engine_Message_Window") );        scrollPane.setBorder( BorderFactory.createTitledBorder( res.getString("Engine_Message_Window") ));        scrollPane.setBackground( bkgrdColor );		//getContentPane().add( scrollPane );        pp.add( scrollPane );        EngineConfig.getInstance().setEngineApplet( this );        //getContentPane().add( new PrettyPanel( this ) );    }    class PrettyPanel extends Container {      Image headingBand;      Image backGround;      Applet myApplet;      PrettyPanel(Applet applet) {          headingBand = applet.getImage(applet.getDocumentBase(), "images/bg-green.gif" );          backGround = applet.getImage(applet.getDocumentBase(), "images/bg.gif" );          myApplet = applet;          this.setSize( 650, 600);          this.setLayout( null );          //this.setBackground( new Color( 225,225,225 ) );      }      /**       * paint the background picture, then call super.paint which       * will paint all contained components       *       * Note: You MUST call super.paint(g) or the lightweight       * components won't get painted.       */      public void paint(Graphics g) {          g.drawImage(headingBand, 0, 0, 650, 50,                       this);          for( int i=0; i<13; i++ ) {            for( int j=1; j<=11; j++ ) {              g.drawImage(backGround, i*50, 50*j, 50, 50, this);            }          }          Color penColor = g.getColor();          g.setColor( Color.gray );          g.drawLine( 0, 0, 650, 0 );          g.drawLine( 0, 0, 0, 650 );          g.setColor( Color.black );          g.drawLine( 0, 600, 650, 600 );          g.drawLine( 650, 0, 650, 600 );          g.setColor( penColor );          super.paint(g);          g.setFont(new java.awt.Font(res.getString("Times_New_Roman"), Font.BOLD, 26));          g.setColor(new Color(100,100,110));          g.drawString( res.getString("Optimization_Engine"), 50, 35);      }    }	/*public void actionPerformed( ActionEvent e )	{		try {			PIPEMain.getInstance().run();		} catch ( Exception ex ) {			System.out.println( ex.getMessage() );		}	}*/	/*public OptimizationApplet() {}	public static void main(java.lang.String[] args) {		JFrame aFrame = new JFrame();		aFrame.getContentPane().setLayout( null );		aFrame.setBackground( Color.white );		aFrame.setSize( 800,1000 );		final JButton optBtn = new JButton( "Optimize My Supply Chain" );		optBtn.setLocation( 100, 20 );		optBtn.setSize( 500, 30 );		optBtn.addActionListener(  new ActionListener() {			public void actionPerformed( ActionEvent e ) {				PIPEMain.getInstance().start();				optBtn.setEnabled( false );			}			});                aFrame.getContentPane().add(optBtn );		JLabel aLabel = new JLabel( "Objective Value Chart" );                Vector pointVect = new Vector();                pointVect.add(new Point2D.Double(50,20));                pointVect.add(new Point2D.Double(100,50));                pointVect.add(new Point2D.Double(200,120));                pointVect.add(new Point2D.Double(240,180));                pointVect.add(new Point2D.Double(300,250));                //final graphPanel graph = new graphPanel(new Point2D.Double(50,275),new Dimension(500,300));                ObjectiveValuePlot objValuePlot = ObjectiveValuePlot.getInstance();                objValuePlot.setOrigin( new Point2D.Double(50,275) );                objValuePlot.setDimension( new Dimension(500,300) );                objValuePlot.setDoubleBuffered(true);                //objValuePlot.setPointVect(pointVect);		objValuePlot.setLocation( 100, 120 );		objValuePlot.setSize( 500, 320 );		objValuePlot.setBackground( Color.cyan );		objValuePlot.setName( "Objective Function Values:" );		objValuePlot.add( aLabel );                aFrame.getContentPane().add( objValuePlot ) ;        ObjectiveValuePanel objValuePanel = ObjectiveValuePanel.getInstance();        objValuePanel.setLocation( 100, 75 );        objValuePanel.setSize( 500, 50 );        aFrame.getContentPane().add( objValuePanel );		MessageArea msgArea = MessageArea.getInstance();		JScrollPane scrollPane = new JScrollPane( msgArea.getTextArea() );		//msgWindow.setScrollPane( scrollPane );		//scrollPane.setPreferredSize(new Dimension(500, 200));		scrollPane.setVerticalScrollBarPolicy(			JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);		scrollPane.setLocation( 100, 450 );		scrollPane.setSize( 500, 200 );		aFrame.getContentPane().add( scrollPane );		aFrame.show();		//PIPEMain.getInstance().run(); 	}*/}

⌨️ 快捷键说明

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