import java.awt.* ;
import java.awt.event.* ;
import javax.swing.* ;
import java.io.*;
import java.awt.image.*;
/**
* Class : Constants
* Developed By : ARC Pvt Ltd Bengaluru
* Date: 10/08/2010
*
*/
class Constants extends JFrame{
/*----Display Resolution-----------*/
final double adjx = 1.25; //
final double adjy = 1.25; //
final double xpix = 640*adjx; // To Set the Frame X Resolution
final double ypix = 480*adjy; // To Set the Frame Y Resolution
int getWidth = 640; // border width
int getHeight = 480; // border height
/* Driver Details*/
int dix = 5;//15 ;driver x coordinate
int diy = 8;//40 ; driver y coordinate
int diwidth = 627; //400 525 ; driver width
int dihight = 20; // driver height
/* screens details*/
final int screens_border [] = { 219,61,412,309 };
final int screens_display [] = { 226,130,195,25 };
/* Mouse Actions*/
int mainpowerx = 224;//219+27;//260
int mainpowery=130;
int mainpowerw=195;
int mainpowerh = 25;
int xpos=-10; int ypos=-10;
int scr=0;
int scr1=0;
boolean mouseEntered;
boolean rect1Clicked;
boolean rect2Clicked;
boolean rect19Clicked;
boolean rect20Clicked;
int scrn=0;
int rect1xco = (int )((mainpowerx)*adjx);
int rect1yco = (int )((mainpowery)*adjy);
int rect1width = (int )((mainpowerw)*adjx);
int rect1height =(int )((mainpowerh)*adjy);
int rect20xco = (int )((subx+38)*adjx);
int rect20yco = (int )((suby+270)*adjy);//suby+270;
int rect20width =(int )((sub_w)*adjx);
int rect20height = (int )((sub_h)*adjy);
Color dackground = new Color(0,0,0);
Color block = new Color(163,225,255,155); // for Blue Gray Color
Color Green = new Color(102,255,153,255); // for Green Color
Color Red = new Color(200,51,51,200); // for Red Color
Color Yellow = new Color(255,255,51);
Color Gray = new Color(161,161,161,205); // for Gray Color
Color pantoback = new Color(61,61,61); // for Panto Background Gray Color
Color line = new Color(224,224,224,55); // for Panto Line
Color subcolor = new Color(31,31,31); // for Subsysrem background Color
Color voltcurrentbackground = new Color(31,31,31,255); // for voltage & Current Background
Color lightpink = new Color(253,204,255,50);
/* ----------------Sub system Details------------------*/
final int subw = 32;
final int subh = 25;
final int subsystem[][] = { { 8, 68, subw, subh },/*for SS01*/ { 44, 68, subw, subh },/* for SS02*/
{ 8, 98, subw, subh },/*for SS03*/ { 44, 98, subw, subh },/* for SS04*/
{ 8, 128, subw, subh },/*for SS05*/ { 44, 128, subw, subh },/* for SS06*/
{ 8, 158, subw, subh },/*for SS07*/ { 44, 158, subw, subh },/* for SS08*/
{ 8, 188, subw, subh },/*for SS09*/ { 44, 188, subw, subh },/* for SS10*/
{ 8, 218, subw, subh },/*for SS11*/ { 44, 218, subw, subh },/* for SS12*/
{ 8, 248, subw, subh },/*for SS13*/ { 44, 248, subw, subh },/* for SS14*/
{ 8, 278, subw, subh },/*for SS15*/ { 44, 278, subw, subh },/* for SS16*/
{ 8, 308, subw, subh },/*for SS17*/ { 44, 308, subw, subh },/* for SS18*/
{ 8, 338, subw, subh },/*for SS19*/ { 44, 338, subw, subh },/* for SS20*/
}; // 1 - 19 subsystem X Y W H
String subsystem_string [] = {"SS01","SS02","SS03","SS04","SS05","SS06","SS07","SS08","SS09","SS10",
"SS11","SS12","SS13","SS14","SS15","SS16","SS17","SS18","SS19"," SS20 "
};
int [] substatus = new int [20]; // subsystem Run Time Variable
int subsysystatus = 1; // Run Time Variable
/*--------------------------Voltage and Current bar Details------------------------*/
//----------------SCREEN DETAILS--------------------------
// final int screens_border [] = { 219, 61, 412, 309 }; // Screen Border X Y W H
// final int screens_display [] = { 226, 130, 195, 25 }; // Screen Inner Blocks X Y W H
final int screens_row [] = {97,124,151,178,205,232,259,286,313,340};// Inner Blocks Y Coordinates
final int mainpowercol [] = {5,206}; // Col 1 and 2 X Coordinates
String str ;
int len = 0;
} // End of Constant Class
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import javax.swing.*;
public class mainpower extends Constants{
int mainpowerborderx = 219;
int mainpowerbordery = 61;
int mainpowerborderw = 412;
int mainpowerborderh = 309;
int mainpowerx = 224;//219+27;//260
int mainpowery=130;
int mainpowerw=195;
int mainpowerh = 24;
int mainpowerstringx = 280-20;
int mainpowerstringy = 106;
int mainpowerstringh = 27;
Color d = new Color(163,224,255,155);
Color Green = new Color(102,255,153,255); // for Green Color
Color Red = new Color(200,51,51,255);
Color block = new Color(163,225,255,155);
String str ;
int strlen = 0;
int len = 0;
public void powercircuit (Graphics g,Graphics2D g2){
g2.setStroke(new BasicStroke(1));
g.setColor(Color.black);
g.fillRect( (int)(screens_border[0]*adjx),(int)(screens_border[1]*adjy),(int)(screens_border[2]*adjx),(int)(screens_border[3]*adjy));// screens Boarder
g.setColor(Color.gray);
g.drawRect( (int)(screens_border[0]*adjx),(int)(screens_border[1]*adjy),(int)(screens_border[2]*adjx),(int)(screens_border[3]*adjy));// screens Boarder
g.drawRect((int)(222*adjx),(int)(145*adjy),(int)(404*adjx),(int)(222*adjy));// inner rectangle
g.setFont(new Font("Times New Roman",Font.BOLD,15));//Engravers MT
g.setColor(d);
g2.setStroke(new BasicStroke(1));
// g.fill3DRect(369,68,120,24,true);// for heading
/* ------- Status parameters --------*/
g.fill3DRect( (int)((screens_display[0]+125)*adjx),(int)((screens_display[1]-33)*adjy),(int)((screens_display[2]-100)*adjx),(int)((screens_display[3]-5)*adjy),true);// for MSC NODE
g.fill3DRect( (int)((screens_display[0])*adjx),(int)((screens_display[1]-8)*adjy),(int)((screens_display[2]-100)*adjx),(int)((screens_display[3]-5)*adjy),true);// for I/P POWER
g.fill3DRect( (int)((screens_display[0]+193)*adjx),(int)((screens_display[1]-8)*adjy),(int)((screens_display[2]-72)*adjx),(int)((screens_display[3]-5)*adjy),true);// for LINE FREQUENCY
g.fill3DRect( (int)((screens_display[0]+142)*adjx),(int)((screens_display[1]+20)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3])*adjy),true);// for TRACTION BOGIE 1
g.fill3DRect( (int)((screens_display[0]+140+133)*adjx),(int)((screens_display[1]+20)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3])*adjy),true);// for TRACTION BOGIE 2
g.fill3DRect( (int)((screens_display[0]+2)*adjx),(int)((screens_display[1]+54+5)*adjy),(int)((screens_display[2]-60)*adjx),(int)((screens_display[3]-5)*adjy),true);// for I/P CONTACTORS
g.fill3DRect( (int)((screens_display[0]+2)*adjx),(int)((screens_display[1]+81)*adjy),(int)((screens_display[2]-60)*adjx),(int)((screens_display[3]-5)*adjy),true);// for CHARGING CONTACTORS
g.fill3DRect( (int)((screens_display[0]+2)*adjx),(int)((screens_display[1]+103)*adjy),(int)((screens_display[2]-60)*adjx),(int)((screens_display[3]-5)*adjy),true);// for DC LINK VOLTAGE
g.fill3DRect( (int)((screens_display[0]+2)*adjx),(int)((screens_display[1]+125)*adjy),(int)((screens_display[2]-60)*adjx),(int)((screens_display[3]-5)*adjy),true);// for SLG NODE
g.fill3DRect( (int)((screens_display[0]+2)*adjx),(int)((screens_display[1]+147)*adjy),(int)((screens_display[2]-60)*adjx),(int)((screens_display[3]-5)*adjy),true);// for ALG NODE
g.fill3DRect( (int)((screens_display[0]+2)*adjx),(int)((screens_display[1]+169)*adjy),(int)((screens_display[2]-60)*adjx),(int)((screens_display[3]-5)*adjy),true);// for TE/ BE REF
g.fill3DRect( (int)((screens_display[0]+2)*adjx),(int)((screens_display[1]+191)*adjy),(int)((screens_display[2]-60)*adjx),(int)((screens_display[3]-5)*adjy),true);// for TE/ BE ACTUAL
/* --------- for value buttons ------*/
g.setColor(Color.gray);
g.fill3DRect( (int)((screens_display[0]+125+97)*adjx),(int)((screens_display[1]-33)*adjy),(int)((screens_display[2]-110)*adjx),(int)((screens_display[3]-5)*adjy),true);// fo MSC NODE
g.fill3DRect( (int)((screens_display[0]+97)*adjx),(int)((screens_display[1]-8)*adjy),(int)((screens_display[2]-110)*adjx),(int)((screens_display[3]-5)*adjy),true);// for I/P POWER
g.fill3DRect( (int)((screens_display[0]+180+138)*adjx),(int)((screens_display[1]-8)*adjy),(int)((screens_display[2]-110)*adjx),(int)((screens_display[3]-5)*adjy),true);// for LINE FREQUENCY
g.fill3DRect( (int)((screens_display[0]+142)*adjx),(int)((screens_display[1]+59)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for I/P CONTACTORS TRACTION BOGIE 1
g.fill3DRect( (int)((screens_display[0]+142)*adjx),(int)((screens_display[1]+81)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for CHARGING CONTACTORS TRACTION BOGIE 1
g.fill3DRect( (int)((screens_display[0]+142)*adjx),(int)((screens_display[1]+103)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for DC LINK VOLTAGE TRACTION BOGIE 1
g.fill3DRect( (int)((screens_display[0]+142)*adjx),(int)((screens_display[1]+125)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for SLG NODE TRACTION BOGIE 1
g.fill3DRect( (int)((screens_display[0]+142)*adjx),(int)((screens_display[1]+147)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for ALG NODE TRACTION BOGIE 1
g.fill3DRect( (int)((screens_display[0]+142)*adjx),(int)((screens_display[1]+169)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for TE/ BE REF TRACTION BOGIE 1
g.fill3DRect( (int)((screens_display[0]+142)*adjx),(int)((screens_display[1]+191)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for TE/ BE ACTUAL TRACTION BOGIE 1
g.fill3DRect( (int)((screens_display[0]+140+133)*adjx),(int)((screens_display[1]+59)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for I/P CONTACTORS TRACTION BOGIE 2
g.fill3DRect( (int)((screens_display[0]+140+133)*adjx),(int)((screens_display[1]+81)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for CHARGING CONTACTORS TRACTION BOGIE 2
g.fill3DRect( (int)((screens_display[0]+140+133)*adjx),(int)((screens_display[1]+103)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for DC LINK VOLTAGE TRACTION BOGIE 2
g.fill3DRect( (int)((screens_display[0]+140+133)*adjx),(int)((screens_display[1]+125)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for SLG NODE TRACTION BOGIE 2
g.fill3DRect( (int)((screens_display[0]+140+133)*adjx),(int)((screens_display[1]+147)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for ALG NODE TRACTION BOGIE 2
g.fill3DRect( (int)((screens_display[0]+140+133)*adjx),(int)((screens_display[1]+169)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for TE/ BE REF TRACTION BOGIE 2
g.fill3DRect( (int)((screens_display[0]+140+133)*adjx),(int)((screens_display[1]+191)*adjy),(int)((screens_display[2]-70)*adjx),(int)((screens_display[3]-5)*adjy),true);// for TE/ BE ACTUAL TRACTION BOGIE 2
/* --- Text ----*/
g.setColor(Color.yellow);
g.drawString("POWER CIRCUIT",(int)(370*adjx),(int)(85*adjy));
g.setFont(new Font("Times New Roman",Font.PLAIN,(int)(12*adjx)));
g.setColor(Color.black);
g.drawString("I/P POWER",(int)((screens_display[0]+16)*adjx),(int)((screens_display[1]+7)*adjy));
g.drawString("LINE FREQUENCY",(int)((screens_display[0]+198)*adjx),(int)((screens_display[1]+7)*adjy));
g.drawString("MSC NODE",(int)((screens_display[0]+140)*adjx),(int)((screens_display[1]-18)*adjy));
g.setFont(new Font("Times New Roman",Font.BOLD,(int)(15*adjx)));
g.drawString("590",(int)((screens_display[0]+125+97+35)*adjx),(int)((screens_display[1]-18)*adjy));
g.setFont(new Font("Times New Roman",Font.PLAIN,(int)(13*adjx)));
g.drawString("TRACTION BOGIE 1",(int)((screens_display[0]+145)*adjx),(int)((screens_display[1]+38)*adjy));
g.drawString("TRACTION BOGIE 2",(int)((screens_display[0]+140+133+5)*adjx),(int)((screens_display[1]+38)*adjy));
g.setFont(new Font("Times New Roman",Font.PLAIN,(int)(11*adjx)));
g.drawString("I/P CONTACTOR",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+59+15)*adjy));
g.drawString("CHARGING CONTACTOR",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+81+16)*adjy));
g.drawString("DC LINK VOLTAGE",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+108+10)*adjy));
g.drawString("SLG NODE",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+135+4)*adjy));
g.drawString("ALG NODE",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+160)*adjy));
g.drawString("TE/BE REF",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+189-7)*adjy));
g.drawString("TE/BE ACTUAL",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+216+18-30)*adjy));
}
public void screens (Graphics g,Graphics2D g2){
g2.setStroke(new BasicStroke(1));
g.setColor(Color.black);
g.fillRect( (int)(screens_border[0]*adjx),(int)(screens_border[1]*adjy),(int)(screens_border[2]*adjx),(int)(screens_border[3]*adjy));// screens Boarder
g.setColor(Color.gray);
g.drawRect( (int)(screens_border[0]*adjx),(int)(screens_border[1]*adjy),(int)(screens_border[2]*adjx),(int)(screens_border[3]*adjy));// screens Boarder
g.setFont(new Font("Times New Roman",Font.PLAIN,15));
// Color d = new Color(194,194,194);//163,224,255
g.setColor(d);
g.fill3DRect((int)(369*adjx),(int)(84*adjy),(int)(110*adjx),(int)(25*adjy),true);
g.fill3DRect( (int)(screens_display[0]*adjx),(int)(screens_display[1]*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx,mainpowery,mainpowerw,mainpowerh,true); // for panto 1
g.fill3DRect( (int)(screens_display[0]*adjx),(int)((screens_display[1]+27)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx,mainpowery+27,mainpowerw,mainpowerh,true); // for panto 2
g.fill3DRect( (int)(screens_display[0]*adjx),(int)((screens_display[1]+54)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx,mainpowery+54,mainpowerw,mainpowerh,true); // for Driver Switch for panto
g.fill3DRect( (int)(screens_display[0]*adjx),(int)((screens_display[1]+81)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx,mainpowery+81,mainpowerw,mainpowerh,true); // Minimum Voltage Relay
g.fill3DRect( (int)(screens_display[0]*adjx),(int)((screens_display[1]+108)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx,mainpowery+108,mainpowerw,mainpowerh,true); // Hotel Load
g.fill3DRect( (int)(screens_display[0]*adjx),(int)((screens_display[1]+135)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx,mainpowery+135,mainpowerw,mainpowerh,true);
g.fill3DRect( (int)(screens_display[0]*adjx),(int)((screens_display[1]+162)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
g.fill3DRect( (int)((screens_display[0])*adjx),(int)((screens_display[1]+189)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx,mainpowery+162,mainpowerw,mainpowerh,true);
g.fill3DRect( (int)((screens_display[0]+205)*adjx),(int)((screens_display[1])*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx+205,mainpowery,mainpowerw,mainpowerh,true); // for panto 1
g.fill3DRect( (int)((screens_display[0]+205)*adjx),(int)((screens_display[1]+27)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
//g.fill3DRect(mainpowerx+205,mainpowery+27,mainpowerw,mainpowerh,true); // for panto 2
g.fill3DRect( (int)((screens_display[0]+205)*adjx),(int)((screens_display[1]+54)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx+205,mainpowery+54,mainpowerw,mainpowerh,true); // for Driver Switch for panto
g.fill3DRect( (int)((screens_display[0]+205)*adjx),(int)((screens_display[1]+81)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx+205,mainpowery+81,mainpowerw,mainpowerh,true); // Minimum Voltage Relay
g.fill3DRect( (int)((screens_display[0]+205)*adjx),(int)((screens_display[1]+108)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx+205,mainpowery+108,mainpowerw,mainpowerh,true); // Hotel Load
g.fill3DRect( (int)((screens_display[0]+205)*adjx),(int)((screens_display[1]+135)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx+205,mainpowery+135,mainpowerw,mainpowerh,true); // Battery Voltage
g.fill3DRect( (int)((screens_display[0]+205)*adjx),(int)((screens_display[1]+162)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
g.fill3DRect( (int)((screens_display[0]+205)*adjx),(int)((screens_display[1]+189)*adjy),(int)(screens_display[2]*adjx),(int)(screens_display[3]*adjy),true);// screens Boarder
// g.fill3DRect(mainpowerx+205,mainpowery+162,mainpowerw,mainpowerh,true);
/* g.fill3DRect(mainpowerx+195,252,mainpowerw,mainpowerh,true); // Aux winding voltage
g.fill3DRect(mainpowerx,279,mainpowerw,mainpowerh,true); // Aux winding Current
g.fill3DRect(mainpowerx,306,mainpowerw,mainpowerh,true); // DC link voltage
g.fill3DRect(mainpowerx,333,mainpowerw,mainpowerh,true);*/
//* 2nd colomn*//
//g.setColor(Color.gray);
// Battery Voltage
/* g.fill3DRect(mainpowerx,252,mainpowerw,mainpowerh,true); // Aux winding voltage
g.fill3DRect(mainpowerx,279,mainpowerw,mainpowerh,true); // Aux winding Current
g.fill3DRect(mainpowerx,306,mainpowerw,mainpowerh,true); // DC link voltage
g.fill3DRect(mainpowerx,333,mainpowerw,mainpowerh,true);*/
g.setColor(Color.yellow);
g.drawString("SCREENS",(int)(392*adjx),(int)(102*adjy));
g.setColor(Color.black);
g.setFont(new Font("Times New Roman",Font.PLAIN,(int)(11*adjx)));
g.drawString("POWER CIRCUIT",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+18)*adjy));
g.drawString("AUXILIARY CONVERTER",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+27+18)*adjy));
g.drawString("TRACTION MOTOR",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+54+18)*adjy));
g.drawString("HARMONIC FILTER & HOTEL LOAD",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+81+18)*adjy));
g.drawString("AUXILIARY MACHINES",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+108+18)*adjy));
g.drawString("SUB-SYSTEM ISOLATION",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+135+18)*adjy));
g.drawString("TRACTION/BRAKING",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+162+18)*adjy));
g.drawString("INPUT SIGNALS",(int)((screens_display[0]+5)*adjx),(int)((screens_display[1]+189+18)*adjy));
g.drawString("BRAKE SYSTEM",(int)((screens_display[0]+205+15)*adjx),(int)((screens_display[1]+18)*adjy));
g.drawString("TEMPERATURES",(int)((screens_display[0]+205+15)*adjx),(int)((screens_display[1]+27+18)*adjy));
g.drawString("OIL PRESSURES",(int)((screens_display[0]+205+15)*adjx),(int)((screens_display[1]+54+18)*adjy));
g.drawString("CONFIG SWITCHES",(int)((screens_display[0]+205+15)*adjx),(int)((screens_display[1]+81+18)*adjy));
g.drawString("WHEEL DIAMETER",(int)((screens_display[0]+205+15)*adjx),(int)((screens_display[1]+108+18)*adjy));
g.drawString("KM EARNED & ENERGY",(int)((screens_display[0]+205+15)*adjx),(int)((screens_display[1]+135+18)*adjy));
g.drawString("SOFTWARE VERSION",(int)((screens_display[0]+205+15)*adjx),(int)((screens_display[1]+162+18)*adjy));
g.drawString("OUTPUT SIGNALS",(int)((screens_display[0]+205+15)*adjx),(int)((screens_display[1]+189+18)*adjy));
}
}
import java.awt.*;
import java.awt.event.ActionEvent;
import javax.swing.*;
import java.util.Calendar;
class Subsystem extends Constants {
public void subsystem(Graphics g,Graphics2D g2, int subsysstatus) {
substatus[2] = 1;
substatus[7] = 1;
for(int i = 0;i<19;i++){
g2.setFont(new Font("Times New Roman",Font.PLAIN,10));
g2.setStroke(new BasicStroke(3));
if(substatus[i] == 0){
g.setColor(Green);
g.fillRoundRect((int)(subsystem[i][0]*adjx),(int)((subsystem[i][1]+1)*adjy),(int)(subsystem[i][2]*adjx),(int)((subsystem[i][3]-1)*adjy),(int)(0*adjx),(int)(0*adjy) );
g.draw3DRect((int)(subsystem[i][0]*adjx),(int)(subsystem[i][1]*adjy),(int)(subsystem[i][2]*adjx),(int)(subsystem[i][3]*adjy),true);
g.setColor(Color.black);
g.drawString(subsystem_string[i],(int)((subsystem[i][0]-9+(subw/2))*adjx),(int)((subsystem[i][1]+(subh/2)+5)*adjy));
}
else{
g.setColor(Red);
g.fillRoundRect((int)(subsystem[i][0]*adjx),(int)((subsystem[i][1]+1)*adjy),(int)(subsystem[i][2]*adjx),(int)((subsystem[i][3]-1)*adjy),(int)(0*adjx),(int)(0*adjy) );
g.draw3DRect((int)(subsystem[i][0]*adjx),(int)(subsystem[i][1]*adjy),(int)(subsystem[i][2]*adjx),(int)(subsystem[i][3]*adjy),true);
g.setColor(Color.white);
g.drawString(subsystem_string[i],(int)((subsystem[i][0]-9+(subw/2))*adjx),(int)((subsystem[i][1]+(subh/2)+5)*adjy));
}
}
g.setColor(Color.yellow);
//g.draw3DRect((int)(),true);
//g.setColor(Color.white);
//g.drawString(subsystem_string[i],(int)((subsystem[i][0]-9+(subw/2))*adjx),(int)((subsystem[i][1]+(subh/2)+5)*adjy));
// g.fillRoundRect(42,366,37,29,0,0);
g.fillRoundRect((int)(subsystem[19][0]*adjx),(int)((subsystem[19][1]+1)*adjy),(int)((subsystem[19][2]+1)*adjx),(int)((subsystem[19][3]-1)*adjy),(int)(0*adjx),(int)(0*adjy) );
g.draw3DRect((int)(subsystem[19][0]*adjx),(int)((subsystem[19][1]+1)*adjy),(int)((subsystem[19][2]+1)*adjx),(int)((subsystem[19][3]-1)*adjy),true );
// g.draw3DRect((int)(44*adjx),(int)(338*adjy),(int)(32*adjx),(int)(25*adjy),true);
g2.setFont(new Font("Times New Roman",Font.PLAIN,(int)(9*adjx)));
g.setColor(Color.black);
g.drawString("SCREEN",(int)((subsystem[19][0]-15+(subw/2))*adjx),(int)((subsystem[19][1]+(subh/2)+5)*adjy));
}
}
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class TestMain extends Constants{
public static void main(String[] args) {
TestMain TM = new TestMain();
TM. init();
} // End of main program
public void init(){
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
setSize((int)xpix,(int)ypix);
setUndecorated(true);
show();
addMouseListener( new MouseAdapter() {
public void mouseClicked (MouseEvent me) {
xpos = me.getX();
ypos = me.getY();
// Check if the click was inside the rectangle area.
if(xpos > rect20xco && xpos < rect20xco+rect20width && ypos >rect20yco && ypos < rect20yco+rect20height)
{
rect20Clicked = true;
System.out.println("rect20="+rect20Clicked);
repaint();
}
else
{
rect20Clicked = false;
repaint();
}
if (xpos > rect1xco && xpos < rect1xco+rect1width && ypos >rect1yco && ypos < rect1yco+rect1height)
{ rect1Clicked = true;
repaint();
}
else
rect1Clicked = false;
repaint();
}
public void mouseEntered (MouseEvent m) {}
public void mouseExited (MouseEvent m) {}
public void mousePressed (MouseEvent m) {}
public void mouseReleased (MouseEvent m) {}
}
);
}
public void paint(Graphics g) {
Graphics2D g2=(Graphics2D)g;
g.setColor( dackground ); // background color
g.fillRect( 0, 0, getWidth(), getHeight() ); // To draw (xpix X ypix) Frame
g.setColor(Color.white);
g.drawRect( 1, 1, getWidth()-3, getHeight()-3 ); // To Draw Outer most Rect
Subsystem SB= new Subsystem();
SB.subsystem(g,g2,subsysystatus);
mainpower MP= new mainpower();
if(rect20Clicked){
// int scr1=1;
MP.screens(g,g2);
//rect20Clicked=true ;
}
if(rect1Clicked ){
System.out.println(scrn);
MP.powercircuit(g,g2);
}
}
}
Hi i have written one small program explains abt screen display and mouse action when i execute.. but the thing is when i simply click on power ckt area before opening screen , it will execute.. but it shouldn't happen.. pl tell me how to perform ..
Regards, Pratibha