traffic control system using java free download source code
#1
Wink 

traffic control system using java free download source code in to the right box for getting free material and support from us/dedicated premium members...
Reply
#2
Thanks you for this application ..
and i wanna to be more control for the idea ..
Big Grin
Reply
#3
Its freaking me out.full of..irritating advertisements
Reply
#4

traffic control system using java free download source code

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;

public class TrafficLight extends JFrame implements ActionListener {
JButton b1, b2, b3;

Signal green = new Signal(Color.green);
Signal yellow = new Signal(Color.yellow);
Signal red = new Signal(Color.red);

public TrafficLight(){
super("Traffic Light");
getContentPane().setLayout(new GridLayout(2, 1));
b1 = new JButton("Red");
b2 = new JButton("Yellow");
b3 = new JButton("Green");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);

green.turnOn(false);
yellow.turnOn(false);
red.turnOn(true);

JPanel p1 = new JPanel(new GridLayout(3,1));
p1.add(red);
p1.add(yellow);
p1.add(green);
JPanel p2 = new JPanel(new FlowLayout());
p2.add(b1);
p2.add(b2);
p2.add(b3);

getContentPane().add(p1);
getContentPane().add(p2);
pack();
}


public static void main(String[] args){
TrafficLight tl = new TrafficLight();
tl.setVisible(true);
}
public void actionPerformed(ActionEvent e){
if (e.getSource() == b1){
green.turnOn(false);
yellow.turnOn(false);
red.turnOn(true);
} else if (e.getSource() == b2){
yellow.turnOn(true);
green.turnOn(false);
red.turnOn(false);
} else if (e.getSource() == b3){
red.turnOn(false);
yellow.turnOn(false);
green.turnOn(true);
}
}
}
class Signal extends JPanel{

Color on;
int radius = 40;
int border = 10;
boolean change;

Signal(Color color){
on = color;
change = true;
}

public void turnOn(boolean a){
change = a;
repaint();
}

public Dimension getPreferredSize(){
int size = (radius+border)*2;
return new Dimension( size, size );
}

public void paintComponent(Graphics g){
g.setColor( Color.black );
g.fillRect(0,0,getWidth(),getHeight());

if (change){
g.setColor( on );
} else {
g.setColor( on.darker().darker().darker() );
}
g.fillOval( border,border,2*radius,2*radius );
}
}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Tagged Pages: program in java for automatic trafic control, traffic control system project in java, traffic system application java code, traffic management system in java code, source code for design a traffic controller systems with java, automatic traffic control system java, traffic control java source code,
Popular Searches: java code for traffic management system, source code project on traffic mgmt system, traffic management system codes in java, traffic control system project in java ppt, traffic management system in java code, java source code for air traffic control system, java traffic project download with codingr,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
Music download free atm with an eye documentation and ppts 5 19,065 27-02-2019, 10:14 AM
Last Post:
  free download college alumni project in php 6 19,630 02-12-2018, 07:06 PM
Last Post:
  solution manual of cl wadhwa power system pdf free download 8 23,515 25-11-2018, 10:48 PM
Last Post:
  technical dumb charades free download related to electrical engineering 1 20,477 18-08-2018, 04:14 PM
Last Post: Guest
Big Grin public distribution system project in vb net pdf download 1 20,329 14-08-2018, 07:25 PM
Last Post: Guest
  free download source code of online college magazine 5 17,882 29-06-2018, 10:09 AM
Last Post: Guest
  mobile computing rajkamal pdf free download 3 18,683 15-06-2018, 07:35 PM
Last Post: susithra baskaran
  download of embedded system black book by kvkk prasad 1 1,949 08-06-2018, 07:52 AM
Last Post: silpa navuluri
  opengl source code for butterfly 3 3,279 14-05-2018, 08:57 AM
Last Post: Akshatha k
  program code of solar tracking system using 8051 microcontroller 6 23,391 03-05-2018, 09:30 PM
Last Post: Guest

Forum Jump: