GUI, to carry the main page background property and also how to get transaction from one page to another back to main page from any page
<p>I'm working on ma academic mini project, and I'm trying to do an GUI to login and signup every thing is working fine, but in GUI I have a problem, where the login screen get background and also has the colour which is defined in an class called login_class, but on clicking sign up button in the login_class the control goes to signup_class where the login_class is  to not visible. but when i control goes to signup_class the background colour is not getting applied . so how can i achieve this, this is just ma starting of the project still i need to create lot of classes dor display where i need to create lot of pages and i need to go to next page and come back . please let me know *<em>how can i carry the propeties of the current page to the next page . and if i'm tryin to go to multiple pages how can i come back to the home page on clicking home , and from transaction from one page to another it should be possible to go back to its previous page and also on clickin home to its home page  *</em><br>
below i have mentioned ma initial code i.e, login_class and signup_class</p>

<p>please help me out , waiting for the solution.</p>

<pre><code>import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.sql.*;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;



public class login_class extends JFrame {
public  login_class(){
    initcomponent();

}
private void initcomponent(){
    try{
        int red=225;
        int green=222;
        int blue=122;
        File f1=new File(".");
        String filepath =f1.getCanonicalPath();
        System.out.println(filepath);
        String fullpaththeme=filepath+"\\theme.accdb";
        String imgname="\\simple.jpg";
        String imgpath=filepath+imgname;
        System.out.println(imgpath);
        String themepath=filepath+"\\theme1.jpg";
        String newimgpath=imgpath;


            Statement st=cone.doconnect(fullpaththeme);
            st.executeUpdate("UPDATE usetheme SET path='"+imgpath+"' WHERE type='default'");
            ResultSet res =st.executeQuery("select * from usetheme where set=1");
            while(res.next()){
                System.out.println(res.getString("type"));

                /*for dis u need to add column red, green blue in usetheme table 
                 * System.out.println(res.getString("red"));
                System.out.println(res.getString("green"));
                System.out.println(res.getString("blue"));
                System.out.println(res.getString("path"));
                String r1=res.getString("red")

                red=Integer.parseInt(res.getString("red"));
                green=Integer.parseInt(res.getString("green"));
                blue=Integer.parseInt(res.getString("blue"));*/
                newimgpath=res.getString("path");

            }
            final JFrame f=new JFrame(); 
            final Container login_container;
            login_container=getContentPane();
            login_container.setLayout(null);
            login_container.setBackground(new Color(red,green,blue));

            JLabel Labelimg_theme=new JLabel();
            ImageIcon themeimg=new ImageIcon(themepath);
            Labelimg_theme.setIcon(themeimg);
            Labelimg_theme.setBounds(1,1,1365,185);
            login_container.add(Labelimg_theme);


            JLabel choose_img=new JLabel();
            ImageIcon themeimg2=new ImageIcon(newimgpath);
            choose_img.setIcon(themeimg2);
            choose_img.setBounds(600,188,755,456);
            login_container.add(choose_img);

            final JLabel headingLabel=new JLabel("Username :");
            headingLabel.setBounds(50,200,125,25);
            headingLabel.setFont(new Font("alpha",Font.BOLD,20));
            login_container.add(headingLabel);


            final JTextField username=new JTextField();
            login_container.add(username);
            username.setBounds(162,200,125,25);

            JLabel headingLabe2=new JLabel("Password :");
            headingLabe2.setBounds(50,235,125,25);
            headingLabe2.setFont(new Font("alpha",Font.BOLD,20));
            login_container.add(headingLabe2);


            final JPasswordField password=new JPasswordField();
            login_container.add(password);
            password.setBounds(162,235,125,25);

            JButton login=new JButton("Login");
            login.setBounds(50,266,100,25);
            login_container.add(login);


            login.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent ev){
                    String login_user;
                    String login_password;
                    login_user=username.getText();
                    System.out.println(login_user);

                    login_password=password.getText();
                    System.out.println(login_password);
                    try{

                        File f2=new File(".");
                    String filepath =f2.getCanonicalPath();
                    String loginpath=filepath+"\\logininfo.accdb";
                    Statement st=cone.doconnect(loginpath);
                    ResultSet res=st.executeQuery("select *from login where username='"+login_user+"'and password='"+login_password+"'");
                    if(res.next()){
                        System.out.println(res.getString("username"));
                        System.out.println(res.getString("password"));
                    }
                    else
                    {
                        JOptionPane.showMessageDialog(null,"Enter a valid Username and Password","Error",1);                        }
                    }
                    catch(Exception e){
                        e.printStackTrace();
                    }


                }
            });             

            final JButton exit1=new JButton("Exit");
            exit1.setBounds(162,266,100,25);
            login_container.add(exit1);

            exit1.addActionListener(new ActionListener(){

                public void actionPerformed(ActionEvent ev) {

                    System.exit(1);
                }
            });

            JButton newuser=new JButton("Sign Up");
            newuser.setBounds(100,650,100,40);
            login_container.add(newuser);

            newuser.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent ev){

                    login_container.setVisible(false);
                    new signup_class(login_container);                                          
                }
            });

            JButton select_img=new JButton("Select Image");
            select_img.setBounds(600,650,300,40);
            login_container.add(select_img);

            JLabel developedby=new JLabel("developed by");
            developedby.setBounds(1235,645,100,25);
            developedby.setFont(new Font("alpha",Font.BOLD,10));
            login_container.add(developedby);

            JLabel developer=new JLabel("PRAVEEN.J.U");
            developer.setBounds(1230,660,100,25);
            developer.setFont(new Font("alpha",Font.CENTER_BASELINE,13));
            login_container.add(developer);

            JLabel developer_Email=new JLabel("( praveenjinde2@gmail.com )");
            developer_Email.setBounds(1194,672,160,25);
            developer_Email.setFont(new Font("alpha",Font.CENTER_BASELINE,11));
            login_container.add(developer_Email);



    }
    catch(Exception e){
        e.printStackTrace();
    }
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String ar[]){
login_class obj1=new login_class();
obj1.setVisible(true);
obj1.setTitle("miniProject");
obj1.setSize(1365,740);
obj1.show();
obj1.setResizable(false);


}
}
</code></pre>

