1 / 7

CIS3023: Programming Fundamentals for CIS Majors II Summer 2010

CIS3023: Programming Fundamentals for CIS Majors II Summer 2010. Graphical User Interface (GUI) Design using Swing. “pixel, n.: A mischievous, magical spirit associated with screen displays.”

catori
Download Presentation

CIS3023: Programming Fundamentals for CIS Majors II Summer 2010

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Graphical User Interface (GUI) Design using Swing “pixel, n.: A mischievous, magical spirit associated with screen displays.” --Jeff Meyer Course Lecture Slides9 June 2010 GaneshViswanathan

  2. Swing • A visual guide to swing components:

  3. Some Swing Classes

  4. Swing - Hello World Example • /*Hello World example*/ • import javax.swing.*; • public class Swing1 { • private static void createAndDisplayFrame() { • //Create and set up the frame. • JFrame frame = new JFrame("Swing Example 1"); • frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); • //Add label "Hello World" • JLabel label = new JLabel("Hello World!"); • frame.getContentPane().add(label); • //Display the frame. • frame.pack(); • frame.setVisible(true); • }

  5. Swing - Hello World Example • /*Hello World example - contd.*/ • public static void main(String[] args) { • SwingUtilities.invokeLater(new Runnable() { • public void run() { • createAndDisplayFrame(); • } • }); • } • }

  6. Further Examples

  7. Get more info! • Oracle’s Swing Tutorial: • http://download-llnw.oracle.com/javase/tutorial/uiswing/index.html • Walter Milner’s Java Swing tutorial : • http://www.waltermilner.com/downloads/JavaSwing/ • Java docs: Swing Class Hierarchy • http://download-llnw.oracle.com/javase/1.5.0/docs/api/javax/swing/package-tree.html

More Related