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

📄 alphanumstartscreen.java

📁 一个用于排队系统仿真的开源软件,有非常形象的图象仿真过程!
💻 JAVA
字号:
/**    
  * Copyright (C) 2006, Laboratorio di Valutazione delle Prestazioni - Politecnico di Milano

  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.

  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.

  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
  
package jmt.gui.common.startScreen;

import jmt.gui.common.resources.ImageLoader;
import jmt.gui.common.startScreen.sampleAnimation.SampleQNAnimation;
import jmt.gui.exact.ExactModel;
import jmt.gui.exact.ExactWizard;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.border.EtchedBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.HashMap;

/**
 * Created by IntelliJ IDEA.
 * User: orsotroniii
 * Date: 4-mar-2005
 * Time: 15.06.49
 * This Frame shows option screen for selection of particular tool with alphanumeric
 * description.
 */
public class AlphaNumStartScreen extends JFrame{

    /*Data structure that must contain all of the images shown in this window. Will be initialized by
     *loadImages() method*/
    HashMap imageIcons = new HashMap();
    /*symbolic names for the images represented as string constants initialized with relative path
     *of the images themselves*/
    private static final String IMG_LOGOPOLI = "JMT_LOGO",
                                IMG_SUITEICON = "JMTIcon",
    //names for main messages to be displayed in this window.
                                MSG_MVA_DESCR_ITA = "Soluzione analitica di reti di code multiclasse, aperte chiuse e miste.",
                                MSG_MVA_DESCR_ENG = "Analytic solution of open, closed and mixed multiclass queueing network.",
                                MSG_SIM_DESCR_ITA = "Simulazione di reti di code multiclasse.",
                                MSG_SIM_DESCR_ENG = "Simulation of multiclass queueing network.",
                                MSG_ABA_DESCR_ITA = "Analisi asintotica dei colli di bottiglia per reti di code chiuse multiclasse.",
                                MSG_ABA_DESCR_ENG = "Asynthotic analysis of bottlenecks for closed multiclass queueing network.";

    //Sample queue net animation
    SampleQNAnimation sampleQNAni = null;

    //dimensions of the window
    private static final int WIDTH=800,
                             HEIGHT=270;

    JButton mvaAppl,//starts mva application
           simAppl,//starts sim application
           abaAppl;//starts aba application


    //returns a reference to a new instance of StartScreen
    public AlphaNumStartScreen(){
        super("JMT - Java Modelling Tools");
        //get screen dimensions to set bounds of this window
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        int screenWidth=(int)toolkit.getScreenSize().getWidth(),
            screenHeight=(int)toolkit.getScreenSize().getHeight();
        this.setBounds((screenWidth-WIDTH)/2, (screenHeight-HEIGHT)/2, WIDTH, HEIGHT);
        try {
            UIManager.setLookAndFeel(new com.jgoodies.looks.plastic.Plastic3DLookAndFeel());
        } catch (UnsupportedLookAndFeelException ulafe) {
            ulafe.printStackTrace();
        }
        //close this window if proper button pressed
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        this.setResizable(false);

        //loads all of the Images that will be shown in this window
        loadImages();
        //add components of this window
        buildWindowComponents();
        //add all of the listeners
        addListeners();
        if(isImageLoaded(IMG_SUITEICON)){
            Image jmtIcon = ((ImageIcon)imageIcons.get(IMG_SUITEICON)).getImage();
            this.setIconImage(jmtIcon.getScaledInstance(16,16,Image.SCALE_SMOOTH));
        }
        sampleQNAni.start();
    }

    //loads all of the images that must be shown in this window
    private void loadImages(){
        String[] imageNames={IMG_LOGOPOLI, IMG_SUITEICON};
        //load each image referenced in the above array
        for(int i=0; i<imageNames.length; i++){
            ImageIcon img=ImageLoader.loadImage(imageNames[i]);
            if(imageNames[i].equals(IMG_LOGOPOLI)){
                Image imgSmall = img.getImage().getScaledInstance(400,(150*400)/739,Image.SCALE_SMOOTH);
                img.setImage(imgSmall);
            }
            imageIcons.put(imageNames[i], img);
        }
    }


    //builds components of this window
    private void buildWindowComponents(){
        JPanel mainPane = new JPanel(new BorderLayout());
        mainPane.setBorder(new EmptyBorder(5,5,5,5));
        this.getContentPane().add(mainPane);
        /*the two main parts of the start screen. The upper one contains politecnico logo and title,
         *the lower one, buttons and icons of the certain applications.*/
        JLabel upperArea;
        //components of the upper area
        if(isImageLoaded(IMG_LOGOPOLI)) upperArea = new JLabel((ImageIcon)imageIcons.get(IMG_LOGOPOLI));
        else upperArea = new JLabel("Couldn't load image from location "+IMG_LOGOPOLI);

        //bottom area
        JPanel bottomArea = new JPanel(new BorderLayout(5,5));
        //Components of the lower area.
        JPanel buttonsArea = new JPanel(new GridLayout(3,1,5,5));
        sampleQNAni = new SampleQNAnimation();
        JScrollPane jsp = new JScrollPane(sampleQNAni, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        jsp.setPreferredSize(new Dimension(200,100));
        jsp.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
        //Components of the buttonArea
        FlowLayout fl = new FlowLayout(FlowLayout.LEFT, 5,5);
        JPanel mvaArea = new JPanel(fl),
               simArea = new JPanel(fl),
               abaArea = new JPanel(fl);
        mvaArea.setBorder(new EtchedBorder());
        simArea.setBorder(new EtchedBorder());
        abaArea.setBorder(new EtchedBorder());
        //add components to the mva area
        mvaAppl = new JButton("Start jMVA");
        JTextArea mvaDescr = new JTextArea(MSG_MVA_DESCR_ITA + "\n" + MSG_MVA_DESCR_ENG);
        formatJTextArea(mvaDescr);
        mvaArea.add(mvaAppl);
        mvaArea.add(mvaDescr);
        //add components to the sim area
        simAppl = new JButton("Start jSIM");
        JTextArea simDescr = new JTextArea(MSG_SIM_DESCR_ITA + "\n" + MSG_SIM_DESCR_ENG);
        formatJTextArea(simDescr);
        simArea.add(simAppl);
        simArea.add(simDescr);
//TODO:abilitare il pulsante quando sar

⌨️ 快捷键说明

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