A Java technology GUI can be created using either of the following techniques. • Programmatic construction This technique use code to create the GUI. This technique is used for learning GUI construction. However, it is very laborious to use in production environment. • Construction using a GUI builder tool This technique uses a GUI builder tool to create the GUI. The GUI developer uses a visual approach to drag-and-drop containers and components to a work area. 2. Example of programmatic construction This sections a simple GUI that prints a Hello World. The code shown in below create a container JFrame with a title HelloWorldSwing. It later adds a JLabel with the Accessible Name property set to Hello World.
3. Key Methods Methods for setting up the JFrame and adding JLabel: • setDefaultCloseOperationJFrame.EXIT_ON_CLOSE) –Creates the program to exit when the close button is clicked. There are four possible ways of handling this: a. DO_NOTHING_ON_CLOSE: does nothing when the close operation is initiated. This constant is defined in WindowsConstants. b. Hide_ON_ClOSE: invokes any WindowListener objects and hides the frame. This constant is defined in WindowsConstants. c. DISPOSE_ON_CLOSE: invokes any WindowListener objects and hides and disposes the frame. This constant is defined in WindowsConstants.
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
|