aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how will  we move from one page to another within the same window  in Swing? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how will  we move from one page to another within the same window  in Swing?" Watch "how will  we move from one page to another within the same window  in Swing?" New topic
Author

how will we move from one page to another within the same window in Swing?

Anjali Guduru
Greenhorn

Joined: Sep 22, 2009
Posts: 5
Hi,
I am new to Swing. I am trying to understand it. My problem is, I have created one login form which has username and password fields in it, when ever user clicks submit button, it has to show another page within the same window. But for me whenever he clicks submit button in the login form page , another new window is opening.

Please someone help me with this problem.

Thanks in Advance,
Anjali.

Miklos Szeles
Ranch Hand

Joined: Oct 21, 2008
Posts: 142
Please send the code, so we can help to corect it.
Anjali Guduru
Greenhorn

Joined: Sep 22, 2009
Posts: 5
Hi Miklos Szeles,
Thanks for your prompt response. Here is the code . i have used Netbeans Ide for Swing GUI

LoginForm.java:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* LoginForm.java
*
* Created on Sep 26, 2009, 12:50:17 AM
*/

package learn;

import javax.swing.JLabel;
import javax.swing.JOptionPane;

/**
*
* @author pguduru
*/
public class LoginForm extends javax.swing.JFrame {
private SwingPlayForm form;
/** Creates new form LoginForm */
public LoginForm() {
initComponents();
this.setBounds(50, 50, 800, 470);
this.setResizable(false);
}


/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

LoginPanel = new javax.swing.JPanel();
userName = new javax.swing.JLabel();
userNametextfileld = new javax.swing.JTextField();
passWord = new javax.swing.JLabel();
passWordtextfield = new javax.swing.JPasswordField();
titleLabel = new javax.swing.JLabel();
submit = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

javax.swing.GroupLayout LoginPanelLayout = new javax.swing.GroupLayout(LoginPanel);
LoginPanel.setLayout(LoginPanelLayout);
LoginPanelLayout.setHorizontalGroup(
LoginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
LoginPanelLayout.setVerticalGroup(
LoginPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);

userName.setText("UserName");

userNametextfileld.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
userNametextfileld.setMinimumSize(new java.awt.Dimension(20, 20));

passWord.setText("Password");

passWordtextfield.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N

titleLabel.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
titleLabel.setForeground(new java.awt.Color(153, 51, 0));
titleLabel.setText("Cloud-based Backup");
titleLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);

submit.setText("Submit");
submit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
submitActionPerformed(evt);
}
});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(250, 250, 250)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(LoginPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(passWord)
.addGap(67, 67, 67))
.addGroup(layout.createSequentialGroup()
.addComponent(userName, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(56, 56, 56)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(userNametextfileld, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(passWordtextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(submit, javax.swing.GroupLayout.Alignment.LEADING)))
.addComponent(titleLabel, javax.swing.GroupLayout.Alignment.LEADING))
.addContainerGap(612, Short.MAX_VALUE))
);

layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {passWordtextfield, userNametextfileld});

layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(35, 35, 35)
.addComponent(titleLabel)
.addGap(100, 100, 100)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(userName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(userNametextfileld, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(54, 54, 54)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(passWord)
.addComponent(passWordtextfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(57, 57, 57)
.addComponent(submit)
.addGap(80, 80, 80)
.addComponent(LoginPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);

layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {passWordtextfield, userNametextfileld});

pack();
}// </editor-fold>

private void submitActionPerformed(java.awt.event.ActionEvent evt) {
String UserName = userNametextfileld.getText();
char[] PassWord = passWordtextfield.getPassword();
String passwordstring = new String(PassWord);
if (UserName.equals("Deepthi") && passwordstring.equals("Guduru")) {
SwingPlayForm form = new SwingPlayForm();
form.setVisible(true);
JLabel label = new JLabel("Welcome:"+UserName);

form.getContentPane().add(label);


}//end if
else{
System.out.println("Enter the valid username and password");
JOptionPane.showMessageDialog(this,"Incorrect login or password",
"Error",JOptionPane.ERROR_MESSAGE);
}// end else


}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LoginForm().setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JPanel LoginPanel;
private javax.swing.JLabel passWord;
private javax.swing.JPasswordField passWordtextfield;
private javax.swing.JButton submit;
private javax.swing.JLabel titleLabel;
private javax.swing.JLabel userName;
private javax.swing.JTextField userNametextfileld;
// End of variables declaration

}
***************************************************************************************************************************************************
SwingPlayForm.java


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* SwingPlayForm.java
*
* Created on Sep 25, 2009, 4:15:21 AM
*/

package learn;

import java.awt.Dimension;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import java.awt.*;
import javax.swing.*;
import javax.swing.*;
/**
*
* @author pguduru
*/
public class SwingPlayForm extends javax.swing.JFrame {

/** Creates new form SwingPlayForm */
public SwingPlayForm() {
initComponents();
this.setBounds(50, 50, 800, 470);
this.setResizable(false);
//jTree1.
// try {
// UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusStyle");
// //this.setMinimumSize(new Dimension(400,656));
// } catch (ClassNotFoundException ex) {
// Logger.getLogger(SwingPlayForm.class.getName()).log(Level.SEVERE, null, ex);
// } catch (InstantiationException ex) {
// Logger.getLogger(SwingPlayForm.class.getName()).log(Level.SEVERE, null, ex);
// } catch (IllegalAccessException ex) {
// Logger.getLogger(SwingPlayForm.class.getName()).log(Level.SEVERE, null, ex);
// } catch (UnsupportedLookAndFeelException ex) {
// Logger.getLogger(SwingPlayForm.class.getName()).log(Level.SEVERE, null, ex);
// }

//this.setMinimumSize(new Dimension(400,656));
}

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

jTabbedPane4 = new javax.swing.JTabbedPane();
MainPanel = new javax.swing.JPanel();
jTabbedPane1 = new javax.swing.JTabbedPane();
backupNow = new javax.swing.JPanel();
backupNowpanel = new javax.swing.JPanel();
schedule = new javax.swing.JPanel();
scheduleSplitPane = new javax.swing.JSplitPane();
schedulesplitleftpanel = new javax.swing.JPanel();
ssplitscrollpane = new javax.swing.JScrollPane();
jTree1 = new javax.swing.JTree();
schedulesplitrightpanel = new javax.swing.JPanel();
mondayCheckBox = new javax.swing.JCheckBox();
tuesdayCheckBox = new javax.swing.JCheckBox();
wednesdayCheckBox = new javax.swing.JCheckBox();
thursdayCheckBox = new javax.swing.JCheckBox();
fridayCheckBox = new javax.swing.JCheckBox();
saturdayCheckBox = new javax.swing.JCheckBox();
sundayCheckBox = new javax.swing.JCheckBox();
timeLabel = new javax.swing.JLabel();
timeHour = new javax.swing.JTextField();
timeSemicolon = new javax.swing.JLabel();
timeMinutes = new javax.swing.JTextField();
ampmLabel = new javax.swing.JComboBox();
repeatEvery = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox();
saveSchedule = new javax.swing.JButton();
labelName = new javax.swing.JLabel();
labelnameTextField = new javax.swing.JTextField();
restore = new javax.swing.JPanel();
restorePanel = new javax.swing.JPanel();
history = new javax.swing.JPanel();
historyPanel = new javax.swing.JPanel();
titleLabel = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

javax.swing.GroupLayout MainPanelLayout = new javax.swing.GroupLayout(MainPanel);
MainPanel.setLayout(MainPanelLayout);
MainPanelLayout.setHorizontalGroup(
MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
MainPanelLayout.setVerticalGroup(
MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 247, Short.MAX_VALUE)
);

backupNowpanel.setBackground(new java.awt.Color(102, 153, 255));

javax.swing.GroupLayout backupNowpanelLayout = new javax.swing.GroupLayout(backupNowpanel);
backupNowpanel.setLayout(backupNowpanelLayout);
backupNowpanelLayout.setHorizontalGroup(
backupNowpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 766, Short.MAX_VALUE)
);
backupNowpanelLayout.setVerticalGroup(
backupNowpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 376, Short.MAX_VALUE)
);

