Link to home
Start Free TrialLog in
Avatar of ymazal_ca
ymazal_ca

asked on

contentPane.add(FrameSIP, FlowLayout.CENTER); crushes

Hi experts,
The included code shows an error because the contentPane.add(FrameSIP, FlowLayout.CENTER); is not accepted.

Any one knows why ?
public static void main(String[] args) {
		mainWindow tempy = new mainWindow();
		
		tempy.setVisible(true);
		
		Container contentPane = tempy.getContentPane();
		contentPane.setLayout(new FlowLayout());
 
		
		   JInternalFrame FrameSIP = new JInternalFrame();
		   
	        FrameSIP.setVisible(true);
	        
	        //FrameSIP.set
	        contentPane.add(FrameSIP, FlowLayout.CENTER);
	        //tempy.setLayout(new FlowLayout());
	        //FrameSIP.setSize(300, 300); 
 
 
	}

Open in new window

Avatar of dosuka
dosuka
Flag of Indonesia image

To get the Center Flow Layout, construct the layout with center position:
    contentPane.setLayout(new FlowLayout(FlowLayout.CENTER));


then add the frame without position:
    contentPane.add(FrameSIP);
ASKER CERTIFIED SOLUTION
Avatar of ksivananth
ksivananth
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial