Problems for final year project regarding jpanel to jpanel communication

Hi, I have some problems regarding the creation of a traffic simulator using Net beans. I have three classes for a frame and two panels, namely SimUI() which is the Frame class and TunnelPanel() which extends the panel that the road and traffic will be displayed. I have got so far only to encounter some problems regarding the event listeners which are placed in SIM UI() : The frame class. I want my buttons in one panel to paint objects which re in another panel. someone PLEASE help me as I dont have much time left. Here is my code: -
import java.awt.Color;
import java.awt.Event;
import java.awt.Graphics;
import javax.swing.JSlider;
* SimUI.java
* Created on 24 February 2007, 21:01
* @author Ben Kolosz
public class SimUI extends javax.swing.JFrame {
/** Creates new form SimUI */
public SimUI() {
initComponents();
public class TunnelPanel extends javax.swing.JPanel {
int lineX = 0, lineY = 100;
int lineWidth = 620;
int lineHeight = 3;
int line2X = 0, line2Y = 200;
int line2Width = 620;
int line2Height = 3;
int line3X = 0, line3Y = 145;
int line3Width = 620;
int line3Height = 3;
int line4X = 0, line4Y = 155;
int line4Width = 620;
int line4Height = 3;
public void paintRoad(Graphics g) {
g.setColor(Color.black); //Paint the Tunnel road
g.fillRect(lineX, lineY, lineWidth, lineHeight);
g.fillRect(line2X, line2Y, line2Width, line2Height);
g.fillRect(line3X, line3Y, line3Width, line3Height);
g.fillRect(line4X, line4Y, line4Width, line4Height);
g.drawRect(line4X, line4Y, line4Width, line4Height);
jTextArea1.repaint();
public void setRequestFocusEnabled(boolean requestFocusEnabled) {
public class TrafControl extends javax.swing.JPanel {
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
View = new TunnelPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
Control = new TrafControl();
TrafficFlowTBut = new javax.swing.JToggleButton();
HumanBut = new javax.swing.JButton();
AutomaticBut = new javax.swing.JButton();
ExitBut = new javax.swing.JButton();
FlowSlider = new javax.swing.JSlider();
FlowLabel = new javax.swing.JLabel();
Start = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("INTELLIGENT HIGHWAY SIMULATION v1.0");
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setResizable(false);
getAccessibleContext().setAccessibleName("Intelligent Highway Simulation");
View.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tunnel View", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Gill Sans Ultra Bold Condensed", 0, 11)));
View.setForeground(new java.awt.Color(224, 223, 227));
View.setOpaque(false);
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea1.setColumns(20);
jTextArea1.setEditable(false);
jTextArea1.setRows(1);
jTextArea1.setBorder(null);
jTextArea1.setCaretColor(new java.awt.Color(224, 223, 227));
jTextArea1.setOpaque(false);
jScrollPane1.setViewportView(jTextArea1);
jTextArea1.getAccessibleContext().setAccessibleParent(jTextArea1);
org.jdesktop.layout.GroupLayout ViewLayout = new org.jdesktop.layout.GroupLayout(View);
View.setLayout(ViewLayout);
ViewLayout.setHorizontalGroup(
ViewLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
ViewLayout.setVerticalGroup(
ViewLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, ViewLayout.createSequentialGroup()
.addContainerGap(421, Short.MAX_VALUE)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
Control.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Traffic Control", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Gill Sans Ultra Bold Condensed", 0, 11), new java.awt.Color(255, 51, 51)));
TrafficFlowTBut.setLabel("Traffic Flow");
TrafficFlowTBut.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
HumanBut.setLabel("Human Driver Mode");
HumanBut.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
AutomaticBut.setLabel("Automatic Control");
AutomaticBut.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
ExitBut.setLabel("Exit");
ExitBut.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ActionEvent(evt);
ExitBut.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ButtonExitButBut(evt);
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
FlowSlider.setMajorTickSpacing(60);
FlowSlider.setMaximum(3000);
FlowSlider.setMinorTickSpacing(30);
FlowSlider.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
FlowSliderStateChanged(evt);
FlowSlider.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
FlowLabel.setLabelFor(FlowSlider);
FlowLabel.setText("Vehicle Flow Rate: 0 p/h");
FlowLabel.getAccessibleContext().setAccessibleName("position");
FlowLabel.getAccessibleContext().setAccessibleDescription("position");
Start.setText("Start");
Start.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
StartKeyTyped(evt);
Start.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
StartMouseClicked(evt);
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
org.jdesktop.layout.GroupLayout ControlLayout = new org.jdesktop.layout.GroupLayout(Control);
Control.setLayout(ControlLayout);
ControlLayout.setHorizontalGroup(
ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(ControlLayout.createSequentialGroup()
.add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(ControlLayout.createSequentialGroup()
.add(HumanBut)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(AutomaticBut))
.add(TrafficFlowTBut))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, ControlLayout.createSequentialGroup()
.add(6, 6, 6)
.add(Start)
.add(28, 28, 28)
.add(FlowLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 165, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(org.jdesktop.layout.GroupLayout.LEADING, ControlLayout.createSequentialGroup()
.add(10, 10, 10)
.add(ExitBut)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(FlowSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 187, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(24, Short.MAX_VALUE))
ControlLayout.setVerticalGroup(
ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(ControlLayout.createSequentialGroup()
.addContainerGap()
.add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(HumanBut)
.add(AutomaticBut)
.add(FlowLabel)
.add(Start))
.add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(ControlLayout.createSequentialGroup()
.add(19, 19, 19)
.add(FlowSlider, 0, 0, Short.MAX_VALUE))
.add(ControlLayout.createSequentialGroup()
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(ExitBut)
.add(TrafficFlowTBut))))
.addContainerGap())
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, View, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, Control, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(View, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(Control, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
pack();
}// </editor-fold>
private void StartMouseClicked(java.awt.event.MouseEvent evt) {                                  
private void StartKeyTyped(java.awt.event.KeyEvent evt) {                              
// TODO add your handling code here:
* This method is called by the thread that was created in
* the start method. It does the main animation.
private void ButtonExitButBut(java.awt.event.MouseEvent evt) {                                 
System.exit(0);// TODO add your handling code here:
private void FlowSliderStateChanged(javax.swing.event.ChangeEvent evt) {                                       
JSlider src = (JSlider) evt.getSource();
if(!src.getValueIsAdjusting())
FlowLabel.setText("Vehicle Flow Rate: "+ FlowSlider.getValue() + " p/h");
private void DescWipe(java.awt.event.MouseEvent evt) {                         
jTextArea1.setText(null);
jTextArea1.repaint();
private void ButtonInfo(java.awt.event.MouseEvent evt) {                           
if(evt.getSource() == HumanBut) jTextArea1.setText("Enables Human Reaction control variables in simulation");
if(evt.getSource() == AutomaticBut) jTextArea1.setText("Enables Automated control variables in simulation");
if(evt.getSource() == TrafficFlowTBut)jTextArea1.setText("Toggles between On/Off peak traffic conditions");
if(evt.getSource() == Start)jTextArea1.setText("Starts and stops the simulation, traffic data saved to log when stopped");
if(evt.getSource() == ExitBut)jTextArea1.setText("Exit the Program");
if(evt.getSource() == FlowSlider)jTextArea1.setText("Adjusts the amount of traffic flowing into Tunnel");
private void ActionEvent(java.awt.event.ActionEvent evt) {                            
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new SimUI().setVisible(true);
private String getParameter(String string) {
return null;
// Variables declaration - do not modify
private javax.swing.JButton AutomaticBut;
private javax.swing.JPanel Control;
private javax.swing.JButton ExitBut;
private javax.swing.JLabel FlowLabel;
private javax.swing.JSlider FlowSlider;
private javax.swing.JButton HumanBut;
private javax.swing.JButton Start;
private javax.swing.JToggleButton TrafficFlowTBut;
private javax.swing.JPanel View;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration
//public declarations
private String str;
}

View = new TunnelPanel();This is my panel instance which I have placed at the start of the generated code that Netbeans uses. I had to actually create custom code for this to be displayed but anyhoo I already tried that. The methodI want to call is
public void paintRoad(Graphics g)I have already attempted to call the method from the mouseclick event listener in SIM UI:
TunnelPanel.paintRoad(Graphics g)but a compiler error reads cannot issue a static command or something like that: -
Here is my code formatted, hope you can help mate.:)
import java.awt.Color;
import java.awt.Event;
import java.awt.Graphics;
import javax.swing.JSlider;
* SimUI.java
* Created on 24 February 2007, 21:01
* @author Ben Kolosz
public class SimUI extends javax.swing.JFrame {
/** Creates new form SimUI */
public SimUI() {
initComponents();
public class TunnelPanel extends javax.swing.JPanel {
int lineX = 0, lineY = 100;
int lineWidth = 620;
int lineHeight = 3;
int line2X = 0, line2Y = 200;
int line2Width = 620;
int line2Height = 3;
int line3X = 0, line3Y = 145;
int line3Width = 620;
int line3Height = 3;
int line4X = 0, line4Y = 155;
int line4Width = 620;
int line4Height = 3;
public void paintRoad(Graphics g) {
g.setColor(Color.black); //Paint the Tunnel road
g.fillRect(lineX, lineY, lineWidth, lineHeight);
g.fillRect(line2X, line2Y, line2Width, line2Height);
g.fillRect(line3X, line3Y, line3Width, line3Height);
g.fillRect(line4X, line4Y, line4Width, line4Height);
g.drawRect(line4X, line4Y, line4Width, line4Height);
jTextArea1.repaint();
public void setRequestFocusEnabled(boolean requestFocusEnabled) {
public class TrafControl extends javax.swing.JPanel {
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
View = new TunnelPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
Control = new TrafControl();
TrafficFlowTBut = new javax.swing.JToggleButton();
HumanBut = new javax.swing.JButton();
AutomaticBut = new javax.swing.JButton();
ExitBut = new javax.swing.JButton();
FlowSlider = new javax.swing.JSlider();
FlowLabel = new javax.swing.JLabel();
Start = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("INTELLIGENT HIGHWAY SIMULATION v1.0");
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setResizable(false);
getAccessibleContext().setAccessibleName("Intelligent Highway Simulation");
View.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tunnel View", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Gill Sans Ultra Bold Condensed", 0, 11)));
View.setForeground(new java.awt.Color(224, 223, 227));
View.setOpaque(false);
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea1.setColumns(20);
jTextArea1.setEditable(false);
jTextArea1.setRows(1);
jTextArea1.setBorder(null);
jTextArea1.setCaretColor(new java.awt.Color(224, 223, 227));
jTextArea1.setOpaque(false);
jScrollPane1.setViewportView(jTextArea1);
jTextArea1.getAccessibleContext().setAccessibleParent(jTextArea1);
org.jdesktop.layout.GroupLayout ViewLayout = new org.jdesktop.layout.GroupLayout(View);
View.setLayout(ViewLayout);
ViewLayout.setHorizontalGroup(
ViewLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
ViewLayout.setVerticalGroup(
ViewLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, ViewLayout.createSequentialGroup()
.addContainerGap(421, Short.MAX_VALUE)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
Control.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Traffic Control", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Gill Sans Ultra Bold Condensed", 0, 11), new java.awt.Color(255, 51, 51)));
TrafficFlowTBut.setLabel("Traffic Flow");
TrafficFlowTBut.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
HumanBut.setLabel("Human Driver Mode");
HumanBut.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
AutomaticBut.setLabel("Automatic Control");
AutomaticBut.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
ExitBut.setLabel("Exit");
ExitBut.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ActionEvent(evt);
ExitBut.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ButtonExitButBut(evt);
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
FlowSlider.setMajorTickSpacing(60);
FlowSlider.setMaximum(3000);
FlowSlider.setMinorTickSpacing(30);
FlowSlider.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
FlowSliderStateChanged(evt);
FlowSlider.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
FlowLabel.setLabelFor(FlowSlider);
FlowLabel.setText("Vehicle Flow Rate: 0 p/h");
FlowLabel.getAccessibleContext().setAccessibleName("position");
FlowLabel.getAccessibleContext().setAccessibleDescription("position");
Start.setText("Start");
Start.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
StartKeyTyped(evt);
Start.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
StartMouseClicked(evt);
public void mouseEntered(java.awt.event.MouseEvent evt) {
ButtonInfo(evt);
public void mouseExited(java.awt.event.MouseEvent evt) {
DescWipe(evt);
org.jdesktop.layout.GroupLayout ControlLayout = new org.jdesktop.layout.GroupLayout(Control);
Control.setLayout(ControlLayout);
ControlLayout.setHorizontalGroup(
ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(ControlLayout.createSequentialGroup()
.add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(ControlLayout.createSequentialGroup()
.add(HumanBut)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(AutomaticBut))
.add(TrafficFlowTBut))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, ControlLayout.createSequentialGroup()
.add(6, 6, 6)
.add(Start)
.add(28, 28, 28)
.add(FlowLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 165, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(org.jdesktop.layout.GroupLayout.LEADING, ControlLayout.createSequentialGroup()
.add(10, 10, 10)
.add(ExitBut)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(FlowSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 187, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(24, Short.MAX_VALUE))
ControlLayout.setVerticalGroup(
ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(ControlLayout.createSequentialGroup()
.addContainerGap()
.add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(HumanBut)
.add(AutomaticBut)
.add(FlowLabel)
.add(Start))
.add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(ControlLayout.createSequentialGroup()
.add(19, 19, 19)
.add(FlowSlider, 0, 0, Short.MAX_VALUE))
.add(ControlLayout.createSequentialGroup()
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(ExitBut)
.add(TrafficFlowTBut))))
.addContainerGap())
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, View, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, Control, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(View, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(Control, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
pack();
}// </editor-fold>
private void StartMouseClicked(java.awt.event.MouseEvent evt) {
private void StartKeyTyped(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
* This method is called by the thread that was created in
* the start method. It does the main animation.
private void ButtonExitButBut(java.awt.event.MouseEvent evt) {
System.exit(0);// TODO add your handling code here:
private void FlowSliderStateChanged(javax.swing.event.ChangeEvent evt) {
JSlider src = (JSlider) evt.getSource();
if(!src.getValueIsAdjusting())
FlowLabel.setText("Vehicle Flow Rate: "+ FlowSlider.getValue() + " p/h");
private void DescWipe(java.awt.event.MouseEvent evt) {
jTextArea1.setText(null);
jTextArea1.repaint();
private void ButtonInfo(java.awt.event.MouseEvent evt) {
if(evt.getSource() == HumanBut) jTextArea1.setText("Enables Human Reaction control variables in simulation");
if(evt.getSource() == AutomaticBut) jTextArea1.setText("Enables Automated control variables in simulation");
if(evt.getSource() == TrafficFlowTBut)jTextArea1.setText("Toggles between On/Off peak traffic conditions");
if(evt.getSource() == Start)jTextArea1.setText("Starts and stops the simulation, traffic data saved to log when stopped");
if(evt.getSource() == ExitBut)jTextArea1.setText("Exit the Program");
if(evt.getSource() == FlowSlider)jTextArea1.setText("Adjusts the amount of traffic flowing into Tunnel");
private void ActionEvent(java.awt.event.ActionEvent evt) {
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new SimUI().setVisible(true);
private String getParameter(String string) {
return null;
// Variables declaration - do not modify
private javax.swing.JButton AutomaticBut;
private javax.swing.JPanel Control;
private javax.swing.JButton ExitBut;
private javax.swing.JLabel FlowLabel;
private javax.swing.JSlider FlowSlider;
private javax.swing.JButton HumanBut;
private javax.swing.JButton Start;
private javax.swing.JToggleButton TrafficFlowTBut;
private javax.swing.JPanel View;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration
//public declarations
private String str;
}

Similar Messages

  • Ideas For Final Year Project

    Hi everyone, I'm new here. In fact this is my first ever post in the SDN coummunity. I'm studying BIS and majoring in knowledge management. I'm also very very interested in enterprise 2.0
    I started learning about SAP 4 months ago and since then I've been hooked. I don't know much and I'm not an expert like you all but I'm absolutely willing to learn, learn and learn some more.
    I'll be starting my FYP soon and I was thinking of doing it using SAP/ABAP since I'm preparing to get certified and to have a career in an SAP related field after I graduate anyway.
    Any ideas please? This lost ambitious soul would appreciate your help. Is it possible to do something not too complicated related to knowledge management or enterprise 2.0 with ABAP?
    SAP is available in my university computer labs.
    Thank you all in advance and my apologies if I'm posting this in the wrong place.

    Hi Edward. For a while I was starting to think nobody was going to reply.
    SAP is indeed a huge and wide world. That's what makes it both interesting and challenging. We do get taught a basic course in ABAP at my university but that's about it. I'll be enrolling in it next semester. By the end of this year, I'll be hopefully sitting for an SAP certification. Meanwhile I'm reading a lot on SAP and also doing my 8 months internship in Alcatel-Lucent. My tasks are more business oriented rather than technical (something I'm glad about).
    Why did I develop an interest in SAP? Well, since I was a little kid, I've always loved LEGOS. It seems like there are tons of SAP components and pieces that can be utilized in creative ways to solve problems and make business organization more efficient and effective. It all depends on how well the business process is analyzed, then adjusted to SAP's best practices and finally how the SAP components/modules (aka LEGOS in Amir's vocabulary) are put together.
    I also have a deep interest in the application of technologies that facilitate creation of communities, better knowledge exchange and collaboration. I'm not that much interested in the technical aspects of the technologies themselves, since I don't really consider myself to be a programmer but rather their application. As for Enterprise 2.0, it's the next generation of KM tools and that's why I mentioned them together. Maybe KM 2.0 is a better term. Eh, poteto potato, tometo, tomato.
    I don't have something solid in mind and there are some limitations. The SAP system in my campus isn't dynamic like how a real company's sytem would be. Plus I'm not sure how ABAP could be used to make applications within SAP. From my humble experience so far, it's mainly for report generation, kind of like how VBA and Macro aid in producing reports with Excel files.
    What are ABAP's capabilities? I'm interested in making something like Blogtronix:
    http://www.blogtronix.com/
    Sorry about the long rant.
    By the way, nice work on the Wii thingy. I read about it on Vedorprisey. Small cyber world huh? I LOVE the blogosphere

  • Im a Uni student&need help:JAVA Final Year Project: Undo Manager Problem

    Hey all,
    Im writing a Final Year Project and have minimal experience writing in JAVA.
    It is an information visualisation assignment which involves reproducing code/text in a reduced format. Sort of to do with Line oriented statistics.
    http://www.cc.gatech.edu/aristotle/Tools/tarantula/continuous.gif
    This image will give you an idea of what im talking about.
    Anyway, i need to know if its possible to get information about individual undos/edits from an undomanager.
    Basically i need to be able to say, for example,
    there are 12 undos
    undo 12 occurs at line X
    undo 11 occurs at line Y
    etc etc
    I need to be able to get this information without actually invoking the Undo last edit call.
    Im bringing the Java undomanager tutorial home but from what ive read it seems like impossible?
    Any and all help appreciated.
    Regards,
    P

    When I was at uni I had to implement that for the text area of an IDE. All I did was rip off the code from the Notepad.java that comes with the SDK.

  • Need some Idea for my final year project to increase buffer size

    hi...i need some idea from someone to give some idea, advice or some excersice/toturial about " how to increase buffer size" on my final year project, i have try find the solution..but it's still have problem on my oscilloscope.VI. I was design my final year project using LabVIEW 8.6 and now i state my design for someone to refer my project.
    Thank You  
    Attachments:
    Oscilloscope A.llb ‏166 KB

    Don't know if this is what you're searching for, and I don't know if there is such a function in LV 8.6, but I'm using LV 2010 and under DAQmx Pallete, you go to "Advanced Task Options", there is a function "Configure Output Buffer", in which you can configure the buffer size you want.

  • Ideas for my final year project

    Hi evryone,
    I'm a final year software engineering student,I'm looking for
    dynamic,innovative final year project based on J2EE technologies.
    I'll be looking forward for ideas/suggestions from the community members.

    Install Eclipse, tomcat, axis, logger, ajax...explore all and implement in your project.Why would you recommend those technologies?! Don't install or explore any of these until you decide WHAT you want to do. You match the tech to the requirement, not the other way around.

  • PPL i need an idea for my final year project

    Hello ppl
    I have posted this topic before and am posting it once again...... I m a student of B.Sc final Year in Software Development....... I m looking for an idea for my final year project......I m very good at programming in Java..... also have some hands on experince of XML... nowadys reading abt voice XML.....
    So i anybody of u can suggest me something i will be extremely grateful.... i will prefer doing something for mobile phones... i.e. my target wud be J2ME..... but any other idea can also work...... but plz keep in mind that the project shud be of such length that it can last for 1 year..... also it shud be challenging......
    Thanx in Advance....
    I need it ppl... plz reply

    www.jabber.org does stuff with XML and instant messaging, and occasionally hints at involving phones. you might get some ideas from what they're doing.

  • Need help on developing system as my final year project

    hello everyone.
    I would like to find someone who can guide me in developing a system for my final year project ( title:Event Correlation Analysis System).As i am not really good in programming i find it very difficult to start in code the program.Whateva it is i need to develop the program in order to be graduated.I am having a very hard time here as this title is given to me by my lecturer who is expecting me to do everything..Please anyone help to guide me.
    My project is about using java to create a system which can monitor log file and uses some rules to correlate and output to end-user the prove of a particular problem (i.e: accessing pornography.).for more information find articles about event correlation system.
    thousands of thanks in advance.

    Praveen_Forum wrote:
    Vijen..!!
    just forget it no one here would write code for you it is you who have to struggle and write some code come back if you have any specific questions regarding the coding or architecture or something like that so [Get Started|http://java.sun.com/docs/books/tutorial/getStarted/index.html]
    OP didn't ask anyone to code it for him/her
    that said, OP needs to put forth some effort
    you'd think a final year student could demonstate a bit more understanding of how to interact in a community such as this
    i'm also curious to know why a final year student has been given a software project but doesn't know how to program?

  • Final Year Project - University

    Hi all,
    Just looking some advice and general tips, have a few questions about a final year project I am thinking of doing.
    Basically it is going to be a stock control system for a nightclub, particulary focussing on their celler. The system will allow the staff/management to review stock levels and alerts will also be enabled to alert them to order appropiate stock, perhaps a draft invoice could be created automatically once stock hits a certain level.
    This is basically to replace the old paper based method, could also include costing for each night.
    To implement something like this, what am i looking at as in regards to software and how hard could be. What programs would guys recommend. I have done a little work on Oracle, but its pretty basic.
    Thanks in advance.

    I'd say my suggestion is as good as anyones. Have you thought about using Oracle XE with its pre-installed APEX development environment? That should be more than enough to manage a nightclub's inventory.
    Here's the link, just in case ...
    C.
    Message was edited by:
    cd

  • How to add on the measuring the frequency in my Final Year Project...

    Hi...i has design my final year project...my problem is how to add on some measurement in my final year project...now i want add measurement  frequency...in to my final year project...so i hope someone willing can help me or can give me advice....how to add on measurement frequency... before that i state my final project, for information.. i has design my final year project using LabVIEW 8.6.....Thank You
    Attachments:
    Oscilloscope A.llb ‏228 KB

    ''sanam [[#question-1055070|said]]''
    <blockquote>
    Hello,
    we are two members in our group Ambreen Akhtar and Sanam Naz
    we are females we want to create an adds on for our final year project as we are universtiy students of UOG M-IT(4th semester)..we would like to enquire what kindS of language and tools will be used to create an adds ons...I want to filter unwanted text and images that we dont want to see or read text but not all kinds of adds...
    we want to enquire about the following things below:
    1:met lab library.
    2:check content to check the images and text.
    3:content filter.
    we want to make a new plug in your browser(Mozilla firefox)
    Thanks in advance.
    </blockquote>
    uog(university of gujrat) MiT(Master in information technology) mean..

  • Final Year Project! Please give me some idea!

    I'm doing an individual final year project using IBM Aglet, JRun and J2ME. The topic is "Mobile agent shopping system", better with some theories. I have no idea about what types of application should be done. Initially, I intended to build a system for the customers to search for the products in a shopping mall with data mining recommendation(e.g. association-Apriori), but my supervisor want me to give him a new idea because previous students has built similar application (but using classification in data mining).
    My supervisor has another 3 students doing the same project, but one of them doing a restaurant reservation system, another one has many multimedia in his system. The last one - I don't know. It seems that my project has no "selling points". I don't want to think of a quite complicated one as my programming skill is not so good. But the big problem is the project is restricted to a shopping mall. There is not much can be done. The project will be handed in 2 months later. I'm afraid that I can't hand it in on time. Does anyone have any suggestion on the topic. I have thought of this many times, but my supervisor still does not satisfy with it.
    Please help me!

    http://mindprod.com/projects/projects.html

  • Oracle Final Year Project Choice Help Needed

    hi everyone,
    I m Amir from Pakistan, I m a student of CS final year at a IT University powered by Govt.of pakistan.
    Can any one help us regarding choice of Final Year project/proposal. we want to build oracle based solution for any industry or sector which will also helpfull for me and my team not only for College Final Year Project but also for after college industry solutions.
    As in consideration different sectors are in front of us, i.e Oil & Gas, Manufacturing, Automobiles, Communications etc
    But, we think this forum is much help full cause different professional peoples are much better able to guide us with respect to current and upcoming trends.
    Thanks
    Amir

    Hi Amir,
    I can think of a dozen different projects. You could check the functionalities in Oracle's eBusiness Suite (Oracle Applications). For instance you could implement a human resource module (employees details, salaries etc), or a employee time card application. Why not a resource booking system (conference rooms, beamers, computers etc).
    All these examples could easily be split into parts. Say for instance time reporting. One group could implement the interface to the employees, one group the interface to the managers, to the human resource department, and there's also quite some administrative setup modules.
    What project proposals have you come up with yet?
    Well, because it's your first post I warmly welcomes you to the Oracle Forums here at Oracle Technology Network.
    Regards,
    Martin Malmstrom
    ORACLE Consulting

  • Help me in Doing my Final Year Project

    Dear All,
    I am studying BSc in Computer Science in American International University Bangladesh (AIUB), Bangladesh. I want to work with Java Card. Actually I want to complete my final year project in Java Smart Card.
    I want to develop a Smart Card for student as mention in the link
    http://java.sun.com/products/javacard/examples.html
    1. when student insert the card in card accepantance device in entrance of the university all information(Name, ID,Photo, Department.....) will be displayed in the monitor of the entrance. After see the pic get keeper have no confusion about the student.
    2. Student can also use this card to use the facilities of Library and Cafe.
    Now dear all pls help me by proving this information.
    1. What kind of hardware i need to complete the project and successfully deploy it to my university. Pls tell me briefly and if possible then tell me the link where i can but it.(If the parts are available in UK then let me know. It will be easy for me to collect parts from there).
    2. What kind of Smart Card I have to use exactly.
    3. If anyone ever develope this kind of project then pls email me at [email protected]
    4. If possible then pls let me know the price of this hardware.
    Its very vey urgent. I know all Java lover will definetly help me.
    I am waiting for reply
    Yeasin Habib
    Bangladesh

    I want to develop a Smart Card for student as mention
    in the link
    http://java.sun.com/products/javacard/examples.html
    Well then you have a number of points that can be solved very differently. Does exist any legacy hardware or software that need to be included into your project?
    1. when student insert the card in card accepantance
    device in entrance of the university all
    information(Name, ID,Photo, Department.....) will be
    displayed in the monitor of the entrance. After see
    the pic get keeper have no confusion about the
    student.Where do you want do store the student information? On card or in a centralised database? Who should be able to change information?
    2. Student can also use this card to use the
    facilities of Library and Cafe.Looks like money comes into play. "Stealing money" is always a good impulsion for any attacker. You should consider this in your system design.
    1. What kind of hardware i need to complete the
    project and successfully deploy it to my university.Sorry, but except for the hardware parts "chipcard terminal" (with or without pin-pad) and several smartcards I can give you only the answer: "That depends on what you want to achieve and how you want to do it"
    2. What kind of Smart Card I have to use exactly.If you want to store the student image on the card, on of your main requirements would be a smartcard that has enough EEPROM for storing the image. Common JavaCards have 10 to 30kb for data and the applet code.
    Jan

  • Help in mobile agents in java(with final year project)

    i have decided that i ll make a project on mobile agent security and data encapsulation plz any guy who have worked on this topic or he/she know about some indian version books written in java (like intelligent agents written in java by Joseph P. Bigus, Jennifer Bigus ) thn please help me
    plz ur ideas is very important for me becz i have not enough help available on my college and if u know any company that provide such type projects for final year student thn tell me .

    I want to develop a Smart Card for student as mention
    in the link
    http://java.sun.com/products/javacard/examples.html
    Well then you have a number of points that can be solved very differently. Does exist any legacy hardware or software that need to be included into your project?
    1. when student insert the card in card accepantance
    device in entrance of the university all
    information(Name, ID,Photo, Department.....) will be
    displayed in the monitor of the entrance. After see
    the pic get keeper have no confusion about the
    student.Where do you want do store the student information? On card or in a centralised database? Who should be able to change information?
    2. Student can also use this card to use the
    facilities of Library and Cafe.Looks like money comes into play. "Stealing money" is always a good impulsion for any attacker. You should consider this in your system design.
    1. What kind of hardware i need to complete the
    project and successfully deploy it to my university.Sorry, but except for the hardware parts "chipcard terminal" (with or without pin-pad) and several smartcards I can give you only the answer: "That depends on what you want to achieve and how you want to do it"
    2. What kind of Smart Card I have to use exactly.If you want to store the student image on the card, on of your main requirements would be a smartcard that has enough EEPROM for storing the image. Common JavaCards have 10 to 30kb for data and the applet code.
    Jan

  • Final year project need help

    hi there
    i am doing an applet for my final year project. at the end of this project i have to end up with a simple uml drawing applet. i have done some coding but am way outa my league and now i am stuck. i have managed to draw lines and rectangles but have no idea how to make the lines attch to the rectangles or how to move a rectangle around the screenonce it has been drawn. my email address is [email protected] if you mail me i can give you my program and maybe you can help me

    You are right V.V, this applet is not finished yet, try this one,
    press the oval/rectangle/desic buttons and add shapes by clicking on an empty square, after adding some shapes press the line button, by clicking on 2 shapes you will add a line to connect them. you can drag the shapes and the lines will follow.
    Use double click for text. Drag the shape out of the screen and it will be deleted.
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class Flow extends Applet
         Button lineB = new Button("Line");
         Button rectB = new Button("Rect");
         Button ovalB = new Button("Oval");
         Button desiB = new Button("Desic");
         Button clirB = new Button("Clear");
         Label  typeL = new Label("             ");
         Dcanvas  canvas     = new Dcanvas();
    public void init()
         setLayout(new BorderLayout());
         add("Center",canvas);
         addButtons();
         resize(730,440);
    private void addButtons()
         lineB.addActionListener(new ButtonHandler());
         rectB.addActionListener(new ButtonHandler());
         ovalB.addActionListener(new ButtonHandler());
         desiB.addActionListener(new ButtonHandler());
         clirB.addActionListener(new ButtonHandler());
         Panel panel = new Panel();
         panel.add(lineB);
         panel.add(rectB);
         panel.add(ovalB);
         panel.add(desiB);
         panel.add(clirB);
         panel.add(typeL);
         add("North",panel);
    class ButtonHandler implements ActionListener
    public void actionPerformed(ActionEvent ev)
         String s = ev.getActionCommand();
         if(s.equals("Clear")) canvas.clear();
         if(s.equals("Line"))  canvas.setType(1);
         if(s.equals("Rect"))  canvas.setType(2);
         if(s.equals("Oval"))  canvas.setType(3);
         if(s.equals("Desic")) canvas.setType(4);
    public class Dcanvas extends Panel
         Vector    objects = new Vector();
         Vector    lines   = new Vector();
         TextField txt     = new TextField("");
         Mobject   rc,rl,rd;
         Mline     ln;
         boolean   rcd  = false;
         boolean   rcl  = false;
         boolean   rct  = false;
         Rectangle rp;
         Graphics2D G;
         int sx,sy,oi;
         int objectType = 0;     
         int maxV = 8;
         int maxH = 9;
         int sizeW = 80;
         int sizeH = 50;
    public Dcanvas()
         super();
         setLayout(null);
         addMouseListener(new MouseHandler());
         addMouseMotionListener(new MouseMotionHandler());
         setFont(new Font("",0,9));
         txt.setSize(114,23);
         txt.setFont(new Font("",0,15));
         txt.setBackground(new Color(192,220,192));
         add(txt);
         txt.setVisible(false);
         txt.addTextListener(new TextListener()     
         {     public void textValueChanged(TextEvent e)
                   rc.setText(txt.getText());     
                   repaint(rc.x,rc.y,rc.width,rc.height);
    public void clear()
         objects.removeAllElements();
         lines.removeAllElements();
         objectType = 0;
         typeL.setBackground(Color.white);
         typeL.setText("");
         txt.setVisible(false);
         repaint();
    public void setType(int i)
         if (rcl) repaint(rl.x,rl.y,rl.width+1,rl.height+1);
         objectType = i;
         typeL.setBackground(Color.pink);
         if (i == 1)     typeL.setText(" Lines");
         if (i == 2)     typeL.setText(" Rects");
         if (i == 3)     typeL.setText(" Ovals");
         if (i == 4)     typeL.setText(" Desic");
         rcl = false;
    public void dragIt(int X, int Y)
         repaint(rc.x,rc.y,rc.width,rc.height);
         rc.x = rc.x + X - sx;
         rc.y = rc.y + Y - sy;
         rc.setPaintArea();
         sx   = X;
         sy   = Y;
         repaint(rc.x,rc.y,rc.width,rc.height);
    public void moveIt(int X, int Y)
         rcd = false;
         repaint(rc.x,rc.y,rc.width,rc.height);
         rc.x = X;
         rc.y = Y;
         rc.setPaintArea();
         repaint(rc.x,rc.y,rc.width,rc.height);
         Mline ml;
         for (int i=0; i < lines.size(); i++)
              ml = (Mline)lines.get(i);
              if (ml.from == rd || ml.to == rd)
                   ml.setPaintArea();
                   repaint();
    public void deleteIt()
         rcd = false;
         Mline ml;
         for (int i=0; i < lines.size(); i++)
              ml = (Mline)lines.get(i);
              if (ml.from == rd || ml.to == rd)
                   lines.remove(i);
                   i--;
         objects.remove(rc);
         repaint();
    public void paint(Graphics g)
         rp = g.getClipBounds();
         g.setColor(Color.white);
         g.fillRect(rp.x,rp.y,rp.width,rp.height);
         g.setColor(new Color(240,240,240));
         for (int x=0; x < 721; x=x+sizeW) g.drawLine(x,0,x,400);
         for (int y=0; y < 401; y=y+sizeH) g.drawLine(0,y,720,y);
         for (int i=0; i < lines.size(); i++) ((Mline)lines.get(i)).paint(g);
         for (int i=0; i < objects.size(); i++) ((Mobject)objects.get(i)).paintW(g);
         if (rcd) rc.paintD(g);
         if (rcl) rc.paintL(g);
    public void update(Graphics g)
         paint(g);
    //     *********   mouse   ************
    class MouseHandler extends MouseAdapter
    public void mousePressed(MouseEvent e)
         txt.setVisible(false);
         for (int i=0; i < objects.size(); i++)
              if (((Rectangle)objects.get(i)).contains(e.getX(),e.getY()))
                   rc  = (Mobject)objects.get(i);
                   rd  = rc;
                   sx  = e.getX();
                   sy  = e.getY();
                   if (e. getClickCount() == 2)  
                        txt.setLocation(rc.x,rc.y+rc.height-1);
                        txt.setText(rc.getText());
                        txt.setVisible(true);
                        txt.requestFocus();
                   rcd = true;
         if (rcd && rcl)
              ln  = new Mline(rl,rc);
              lines.add(ln);
              rcd = false;
              rcl = false;
              rp.setBounds(rc);
              rp.add(rl);
              repaint(rp.x,rp.y,rp.width,rp.height);
         if (rcd && objectType == 1)
              rcd = false;
              rcl = true;
              rl  = rc;
              repaint(rc.x,rc.y,rc.width,rc.height);
    public void mouseReleased(MouseEvent e)
         int x = e.getX()/sizeW;
         int y = e.getY()/sizeH;
         x = x * sizeW + 1;
         y = y * sizeH + 1;
         if (rcd)
              if (x > maxH || y > maxV) deleteIt();
                   else                  moveIt(x,y);
              return;     
         if (objectType == 2 || objectType == 3 || objectType == 4)
              rc = new Mobject(objectType,x,y,sizeW-2,sizeH-2);
              objects.add(rc);
              repaint(rc.x,rc.y,rc.width,rc.height);
    class MouseMotionHandler extends MouseMotionAdapter
    public void mouseDragged(MouseEvent e)
         if (rcd) dragIt(e.getX(),e.getY());
    //     *********   mouse  end ************
    class Mobject extends Rectangle
         long    id;
         int     type;
         int     ax,ay,aw,ah;
         String  text = "";
         Polygon po   = new Polygon();
    public Mobject(int t, int x,int y,int w,int h)
         super(x,y,w,h);
         type = t;
         setPaintArea();
         type = t;
         id = System.currentTimeMillis();
    public void setText(String s)
         text = s;
    public String getText()
         return(text);
    public void setPaintArea()
         ax = x + 5;
         ay = y + 5;
         aw = width  - 10;
         ah = height - 10;
         if (type == 4)
              po.npoints = 0;
              po.addPoint(ax+aw/2,ay);
              po.addPoint(ax+aw,ay+ah/2);
              po.addPoint(ax+aw/2,ay+ah);
              po.addPoint(ax,ay+ah/2);
              po.addPoint(ax+aw/2,ay);
    public void paintL(Graphics g)
         g.setColor(Color.orange);
         paint(g);
    public void paintD(Graphics g)
         g.setColor(Color.red);
         paint(g);
    public void paintW(Graphics g)
         g.setColor(Color.white);
         paint(g);
    public void paint(Graphics g)
         if (type == 2) g.fillRect(ax,ay,aw,ah);
         if (type == 3) g.fillOval(ax,ay,aw,ah);
         if (type == 4) g.fillPolygon(po);
         g.setColor(Color.black);
         if (type == 2) g.drawRect(ax,ay,aw,ah);
         if (type == 3) g.drawOval(ax,ay,aw,ah);
         if (type == 4) g.drawPolygon(po);
         g.drawString(text,ax+3,ay+ah/2+2);
    class Mline
         Mobject from,to;
         int x1,y1,x2,y2;
    public Mline(Mobject f, Mobject t)
         from = f;
         to   = t;
         setPaintArea();
    public void setPaintArea()
         x1 = from.x + from.width/2;
         y1 = from.y + from.height/2;
         x2 = to.x + to.width/2;
         y2 = to.y + to.height/2;
    public void paint(Graphics g)
         g.setColor(Color.blue);
         g.drawLine(x1,y1,x2,y2);
    Noah

  • Final year project using labview, what project i can apply?

    i'm goin to be do a final year project, n i thinkin to use labview do it.! but i dun hav idea tht is suit...coz it can't use to the station..
    anyone can give me some idea??thanks

    Greetings!
       Are you exposed to LabVIEW programming before or are you
    planning on learning LabVIEW and graphical programming for your design
    project. If you are looking for resources the following link is a great
    way to start.
    http://www.ni.com/academic/lv_training/how_learn_lv.htm
    The three hour course is really easy. Once you are done my
    recommendation is to use one of our shipping examples like temperature
    control with DAQ assistant and PID. Please let me know if you have
    issues setting up the LabVIEW development environment / programming and
    post any questions.
    Thanks much
    Avi Harjani

Maybe you are looking for

  • HT1199 Newer version of iTunes will not open.  My music is gone.  How can I get the older version back?

    My "newer version" of itunes will not open.  How can I either get it to open or get the older version which worked fine?

  • How to optimize code for getting list of portal GP erroneous processes

    Hello, In our Web Dynpro application for Java we got the list of GP processes with status Erroneous which match the following criteria (initiator, processName, blockName, actionName, startDate, endDate, instanceName, actionProcessor) by loop of all p

  • Connecting with the printer

    I can't send documents to my printer to print because my laptop says that the printer is 'offline'. However when I check the connection on the printer itself it says that it's connected to wifi. But my laptop still can't send documents to the printer

  • Question about Snow Leopard and my Macbook Black

    I have a macbook black and run it with 4gb of ram right now--the new info for snow leopard says that the OS will support 8gb+ ... is there a hardware issue on a late 2007 macbook black that's preventing this or will I be able to drop 8gb of ram in th

  • Run once inside timed loop

    I have a timed loop that monitors equipment. Whenever there is a fault I have it send a notification email. My problem is how to stop it from sending email every single time the time loop is executed. I tried placing the send email inside a for loop