2 Replies - 1012 Views - Last Post: 06 April 2007 - 02:02 PM Rate Topic: -----

#1 hanan   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-April 07

Node Selection

Posted 04 April 2007 - 08:16 AM

 public class transmition {
	public int RTSNodes;
	public int CTSNodes;
	private  int NumberOfNodes;

	public void selectNumOfNodes(){
		int i = 0;
		int n = i;
		for(i=2; i<13;i++){
			 RTSNodes = n/2;  CTSNodes = n/2; 
			else if(NumberOfNodes==(2*n-1)){
				RTSNodes= (2*n/2 + 1);
			 CTSNodes = (n- RTSNodes);	

in my project we have 12 nodes and the user will be able to enter the number of nodes, of course each node has a special ID so i want to know how to write the method that can help me to select the nodes that the user enter and to make some of them as sender and the other as reciver. Also, while the transmiting only two nodes will be active and the other will wait while the transmiting finish.

Is This A Good Question/Topic? 0
  • +

Replies To: Node Selection

#2 William_Wilson   User is offline

  • lost in compilation
  • member icon

Reputation: 207
  • View blog
  • Posts: 4,812
  • Joined: 23-December 05

Re: Node Selection

Posted 04 April 2007 - 03:25 PM

you need to be more specific, also what does the node code look like?
Was This Post Helpful? 0
  • +
  • -

#3 hanan   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-April 07

Re: Node Selection

Posted 06 April 2007 - 02:02 PM

// This Code To add Max 12 Node by using Mouse (click!)but it isnot completed yet and I want a code that can help us to select the nodes that the user enter and from that selection some of the nodes will be sender and some reciever, and when the sender will start transmition , the other nodes should be stop except the reciver, so there will be just two nodes active the sender and the reciver. The mechanism of transmiting is that while the sender(Node1 for example) send request to send (RTS) to reciver(Node2) the other nodes will recive the RTC but they willnot be allowed to replay Clear to send , except Node2 which will send CTS, then the Node1 will send to Node2 Data Frame and finally the Node2 will send ACK(acknoledgment) to tell node1 that I recive the data.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
//import java.awt.image.*;

class Add_Node{
JLabel[] lbl=new JLabel[13];
int count=0;

//++++++++++++++++++++ constructor +++++++++++++++++++++++++++++

public Add_Node(){
//make frame
JFrame f=new JFrame("Add Node(Please click!)");
JPanel p = new JPanel();
//make Node labels
for(int i=0;i<12;i++){
String imgname="lap" + (i+1) + ".GIF";
//String imgname="lap" + (int)(Math.random()*12) + ".GIF";
//String imgname="lap2.gif";
Icon img=new ImageIcon(imgname);
lbl[i]=new JLabel("", img, JLabel.LEFT);


//--------------add mouselistener------------------
p.addMouseListener(new myMouseListener());
//------------- add panel -------------------------


//---------------show frame-------------------------
f.getContentPane().setLayout(new GridLayout(1,1));

//-------------------listener receive mouse events -----
class myMouseListener extends MouseAdapter{
public void mouseClicked(MouseEvent me){
if (count==12) count=0;
int x=me.getX();
int y=me.getY();

//--------------------- Main -----------------------------
public static void main(String ar[]){
Add_Node sample=new Add_Node();
}// End of the main

}// End of the class
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1