//======================================================
//  
// Evaporatör -Kondenser modellemesi
// YTO giriş sınıfı
// Dr. Turhan Coban
// EGE Üniversitesi Mühendislik Fakultesi, Makina Bölümü
// turhan.coban@ege.edu.tr
// =====================================================
// Bu model Türkoğlu için geliştirilmiştir 

import java.lang.Integer;
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
import java.util.Locale;
import java.text.*;
import java.io.*;
import java.awt.*;
import java.util.*;
import javax.swing.table.*;


public class YTO extends JApplet implements ItemListener,ActionListener,Serializable
{
  Container c1;
  Color bg;
  final static String say1 = "YTO - E   Evaporatör (Buharlaştırıcı)          ";
  final static String say2 = "YTO - EU  Evaporatör (Buharlaştırıcı)          ";
  final static String say3 = "YTO - DEU Deniz Evaporatörü (Buharlaştırıcısı) ";
  final static String say4 = "YTO - K   Kondenser  (Yoğuşturucu)             ";
  final static String say5 = "YTO - DK  Deniz Kondenseri  (Yoğuşturucu)             ";
  final static String say6 = "YTO - RKSK  Radyal kapalı soğutma kulesi      ";
  JPanel panel1;
  JPanel girisPaneli;	  
  //Border b=BorderFactory.createRaisedBevelBorder();
  JToggleButton l1[]=new JToggleButton[6];           //
  Icon turkoglu_logo;
  JButton b1;
  Icon YTOK;
  Icon YTOE;
  Icon YTOEU;
  Icon YTODEU;
  Icon YTODK;
  Icon YTORKSK;
    public void init()
    {         
      c1 = getContentPane();
      bg=c1.getBackground();
      panel1 = new JPanel();
      panel1.setBackground(bg);
      girisPaneli=new JPanel();
      girisPaneli.setLayout(new GridLayout(3,2));
      turkoglu_logo=new ImageIcon("turkoglu_logo.jpg");
      YTOK=new ImageIcon("YTOK.jpg");
      YTODK=new ImageIcon("YTODK.jpg");
      YTOE=new ImageIcon("YTOE.jpg");
      YTOEU=new ImageIcon("YTOEU.jpg");
      YTODEU=new ImageIcon("YTODEU.jpg");
      YTORKSK=new ImageIcon("YTORKSK.jpg");      
      b1=new JButton(turkoglu_logo);
      panel1.add(b1,BorderLayout.NORTH);
      l1[0]=new JToggleButton(say1,YTOE);
      l1[1]=new JToggleButton(say2,YTOEU);
      l1[2]=new JToggleButton(say3,YTODEU);
      l1[3]=new JToggleButton(say4,YTOK);
      l1[4]=new JToggleButton(say5,YTODK);
      l1[5]=new JToggleButton(say6,YTORKSK);
      girisPaneli.add(l1[0]);
      girisPaneli.add(l1[3]);
      girisPaneli.add(l1[1]);
      girisPaneli.add(l1[4]);
      girisPaneli.add(l1[2]);           
      girisPaneli.add(l1[5]); 
      panel1.add(girisPaneli,BorderLayout.SOUTH);
    l1[0].setBackground(bg);
    l1[1].setBackground(bg);
    l1[2].setBackground(bg);
    l1[3].setBackground(bg);
    l1[4].setBackground(bg);
    l1[5].setBackground(bg);
    l1[0].addActionListener(this);
    l1[1].addActionListener(this);
    l1[2].addActionListener(this);
    l1[3].addActionListener(this);
    l1[4].addActionListener(this);
    l1[5].addActionListener(this);
    c1.add(panel1);    
    }

    public void itemStateChanged(ItemEvent e)
    {     
	 repaint();
    }
    
    public void actionPerformed(ActionEvent e)
    {
    //Double valXmin=new Double(inputXmin.getText());
    if(e.getSource()==l1[0])
    {
	    JFrame f = new JFrame("YTO-E Evaporatör seçimi");
	    f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {repaint();}
        });
        JApplet applet = new evapTable();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(1000,800));
        f.setVisible(true);
    }
    else if(e.getSource()==l1[1])
    {
    	JFrame f = new JFrame("YTO-EU Evaporatör seçimi");
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {repaint();;}
        });
        JApplet applet = new EUTable();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(1000,800));
        f.setVisible(true);    
    }
    else if(e.getSource()==l1[2])
    {
    	JFrame f = new JFrame("YTO-DEU Deniz Evaporatörü seçimi");
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {repaint();;}
        });
        JApplet applet = new YTODETable();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(1000,800));
        f.setVisible(true);    
    }
    else if(e.getSource()==l1[3])
    {
	    JFrame f = new JFrame("YTO-K Kondenser seçimi");
        f.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {repaint();}});
        JApplet applet = new condTable();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(1000,800));
        f.setVisible(true);
    }
    else if(e.getSource()==l1[4])
    {
	    JFrame f = new JFrame("YTO-DK Deniz kondenseri seçimi");
        f.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {repaint();}});
        JApplet applet = new YTODKTable();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(1000,800));
        f.setVisible(true);
    }
    else if(e.getSource()==l1[5])
    {
	    JFrame f = new JFrame("YTO-RKSK kapalı soğutma kulesi seçimi");
        f.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {repaint();}});
        JApplet applet = new SK2Table();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(1000,800));
        f.setVisible(true);
    }       
   }  

                
    public static void main(String s[])
    {
        //main program
	    JFrame f = new JFrame("YTO Türkoğlu Evaporatör ve Kondenser seçim Programı");
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {System.exit(0);}
        });
        JApplet applet = new YTO();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(1000,800));
        f.setVisible(true);
    }    
 }

