Download presentation
Presentation is loading. Please wait.
Published byRosamond Dennis Modified over 9 years ago
1
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Graphical User Interface (GUI) Design using Swing Course Lecture Slides 9 June 2010 “pixel, n.: A mischievous, magical spirit associated with screen displays.” --Jeff Meyer
2
Swing A visual guide to swing components: http://download-llnw.oracle.com/javase/tutorial/ui/features/components.html
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); } 4
5
Swing - Hello World Example /*Hello World example - contd.*/ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndDisplayFrame(); } }); } 5
6
Further Examples 6
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 7
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.