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.

New Topic/Question
Reply




MultiQuote




|