javax.swing.GroupLayout backupNowLayout = new javax.swing.GroupLayout(backupNow);
backupNow.setLayout(backupNowLayout);
backupNowLayout.setHorizontalGroup(
backupNowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(backupNowpanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
backupNowLayout.setVerticalGroup(
backupNowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(backupNowpanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);

jTabbedPane1.addTab("BackUp Now", backupNow);

schedule.setBackground(new java.awt.Color(102, 153, 255));

schedulesplitleftpanel.setBackground(new java.awt.Color(102, 153, 255));

jTree1.setToolTipText("Select the Filepath you want to backup");
ssplitscrollpane.setViewportView(jTree1);

javax.swing.GroupLayout schedulesplitleftpanelLayout = new javax.swing.GroupLayout(schedulesplitleftpanel);
schedulesplitleftpanel.setLayout(schedulesplitleftpanelLayout);
schedulesplitleftpanelLayout.setHorizontalGroup(
schedulesplitleftpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ssplitscrollpane, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
);
schedulesplitleftpanelLayout.setVerticalGroup(
schedulesplitleftpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(schedulesplitleftpanelLayout.createSequentialGroup()
.addComponent(ssplitscrollpane, javax.swing.GroupLayout.PREFERRED_SIZE, 374, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);

scheduleSplitPane.setLeftComponent(schedulesplitleftpanel);

schedulesplitrightpanel.setBackground(new java.awt.Color(102, 153, 255));

mondayCheckBox.setBackground(new java.awt.Color(102, 153, 255));
mondayCheckBox.setFont(new java.awt.Font("Tahoma", 1, 11));
mondayCheckBox.setText("Monday");

tuesdayCheckBox.setBackground(new java.awt.Color(102, 153, 255));
tuesdayCheckBox.setFont(new java.awt.Font("Tahoma", 1, 11));
tuesdayCheckBox.setText("Tuesday");

wednesdayCheckBox.setBackground(new java.awt.Color(102, 153, 255));
wednesdayCheckBox.setFont(new java.awt.Font("Tahoma", 1, 11));
wednesdayCheckBox.setText("Wednesday");

thursdayCheckBox.setBackground(new java.awt.Color(102, 153, 255));
thursdayCheckBox.setFont(new java.awt.Font("Tahoma", 1, 11));
thursdayCheckBox.setText("Thursday");

fridayCheckBox.setBackground(new java.awt.Color(102, 153, 255));
fridayCheckBox.setFont(new java.awt.Font("Tahoma", 1, 11));
fridayCheckBox.setText("Friday");

saturdayCheckBox.setBackground(new java.awt.Color(102, 153, 255));
saturdayCheckBox.setFont(new java.awt.Font("Tahoma", 1, 11));
saturdayCheckBox.setText("Saturday");

sundayCheckBox.setBackground(new java.awt.Color(102, 153, 255));
sundayCheckBox.setFont(new java.awt.Font("Tahoma", 1, 11));
sundayCheckBox.setText("Sunday");

timeLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
timeLabel.setText("Time:");

timeHour.setFont(new java.awt.Font("Tahoma", 1, 11));

timeSemicolon.setFont(new java.awt.Font("Tahoma", 1, 11));
timeSemicolon.setText(":");

timeMinutes.setFont(new java.awt.Font("Tahoma", 1, 11));

ampmLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
ampmLabel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "AM", "PM", " " }));
ampmLabel.setSelectedItem("");
ampmLabel.setToolTipText("");

repeatEvery.setFont(new java.awt.Font("Tahoma", 1, 11));
repeatEvery.setText("Repeat Every");

jComboBox1.setFont(new java.awt.Font("Tahoma", 1, 11));
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Week", "Month" }));
jComboBox1.setSelectedItem("");

saveSchedule.setFont(new java.awt.Font("Tahoma", 1, 11));
saveSchedule.setText("Save Schedule");
saveSchedule.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveScheduleActionPerformed(evt);
}
});

labelName.setFont(new java.awt.Font("Tahoma", 1, 11));
labelName.setText("Label");

labelnameTextField.setFont(new java.awt.Font("Tahoma", 1, 11));
labelnameTextField.setToolTipText("Provide LabelName to uniquely identify the schedule");
labelnameTextField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
labelnameTextFieldActionPerformed(evt);
}
});

