JFrame
in my program i created many JFrames ,
in my main JFame there is a menu ,and inside are the submenus.when clicked on a particular submenu a certain JFrame should appear,is it possible and how?
privatevoid jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt){
memForm.setVisible(true);
// memForm.getRootPane();
memForm.toFront();
[532 byte] By [
anya_aaa] at [2007-11-27 3:49:06]

# 2
well i fixed the error
and now for the buttons
i have different panels.when a particular panel is visible then according to that when the add button is clicked a certain form should appear.
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {
if (isMemPanel )
{
memForm.setVisible(true);
memForm.toFront();
}
it is not working
# 5
private boolean isMemPanel = false;////if this part i set everythingtrue then all forms appear all together when i press the add button
private boolean isEvePanel = false;
private boolean isActPanel = false;
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {
if (isMemPanel )
{
isMemPanel = true;
memForm.setVisible(true);
memForm.toFront();
}
if (isEvePanel )
{
isEvePanel = true;
eveForm.setVisible(true);
eveForm.toFront();
}
if (isActPanel )
{
isActPanel = true;
actForm.setVisible(true);
actForm.toFront();
}
# 6
> if (isMemPanel )
> {
>isMemPanel = true;
> Form.setVisible(true);
>memForm.toFront();
> }
This is never going to work, since you only set isMemPanel to true if it is already true. First, this assignment is redundant (if isMemPanel is true, you don't need to set it again to true), and second, the if-block simply never gets executed, because you initialize isMemPanel to false.
Correct either the initial value of isMemPanel or the if contition, or the place where you update isMemPanel to true.
# 7
ok i did this now
private boolean isMemPanel = true;
private boolean isEvePanel = true;
private boolean isPosPanel = true;
if (isMemPanel )
{
memForm.setVisible(true);
memForm.toFront();
}
..........
all the frames open up together.