Java swing jinternalframe component example
Last Update:2018-12-03
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 );
}
});
}}