Use the Window method setVisible(true).
http://java.sun.com/javase/6/docs/api/javax/swing/JFrame.html
http://java.sun.com/javase/6/docs/api/java/awt/Window.html#setVisible(boolean)
Note: There is a Swing forum (http://forum.java.sun.com/forum.jspa?forumID=57) which is the best place for questions related to Swing.
the frame is not displaying.
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {
memForm.setVisible(true);
// memForm.getRootPane();
memForm.toFront();
memForm is the object for memberForm(which is a frame )created thru netBeans.
alright i fixed it.
but there is another problem
when i close the frame of Memberform,the whole application closses.
how do i fix this?
and another doubt
in member form i have a label which has to show the current date when this form is loaded ,it is not displaying.
public void todayDate()
{
Date now = new Date();
DateFormat df1 = DateFormat.getDateInstance(DateFormat.SHORT);
String s1 = df1.format(now);
mtodaydate_form.setText(s1);
}
> when i close the frame of Memberform,the whole application closses.
Make sure the frame's default close operation is not set to EXIT_ON_CLOSE. The default behaviour is to simply hide the frame, so you must have changed that or be calling System.exit() somewhere. (If you are closing the frame programmatcally, you may be closing the wrong frame!)
> in member form i have a label which has to show the current date when this form is
> loaded ,it is not displaying.
As Ceci suggested for your event handler, this method may not be being invoked. Check this by adding - at the start of todayDate() -System.out.println("Ding!");
What is mtodaydate_form? If it is not a JLabel, check that whatever it is has a setText() method that sets the label's text. If it is a JLabel, check that it is the same one that is on the form.