Computer Notes, Programming codes, Hardware and Networking Tip, Entertainment, Biography, Internet Tip, Tech News, Latest Technology, YouTube,

Java Swing | Internal Frames |

Java Internal Frame, Internal Frame in Java, Java Internal Frame code, Java Tutorial, Java Programming, Java swing program, how to make internal frame in java swing,

  • A JInternalFrame is a container that looks much like a JFrame. The key difference is that internal frames can only exist within some other Java container.
  • Thus, we must add an internal frame to a container (usually a JDesktopPane). The following list summarizes the rules for using internal frames.
  • –Set size of internal frames
    –Set location
    –Add internal frames into DesktopPane
    –Call setVisible method
  • We can create internal frames by using any one of following constructors.
  • –JInternalFrame()
    –JInternalFrame(String title, boolean resizable, boolean closeable, boolean maximizable,  boolean iconifiable)
    Example: 
 
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class IFDemo extends JFrame
{
	JDesktopPane dp;
	JInternalFrame iframe;
	JTextField tb;
	JLabel lb;
	IFDemo()
	{
		setSize(400,300);		
		setDefaultLookAndFeelDecorated(true);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setVisible(true);
		dp=new JDesktopPane();
		iframe=new JInternalFrame("Internal Frame",true,true,true,true);
		iframe.setSize(200,200);
		iframe.setLocation(50,50);
		dp.add(iframe);
		add(dp);
		lb=new JLabel("Email");
		tb=new JTextField(10);
		iframe.setLayout(new FlowLayout(FlowLayout.CENTER));
		iframe.add(lb);
		iframe.add(tb);
		iframe.setVisible(true);		
	}	
	public static void main(String args[]) 
	{
		IFDemo frame=new IFDemo();		
	}
}

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget