2 Replies - 1167 Views - Last Post: 08 April 2007 - 10:58 AM Rate Topic: -----

#1 hanan  Icon User is offline

  • New D.I.C Head

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

Remove Node

Posted 07 April 2007 - 11:33 AM

import java.awt.GridLayout;
import java.awt.event.MouseListener;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import javax.swing.WindowConstants;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class NewJFrame extends javax.swing.JFrame {
	private JLabel jLabel1;
	private JButton jButton1;
	private JTextField jTextField1;

	/**
	* Auto-generated main method to display this JFrame
	*/
	
	public void Remove_Node(){
		//make frame
		JFrame f=new JFrame(" Remove(Please Enter!)");
		f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
		JPanel p = new JPanel();
		p.setLayout(null);
		//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);
			p.Add_Node(lbl[i]);
			
		}
		
		
		//--------------remove mouselistener------------------
		p.removeMouseListener(new MouseListener());
		//------------- remove panel -------------------------
		
		f.getContentPane().remove(p);
		
		
		
		//---------------show frame-------------------------
		f.setSize(640,400);
		f.getContentPane().setLayout(new GridLayout(1,1));
		f.setVisible(true);
	}
	
	public static void main(String[] args) {
		NewJFrame inst = new NewJFrame();
		inst.setVisible(true);
	}
	
	public NewJFrame() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				jLabel1 = new JLabel();
				getContentPane().remove(jLabel1);
				jLabel1.setText("please Enter Num. of Node to remove");
				jLabel1.setBounds(7, 35, 182, 35);
			}
			{
				jTextField1 = new JTextField();
				getContentPane().remove(jTextField1);
				jTextField1.setBounds(196, 42, 77, 28);
			}
			{
				jButton1 = new JButton();
				getContentPane().remove(jButton1);
				jButton1.setText("OK");
				jButton1.setBounds(196, 98, 70, 28);
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}




this is a code for removing the nodes but it is not correct , please can anybody make the correction for me.

Is This A Good Question/Topic? 0
  • +

Replies To: Remove Node

#2 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: Remove Node

Posted 07 April 2007 - 11:49 AM

what doesn't work? does it remove the wrong node, do nothing? or are there errors? Please fill us in a little better so we can help.
Was This Post Helpful? 0
  • +
  • -

#3 hanan  Icon User is offline

  • New D.I.C Head

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

Re: Remove Node

Posted 08 April 2007 - 10:58 AM

yes, it does not work, so I want you to write the remove node method again for if you can.Also, can you make the method transmition that happen between two nodes. the mechanism of transmiting that first the sender node send RTS(request to send) and the reciver will send CTS(clear to send), then the sender node will send data frame and the reciver will send the ACK, then the mechanism will finish. In addition, the RTS, CTS,data frame and ACK, will be like arrows.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1