Import Java. AWT. borderlayout; import Java. AWT. color; import Java. AWT. dimension; import Java. AWT. toolkit; import javax. swing. borderfactory; import javax. swing. jframe; import javax. swing. jpanel; import javax. swing. border. border; import javax. swing. border. etchedborder; import javax. swing. border. titledborder; // test class public class exec {public static void main (string [] ARGs) {// create the form variable demowindow DW = new demowindow ("form with title border"); // set the width and height of the form to 1/3 of the screen width and screen height, respectively, in the upper left corner, set toolkit thekit = DW at 1/3 of the screen width and height. gettoolkit (); dimension wndsize = thekit. getscreensize (); DW. setbounds (wndsize. width/3, wndsize. height/3, wndsize. width/3, wndsize. height/3); // click the close button to exit the DW program. setdefaclocloseoperation (jframe. exit_on_close); // set the form to visible DW. setvisible (true) ;}}// interface form class demowindow extends jframe {// Title border panel jpanel JP = new jpanel (); // constructor public demowindow (String title) {super (title); // create a title border titledborder TB = borderfactory. createtitledborder (borderfactory. createlineborder (color. white), "display area"); // sets the title alignment and color TB for the title border. settitlejustification (titledborder. center); TB. settitlecolor (color. yellow); // create a raised border border2 = borderfactory. createetchedborder (etchedborder. raised); // create a composite border. Combine the title border and raised border to border newborder = borderfactory. createcompoundborder (TB, border2); // set the border JP of the Panel. setborder (newborder); // set the background color of the Panel JP. setbackground (color. gray); // display a gray normal panel JP. setlayout (New borderlayout (); JP. add (New jpanel (); // Add border panel add (JP );}}