Import javax.swing.*; class Check { public static void main(String[] args) { JFrame frame = new JFrame("Check"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//DO_NOTHING_ON_CLOSE.

Slides:



Advertisements
Similar presentations
 Java GUI API  Layout Managers [Sample code] ShowFlowLayout.java 、 ShowGripLayout.java 、 ShowBorderLayout.java TestImageIcon.java.
Advertisements

Computer Science A 14: 31/3. Inheritence You can extend a class or change behaviour. Inheritance is a method to reuse code. Concept. Extending classes.
1 Lecturte 14Lecture 7 Applications of Graphics Overview  Conversions Between Applications and Applets  Handling Mouse Events  Handling Keyboard Events.
2D Graphics in Java COMP53 Nov 14, Applets and Applications Java applications are stand-alone programs – start execution with main() – runs in JVM.
Unit 101 Java GUI Components and Events  GUI Components and Containers  Adding Components to Containers  GUI Events  GUI Events Classes  Learning.
1 GUI 5Lecture 7 GUI - V Overview  Using No Layout Manager  Message Dialog Boxes  Running a Program as an Applet and an Application  More on Handling.
Unit 111 Java GUI Components and Events  Learning Outcomes oDistinguish between GUI components and containers. oIdentify and distinguish top-level containers.
Graphical User Interfaces
Lecture 8. Review (Methods of Math class) int abs( int num ) double sqrt( double num ) double pow( double num, double power ) Method parametersData type.
Java Swing Chris North cs3724: HCI. AWT to Swing AWT: Abstract Windowing Toolkit import java.awt.* Swing: new with Java2 import javax.swing.* Extends.
1 A Quick Java Swing Tutorial. 2 Introduction Swing – A set of GUI classes –Part of the Java's standard library –Much better than the previous library:
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Graphical User Interface (GUI) Design using Swing Course Lecture Slides.
GUI Basics: Introduction. Creating GUI Objects // Create a button with text OK JButton jbtOK = new JButton("OK"); // Create a label with text "Enter your.
19-Sep-15 Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming Design Topic : Applets Maj Joel Young
Intro to Java 2 By Geb Thomas Based on the Java TutorialJava Tutorial.
Lesson 27: Introduction to the Java GUI. // helloworldbutton.java import java.awt.*; import javax.swing.*; class HelloButton{ public static void main.
Applets and Frames CS 21a: Introduction to Computing I First Semester,
Introduction to GUI in Java 1. Graphical User Interface Java is equipped with many powerful,easy to use GUI component such as input and output dialog.
MIT AITI 2003 Lecture 17. Swing - Part II. The Java Event Model Up until now, we have focused on GUI's to present information (with one exception) Up.
Java GUI CSCE 190 – Java Instructor: Joel Gompert Mon, July 26, 2004.
Lab 6: Shapes & Picture Extended Ellipse & Rectangle Classes Stand-Alone GUI Applications.
GUI programming Graphical user interface-based programming.
Quiz 1 What is this? (explain the use of the reserved word “this” in a class method). Answer each question briefly. – What is a Constructor? –Under what.
Java Applets. Topics What is an applet? To convert GUI applications to Applets Hello World applet example!! Applets life cycle examples Invoking applets.
GUI Chapter 10 Graphics context and objects Creating a window based application JFrame, JTextField, JButton Containers and Controls Graphics commands Layout.
Big Java by Cay Horstmann Copyright © 2009 by John Wiley & Sons. All rights reserved. In order to display a drawing in a frame, define a class that extends.
Intro to Applets August 19, 2008 Mrs. C. Furman. Java Applets vs. Java Applications Java Applet: a program that is intended for use on the web. Java Applet:
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
SWING. AbstractButton Swing Buttons are subclasses of the AbstractButton class, which extends JComponent. Abstract class javax.swing.AbstractButton AbstractButton.
More GUI CSCE 190 – Java Instructor: Joel Gompert Lecture 8 – July 28, 2004.
FEN IntroJava2006 AAU1 GUI: Graphical User Interface AWT/SWING: Components Drag and Drop in NetBeans Events Listeners.
1 Graphical User Interfaces AWT and Swing packages Frames and Panels Components Nested Panels Images Reading for this Lecture: L&L, 3.9 – 3.11.
Java's Graphical User Interface Toolkit
Humboldt University Berlin, University of Novi Sad, ‘Polytehnica’ University of Timisoara, University of Plovdiv, University of Belgrade DAAD project “Joint.
Lesson 39: More wrapup on GUIs. 1.This presentation will focus on the decisions around software architecture and the decisions that will drive the code.
Java Applet. Introductions Applet is java program that can be embedded into HTML pages Java applets runs on the java enables web browsers such as mozila.
1 / 67 COP 3503 FALL 2012 SHAYAN JAVED LECTURE 14 Programming Fundamentals using Java 1.
 GUI – Graphic User Interface  Up to now in the programs we have written all output has been sent to the standard output device i.e.: the DOS console.
Creating a GUI with JFC/Swing. What are the JFC and Swing? JFC –Java Foundation Classes –a group of features to help people build graphical user interfaces.
Ch13 Creating windows and applets. Short overview AWT (Abstract Windowing Toolkit) Early Java development used graphic classesEarly Java development used.
CIS Intro to JAVA Lecture Notes Set July-05 GUI Programming – Home and reload buttons for the webbrowser, Applets.
GUI Basics. Agenda What GUI How to make in java Creating frames Frequently used GUI components Layout Managers.
Swing. Introduction to Swing What is Swing? “ Swing is a diverse collection of lightweight components that can be used to build sophisticated user interfaces.”
1 Applets. 2 Design of Applets 3 Sun wrote Java to be executable within a hosting application browser The applications are applets. An applet is downloaded.
CIS Intro to JAVA Lecture Notes Set 8 9-June-05.
Computer Science 209 GUIs Model/View/Controller Layouts.
Chapter 2 Creating a Java Application and Applet.
Graphical User Interfaces A Graphical User Interface (GUI) in Java is created with at least three kinds of objects: –components, events, and listeners.
1 IM103 week 10 Enhancing the user interface By the end of lecture you should be able to:  distinguish between heavyweight and lightweight components;
Swing GUI Components So far, we have written GUI applications which can ‘ draw ’. These applications are simple, yet typical of all Java GUI applications.
Errors, GUIs, and Patterns Dr. Doug Twitchell August 30, 2005.
Computer Science 209 Software Development Packages.
Getting Started with GUI Programming Chapter 10 CSCI 1302.
1 A Quick Java Swing Tutorial. 2 Introduction Swing – A set of GUI classes –Part of the Java's standard library –Much better than the previous library:
CPCS 391 Computer Graphics Lab One. Computer Graphics Using Java What is Computer Graphics: Computer graphics are graphics created using computers and,
Import javax.swing.JOptionPane; public class Rectangle { public static void main(String[] args) { double width, length, area, perimeter; String lengthStr,
Java Applets.
GUIs Model/View/Controller Layouts
Java GUI.
A Quick Java Swing Tutorial
MVC Paradigm The MVC paradigm breaks applications or interfaces into three parts: the model, the view, and the controller. A --> 25 % B --> 60 % C -->
Applets.
Java Applets.
Drawing in Java.
COP 4610L: Applications in the Enterprise Spring 2005
class PrintOnetoTen { public static void main(String args[]) {
Steps to Creating a GUI Interface
A Quick Java Swing Tutorial
Real World Scenario Sometimes it's appropriate to have exactly one instance of a class: window manager print spooler Filesystems press Ctrl-F to display.
Debugging Exercise 00 Try compiling the code samples.
Presentation transcript:

import javax.swing.*; class Check { public static void main(String[] args) { JFrame frame = new JFrame("Check"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//DO_NOTHING_ON_CLOSE frame.setSize(600,500); frame.setVisible(true); }

file: Check.java import javax.swing.*; public class Check extends Japplet {} file: Stam.html An example of an applet:

import javax.swing.*; public class Check extends JApplet { //... public static void main(String[] args) { JApplet applet = new Check(); JFrame frame = new JFrame("Check"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(applet); frame.setSize(50, 70); applet.init(); applet.start(); frame.setVisible(true); }

import javax.swing.*; import java.awt.*; // for FlowLayout class Check { public static void main(String[] args) { JFrame frame = new JFrame("Check"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new FlowLayout()); frame.getContentPane().add(new JButton("One")); frame.getContentPane().add(new JButton("Two")); frame.setSize(600,500); frame.setVisible(true); }