Now I will setup two objects in java swing frame work.
One object named “PanelUser”, and one more object named “FrameRegister”.


class PanelUser extends JPanel{

public JPanel getPanelUser(){

return this;


public void setPanelUser(JPanel passedPanel){

this = passedPanel



So now I want to access to PanelUser to get JPanel to user in my FrameRegister.


class FrameRegister extends JFrame{

PanelUser panelUser = new PanelUser();

public  FrameRegister(){

JPanel panel = panelUser.getPanelUser();



public static void main(String arg){

new FrameRegister().show();