<p>and the below given class is signup_class </p>

<pre><code>public class signup_class extends JFrame{
    public signup_class(Container login_container){
        initialize_content(login_container);
    }
    private void initialize_content(final Container login_container)
    {
        final int red=225;
        final int green=222;
        final int blue=122;
    login_container.setVisible(false);

        try{
            File f1=new File(".");
            String filepath;

        filepath = f1.getCanonicalPath();
            System.out.println(filepath);
            String fullpaththeme=filepath+"\\theme.accdb";
            String imgname="\\simple.jpg";
            String imgpath=filepath+imgname;
            System.out.println(imgpath);
            String themepath=filepath+"\\theme1.jpg";
            String newimgpath=imgpath;


        Statement st=cone.doconnect(fullpaththeme);
        ResultSet res =st.executeQuery("select * from usetheme where set=1");
        while(res.next()){
        System.out.println(res.getString("type"));
        newimgpath=res.getString("path");
    }

        final Container signup_container;
        signup_container=login_container.getParent();
        signup_container.setBackground(login_container.getForeground());
        signup_container.setLayout(null);
        signup_container.setBackground(new Color(red,green,blue));
        signup_container.setSize(login_container.getSize());    



        JLabel Labelimg_theme=new JLabel();
        ImageIcon themeimg=new ImageIcon(themepath);
        Labelimg_theme.setIcon(themeimg);
        Labelimg_theme.setBounds(1,1,1365,185);
        signup_container.add(Labelimg_theme);



        JLabel choose_img=new JLabel();
        ImageIcon themeimg2=new ImageIcon(newimgpath);
        choose_img.setIcon(themeimg2);
        choose_img.setBounds(600,188,755,456);
        signup_container.add(choose_img);

        final JLabel admin=new JLabel("ADMINISTRATOR NAME :");
        admin.setBounds(85,188,150,30);
        signup_container.add(admin);

        final JTextField admn_name=new JTextField();
        admn_name.setBounds(230,188,150,30);
        signup_container.add(admn_name);

        final JLabel pass=new JLabel("ADMINISTRATOR PASSWORD :");
        pass.setBounds(50,230,200,30);
        signup_container.add(pass);

        final JTextField admn_password=new JTextField();
        admn_password.setBounds(230,230,150,30);
        signup_container.add(admn_password);

        final JButton submit=new JButton("Submit");
        submit.setBounds(70, 270, 150, 30);
        signup_container.add(submit);



        final JButton back=new JButton("Back");
        back.setBounds(230, 270, 150, 30);
        signup_container.add(back);


        back.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent ev){
        admin.setVisible(false);
        back.setVisible(false);
        submit.setVisible(false);
        admn_name.setVisible(false);
        admn_password.setVisible(false);
        pass.setVisible(false);
        admin.setVisible(false);
        login_container.setVisible(true);
    }
});
  }
   catch(Exception e1){
        e1.printStackTrace();
    } 
   }
   }
</code></pre>