javax.swing.GroupLayout schedulesplitrightpanelLayout = new javax.swing.GroupLayout(schedulesplitrightpanel);
schedulesplitrightpanel.setLayout(schedulesplitrightpanelLayout);
schedulesplitrightpanelLayout.setHorizontalGroup(
schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(schedulesplitrightpanelLayout.createSequentialGroup()
.addGroup(schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(schedulesplitrightpanelLayout.createSequentialGroup()
.addGap(176, 176, 176)
.addComponent(fridayCheckBox)
.addGap(26, 26, 26)
.addComponent(saturdayCheckBox)
.addGap(18, 18, 18)
.addComponent(sundayCheckBox))
.addGroup(schedulesplitrightpanelLayout.createSequentialGroup()
.addGap(128, 128, 128)
.addGroup(schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(schedulesplitrightpanelLayout.createSequentialGroup()
.addComponent(mondayCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(tuesdayCheckBox)
.addGap(18, 18, 18)
.addComponent(wednesdayCheckBox)
.addGap(18, 18, 18)
.addComponent(thursdayCheckBox))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, schedulesplitrightpanelLayout.createSequentialGroup()
.addGroup(schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(schedulesplitrightpanelLayout.createSequentialGroup()
.addComponent(timeLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
.addComponent(timeHour, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(timeSemicolon))
.addGroup(schedulesplitrightpanelLayout.createSequentialGroup()
.addGroup(schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, schedulesplitrightpanelLayout.createSequentialGroup()
.addComponent(repeatEvery)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))
.addGroup(schedulesplitrightpanelLayout.createSequentialGroup()
.addComponent(labelName)
.addGap(52, 52, 52)))
.addGroup(schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelnameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(18, 18, 18)
.addComponent(timeMinutes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(42, 42, 42)
.addComponent(ampmLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)))
.addGap(67, 67, 67)))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, schedulesplitrightpanelLayout.createSequentialGroup()
.addContainerGap(250, Short.MAX_VALUE)
.addComponent(saveSchedule)
.addGap(224, 224, 224))
);

schedulesplitrightpanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {ampmLabel, jComboBox1, labelnameTextField, timeHour, timeMinutes});

schedulesplitrightpanelLayout.setVerticalGroup(
schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(schedulesplitrightpanelLayout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(mondayCheckBox)
.addComponent(tuesdayCheckBox)
.addComponent(wednesdayCheckBox)
.addComponent(thursdayCheckBox))
.addGap(18, 18, 18)
.addGroup(schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(fridayCheckBox)
.addComponent(saturdayCheckBox)
.addComponent(sundayCheckBox))
.addGap(38, 38, 38)
.addGroup(schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(timeSemicolon)
.addComponent(timeHour, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(timeMinutes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ampmLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(timeLabel))
.addGap(47, 47, 47)
.addGroup(schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(repeatEvery))
.addGap(36, 36, 36)
.addGroup(schedulesplitrightpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelName)
.addComponent(labelnameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(31, 31, 31)
.addComponent(saveSchedule)
.addContainerGap(45, Short.MAX_VALUE))
);

schedulesplitrightpanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {ampmLabel, jComboBox1, labelnameTextField, timeHour, timeMinutes});

scheduleSplitPane.setRightComponent(schedulesplitrightpanel);

javax.swing.GroupLayout scheduleLayout = new javax.swing.GroupLayout(schedule);
schedule.setLayout(scheduleLayout);
scheduleLayout.setHorizontalGroup(
scheduleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scheduleSplitPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 805, Short.MAX_VALUE)
);
scheduleLayout.setVerticalGroup(
scheduleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scheduleSplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
);

jTabbedPane1.addTab("Schedule", schedule);

restorePanel.setBackground(new java.awt.Color(102, 153, 255));

javax.swing.GroupLayout restorePanelLayout = new javax.swing.GroupLayout(restorePanel);
restorePanel.setLayout(restorePanelLayout);
restorePanelLayout.setHorizontalGroup(
restorePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 766, Short.MAX_VALUE)
);
restorePanelLayout.setVerticalGroup(
restorePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 376, Short.MAX_VALUE)
);

javax.swing.GroupLayout restoreLayout = new javax.swing.GroupLayout(restore);
restore.setLayout(restoreLayout);
restoreLayout.setHorizontalGroup(
restoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(restorePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
restoreLayout.setVerticalGroup(
restoreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(restorePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);

jTabbedPane1.addTab("Restore", restore);

historyPanel.setBackground(new java.awt.Color(102, 153, 255));

javax.swing.GroupLayout historyPanelLayout = new javax.swing.GroupLayout(historyPanel);
historyPanel.setLayout(historyPanelLayout);
historyPanelLayout.setHorizontalGroup(
historyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 766, Short.MAX_VALUE)
);
historyPanelLayout.setVerticalGroup(
historyPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 376, Short.MAX_VALUE)
);

javax.swing.GroupLayout historyLayout = new javax.swing.GroupLayout(history);
history.setLayout(historyLayout);
historyLayout.setHorizontalGroup(
historyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(historyPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
historyLayout.setVerticalGroup(
historyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(historyPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);

jTabbedPane1.addTab("History", history);

titleLabel.setFont(new java.awt.Font("Tahoma", 1, 19)); // NOI18N
titleLabel.setForeground(new java.awt.Color(153, 51, 0));
titleLabel.setText("Cloud-based BackUp");

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 771, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1154, 1154, 1154)
.addComponent(MainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(321, 321, 321)
.addComponent(titleLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 279, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(417, 417, 417)
.addComponent(MainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(titleLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 401, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(232, Short.MAX_VALUE))
);

pack();
}// </editor-fold>

private void saveScheduleActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}

private void labelnameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new SwingPlayForm().setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JPanel MainPanel;
private javax.swing.JComboBox ampmLabel;
private javax.swing.JPanel backupNow;
private javax.swing.JPanel backupNowpanel;
private javax.swing.JCheckBox fridayCheckBox;
private javax.swing.JPanel history;
private javax.swing.JPanel historyPanel;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTabbedPane jTabbedPane4;
private javax.swing.JTree jTree1;
private javax.swing.JLabel labelName;
private javax.swing.JTextField labelnameTextField;
private javax.swing.JCheckBox mondayCheckBox;
private javax.swing.JLabel repeatEvery;
private javax.swing.JPanel restore;
private javax.swing.JPanel restorePanel;
private javax.swing.JCheckBox saturdayCheckBox;
private javax.swing.JButton saveSchedule;
private javax.swing.JPanel schedule;
private javax.swing.JSplitPane scheduleSplitPane;
private javax.swing.JPanel schedulesplitleftpanel;
private javax.swing.JPanel schedulesplitrightpanel;
private javax.swing.JScrollPane ssplitscrollpane;
private javax.swing.JCheckBox sundayCheckBox;
private javax.swing.JCheckBox thursdayCheckBox;
private javax.swing.JTextField timeHour;
private javax.swing.JLabel timeLabel;
private javax.swing.JTextField timeMinutes;
private javax.swing.JLabel timeSemicolon;
private javax.swing.JLabel titleLabel;
private javax.swing.JCheckBox tuesdayCheckBox;
private javax.swing.JCheckBox wednesdayCheckBox;
// End of variables declaration

}

**************************************************************************************************************************

whenever user clicks submit button in LoginForm.java, in the other page (i.e; SwingPlayForm.java) it has to show "Welcome " +user ;
and SwingPlayForm.java should be open in same Window. If we run the example, you can see whenever user clicks submit button in LoginForm.java ,SwingPlayForm.java opens in another window


Thanks in Advance,
Anjali.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39393
    
  28
Thank you, but that is too long to go through, and is illegible without the code tags. Please look at this FAQ especially where it tells you about SSCCEs (the link after where it says "short examples"). NetBeans GUI builder code is particularly difficult to read.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42264
    
  64
Showing different screens within the same component at different times can be accomplished by using a CardLayout.


Ping & DNS - my free Android networking tools app
Miklos Szeles
Ranch Hand

Joined: Oct 21, 2008
Posts: 142
Ups, I thought it's a little bit shorter. Please always use code tags.
I'm really tired, so I have no stength to check your code at the moment, but I think you can achieve what you want with CardLayout. You can have one panel with the login and one with the other things. Whenever the user logs in, you simply change the active panel.
Anjali Guduru
Greenhorn

Joined: Sep 22, 2009
Posts: 5
Hello Everyone,
Sorry for sending the whole code, and thanks for answering my question. I'll try to understand the cardlayout.


Thanks,
Anjali.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how will we move from one page to another within the same window in Swing?