Java swing jinternalframe component example

Source: Internet
Author: User
Package interframeee; import javax. Swing. jbutton;
Import javax. Swing. jframe;
Import javax. Swing. jinternalframe;
Import javax. Swing. jtextfield;
Import javax. Swing. swingutilities;
Import javax. Swing. uimanager; import org. Dyno. Visual. Swing. layouts. constraints;
Import org. Dyno. Visual. Swing. layouts. grouplayout;
Import org. Dyno. Visual. Swing. layouts. Leading; // vs4e -- Do not remove this line!
Public class inteframeee extends jframe {Private Static final long serialversionuid = 1l;
Private jinternalframe jinternalframe0;
Private jbutton jbutton0;
Private jtextfield jtextfield0;
Private Static final string preferred_look_and_feel = "javax. Swing. plaf. Metal. metallookandfeel ";
Public inteframeee (){
Initcomponents ();
} Private void initcomponents (){
Setlayout (New grouplayout ());
Add (getjinternalframe0 (), new constraints (new leading (24,234, 10, 10), new leading (12,133, 10, 10 )));
Setsize (320,240 );
} Private jtextfield getjtextfield0 (){
If (jtextfield0 = NULL ){
Jtextfield0 = new jtextfield ();
Jtextfield0.settext ("jtextfield0 ");
}
Return jtextfield0;
} Private jbutton getjbutton0 (){
If (jbutton0 = NULL ){
Jbutton0 = new jbutton ();
Jbutton0.settext ("jbutton0 ");
}
Return jbutton0;
} Private jinternalframe getjinternalframe0 (){
If (jinternalframe0 = NULL ){
Jinternalframe0 = new jinternalframe ();
Jinternalframe0.settitle ("hello ");
Jinternalframe0.setvisible (true );
Jinternalframe0.setlayout (New grouplayout ());
Jinternalframe0.add (getjbutton0 (), new constraints (new leading (129, 10, 10), new leading (30, 10, 10 )));
Jinternalframe0.add (getjtextfield0 (), new constraints (new leading (22, 10, 10), new leading (38, 10, 10 )));
}
Return jinternalframe0;
} Private Static void installlnf (){
Try {
String lnfclassname = preferred_look_and_feel;
If (lnfclassname = NULL)
Lnfclassname = uimanager. getcrossplatformlookandfeelclassname ();
Uimanager. setlookandfeel (lnfclassname );
} Catch (exception e ){
System. Err. println ("cannot install" + preferred_look_and_feel
+ "On this platform:" + E. getmessage ());
}
}/**
* Main Entry of the class.
* Note: This class is only created so that you can easily preview the result at runtime.
* It is not expected to be managed by the designer.
* You can modify it as you like.
*/
Public static void main (string [] ARGs ){
Installlnf ();
Swingutilities. invokelater (New runnable (){
@ Override
Public void run (){
Inteframeee frame = new inteframeee ();
Frame. setdefaclocloseoperation (inteframeee. exit_on_close );
Frame. settitle ("inteframeee ");
Frame. getcontentpane (). setpreferredsize (frame. getsize ());
Frame. Pack ();
Frame. setlocationrelativeto (null );
Frame. setvisible (true );
}
});
}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.