repaint the contentPane may solve this problem.
> i have a problem in my code.i have added the code.when
>the button is clicked the label should disappear.but it is not
>disappearing.can any one help me.
This is C-like code. Normally you use a layout and revalidate after
removing a component. See http://mindprod.com/jgloss/layout.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
> i have a problem in my code.i have added the code.when
> the button is clicked the label should disappear.but it is not
> disappearing.can any one help me.
It does disappear, for me, if you switch to another window and then
switch back.
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
>
> public class card extends JFrame
> {
It's generally a bad idea to extend a class you do not need to.
> // Variables declaration
> private JLabel jLabel1;
[quoted text clipped - 13 lines]
> jButton1 = new JButton();
> contentPane = (JPanel)this.getContentPane();
You should avoid casting if possible. It is easy enough to create a
panel and then set it as the frame's content pane. For my money, code
can be written more easily that way.
> jLabel1.setIcon(new ImageIcon("E:\\cards\\c10.gif"));
> jButton1.setText("jButton1");
[quoted text clipped - 5 lines]
>
> });
You might as well have put the action within the action listener. The
worse the useless variable names point to work of a really bad GUI builder.
> contentPane.setLayout(null);
> contentPane.setBackground(new Color(23, 122, 17));
> addComponent(contentPane, jLabel1, 62,100,71,99);
> addComponent(contentPane, jButton1, 81,247,83,28);
Layout managers would make this sort of data redundant, and also make
the layout work on different GUI configurations.
> this.setTitle("card - extends JFrame");
> this.setLocation(new Point(0, 0));
[quoted text clipped - 12 lines]
> called.");
> contentPane.remove(jLabel1 );
For most uses setVisible works better.
If you add or remove a component on a visible container, you should
paint and validate it. Usually with revalidate and repaint.
> }
>
[quoted text clipped - 13 lines]
> System.out.println(ex);
> }
Was that necessary to demonstrate the problem? When tracking a problem,
and particularly when posting a newsgroup, it generally helps to remove
all non-essential code.
> new card();
You need the usual boilerplate to make sure all Swing code is run on the
Event Dispatch Thread (EDT).
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
... use swing here ...
}
});
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
> public class card extends JFrame
Class names should begin with a cap.
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html