University of Babylon/ College of IT. Dr. Ahmed M. Al-Salih. 2nd class – First .... m3 = new JMenu("Help"); mb.add(m1);// adds objects to JMenuBar mb...
Introduction to GUI development using Qt Paolo Quadrani – [email protected] Andrea Negri – [email protected] SuperComputing Applications and Innovation Department
What is the Syniverse Porting GUI? 3 ... Ported NBR. If submitting a ... 7678 For questions about accessing the Porting GUI contact
In order to run the SAP GUI using Safari for Mac, you will need to disable ‘Safe Mode’ for the Java plugin. 1. Open Firefly in a Safari window
Download Jan 29, 2013 ... Keywords: Quadcopter; GUI; Wireless; Arduino Uno; PID Controller. 1. ... Reference [6] learned GUI control of Quadcopter for test purpose.
SAP Technical Documentation 18.09.2003 SAP GUI Scripting User Guide 620 5 For your convenience the variables application of type GuiApplication, connection of type
.A Melakukan perbaikan dan / atau setting ulang ... perangkat jaringan berbasis luas ... dan/atau setting ulang koneksi jaringan berbasis luas
1 how can technology be used to improve the learner experience at points of transition? review of peer reviewed academic literature, national and international
True Happiness Can Be Yours 5 “You will not surely die,” the serpent said to the woman. “For God knows that when you eat of it your eyes will be opened, and
Can the New World Order be defeated? Yes! Can Americans save this nation and the world? Absolutely! Masters of Seduction shows the way! Condensed from the book
Cassandra A. Soltis,Dying to Be a Supermodel: Can Requiring a Healthy BMI Be Fashionable?, 26J. ... Luisel was a young Uruguayan fashion model who seemed to
by J.O. Kaplan and I.C. Prentice at the Max-Planck Institute. BIOME420 is in a way a ... the Indian Institute for Tropical Meteorology (IITM), which had been obtained from the runs of HadRM3 model adapted for the ..... Ravindranath, N. H., Joshi, N.
Download companies that revaluate their fixed assets for taxation purposes only (which is the case for most small ... GAAP) do not allow upward revaluations while companies reporting under the International Financial Reporting ..... revaluation”,
they can be taught! emotional intelligence skills in at-risk youth (and others) 15th iirp world conference jennifer muret bate community learning center
Download companies that revaluate their fixed assets for taxation purposes only (which is the case for most small ... GAAP) do not allow upward revaluations while companies reporting under the International Financial Reporting ..... revaluation”,
Introduction to Programming Using Java. Version 7.0, August 2014. (Version 7.0. 2, with just a few corrections, December 2016). David J. Eck. Hobart and William Smith Colleges. This is a PDF version of a free, on-line book that is available at http:/
This is a PDF version of a free on-line book that is available at ...... of Java's more advanced capabilities. ∗ ∗ ∗. The Seventh Edition of “Introduction to Programming using Java” is not a huge update from the sixth edition. In fact, my main motiva
518 Measuring Happiness Using Wearable Technology - 98 - The important point is not that successful or healthy people are happy, but that happy people have
This is a PDF version of an on-line book that is available at ... 1.3 The Java Virtual Machine ... 4.6 More on Program Design
Preventing Water Leakage using SYNKOFLEX Preformed Waterstops Page 2 of 8 NUHA Construction Solutions: # 74, 2 nd floor, Nehru Road, Yadava Layout, Arvind Nagar, St
Why Can t a Man Be More Like a Woman? Sex Differences in Big Five Personality Traits Across 55 Cultures David P. Schmitt Bradley University Anu Realo
Horror Movie 101: Failing Can Be Deadly. Welcome! This is copyrighted material for promotional purposes. It's intended to give you a taste of the script to see whether or not you want to use it in your classroom or perform it. You can't print this do
for CSCU. “Often this is because there isn't a full understanding of the benefits of credit cards and how they help create a stronger offering across all products to deepen ... Ed Jesionowski, another CSCU senior portfolio consultant .... on early mo
Agency Theory: Can it be Used to Strengthen IT Governance? Shaun Posthumus and Rossouw von Solms ... Agency Theory: An Assessment and Review
Source: "The Upanishads - A New Translation" by Swami Nikhilananda in four volumes. 3. Invocation . Om. May Brahman protect us both! May Brahman bestow upon
OOP with Java Dr. Ahmed M. Al-Salih
University of Babylon/ College of IT class – First Semester- Department of Software
2nd
GUI
1. GUI Construction 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. import javax.swing.*; public class HeloWorldSwing { private static void createAndShowGUI() { JFrame frame = new JFrame("HelloWorldSwing"); //Set up the window. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Hello World"); // Add Label frame.add(label); frame.setSize(300,200); // Display Window frame.setVisible(true); } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { //Schedule for the event-dispatching thread: //creating,showing this app's GUI. public void run() {createAndShowGUI();} }); } }
The output generated from the program Page 95
OOP with Java Dr. Ahmed M. Al-Salih
University of Babylon/ College of IT class – First Semester- Department of Software
2nd
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. • setVisible(true)– Makes the JFrame visible. • add(Component c)– this method adds the components to the container. To handle these tasks efficiently the Swing framework uses threads that are lightweight process . The tasks described can be handled by these threads separately and concurrently.
Page 96
OOP with Java Dr. Ahmed M. Al-Salih
University of Babylon/ College of IT class – First Semester- Department of Software
2nd
The programmer should utilities these threads. The Swing framework provides a collection of utility methods in the SwingUtilities class. SwingUtilites.invokeLater(new Runnable())
In the java programming language, threads are created using the Runnable interface. This interface defines a method run that should be implemented by all the classes using this interface. The invokeLater method schedule the GUI creations taks to execute the run method a synchronously by the event-handling thread after all the pending events are completed.
4. GUI-Based Applications You now know how to set up a Java GUI for both graphic output and interactive user input. However, only a few of the components from which GUIs can be built have been described. The question here is of How can WE create a menu for your GUI frame? 5. How to Create a Menu 1. Create a JMenuBar object, and set it into a menu container, such as a JFrame . 2. Create one or more JMenu objects, and add them to the menu bar object. 3. Create one or more JMenuItem objects, and add them to the menu object. Creating a JMenuBar f = new JFrame("MenuBar"); mb = new JMenuBar(); f.setJMenuBar(mb);
f = new JFrame("Menu"); mb = new JMenuBar(); Page 97
OOP with Java Dr. Ahmed M. Al-Salih
University of Babylon/ College of IT class – First Semester- Department of Software
2nd
m1 = new JMenu("File"); m2 = new JMenu("Edit"); m3 = new JMenu("Help"); mb.add(m1);// adds objects to JMenuBar mb.add(m2); mb.add(m3); f.setJMenuBar(mb); Creating a JMenu
6. Creating a JMenus Items import javax.swing.*; public class menubar extends JFrame{ public menubar(){ JMenuBar menubar = new JMenuBar(); setJMenuBar(menubar); JMenu shape = new JMenu("File"); menubar.add(shape); JMenuItem rect = new JMenuItem("Rectangle"); shape.add(rect); JMenuItem star = new JMenuItem("Star"); Page 98
OOP with Java Dr. Ahmed M. Al-Salih
University of Babylon/ College of IT class – First Semester- Department of Software
2nd
shape.add(star); JMenu color = new JMenu("Color"); menubar.add(color); JMenuItem black = new JMenuItem("Black"); color.add(black); JMenuItem orange = new JMenuItem("Orange"); color.add(orange); } public static void main(String[] args) { menubar gui = new menubar(); gui.setTitle("Menu Bar"); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setSize(500,300); gui.setVisible(true); gui.setLocationRelativeTo(null); } }