Paveikslėliai. Lekt. dr. Pijus Kasparaitis m. m. pavasario semestras.

Size: px
Start display at page:

Download "Paveikslėliai. Lekt. dr. Pijus Kasparaitis m. m. pavasario semestras."

Transcription

1 Paveikslėliai Lekt. dr. Pijus Kasparaitis m. m. pavasario semestras

2 Klasė Image Priklauso paketui java.awt Abstrakti klasė paveldėta iš Object Tai visų grafinių paveikslėlių superklasė Paveikslėliai yra priklausomi nuo platformos Java naudojami tik gif, jpeg ir png formato paveikslėlių failai P.Kasparaitis. Objektinis programavimas. Paveikslėliai 2

3 Paveikslėlių nuskaitymas java.awt.toolkit.getdefaulttoolkit(). getimage(failovardas arba URL) java.awt.applet. getimage(url) URL pavyzdys: new URL(" P.Kasparaitis. Objektinis programavimas. Paveikslėliai 3

4 Paveikslėlių piešimas Perrašyti klasės java.awt.component metodą paint public void paint(graphics g) {g.drawimage(image,x,y,this);} P.Kasparaitis. Objektinis programavimas. Paveikslėliai 4

5 Paveikslėlio nuskaitymo ir piešimo pavyzdys 1 import javax.swing.*; 2 import java.awt.*; 3 public class Paveikslas4 extends JFrame { 4 Image image; 5 public Paveikslas4() { 6 image = Toolkit.getDefaultToolkit().getImage("Sunset.jpg"); 7 } 8 public void paint(graphics g) { 9 g.drawimage(image,0,0,this); 10 } 11 public static void main(string[] args) { 12 Paveikslas4 frame = new Paveikslas4(); 13 frame.setdefaultcloseoperation(jframe.exit_on_close); 14 frame.setvisible(true); 15 frame.setsize(800,600); 16 } 17} P.Kasparaitis. Objektinis programavimas. Paveikslėliai 5

6 Klasė ImageIcon Priklauso paketui javax.swing Paveldėta iš Object Realizuoja interfeisą Icon Skirta iš paveikslėlių (Image) kurti piktogramas (Icon) ir talpinti jas ant komponentų Paveikslėliai sukuriami iš URL, failo arba baitų masyvo (nuskaityto gif ar jpeg failo) P.Kasparaitis. Objektinis programavimas. Paveikslėliai 6

7 Piktogramų sukūrimas Piktograma sukuriama paveikslėlio failą paduodant konstruktoriui javax.swing.imageicon(failovardas arba URL) P.Kasparaitis. Objektinis programavimas. Paveikslėliai 7

8 Piktogramų vaizdavimas Uždėti piktogramą ant JLabel Koonstruktoriuje JLabel(Icon) Metode JLabel.setIcon(Icon) Dėti piktogramą ant iš klasės AbstractButton paveldėtos klasės naudojant metodą seticon(icon) P.Kasparaitis. Objektinis programavimas. Paveikslėliai 8

9 Piktogramos sukūrimo ir vaizdavimo pavyzdys 1 import javax.swing.*; 2 public class Paveikslas1 extends JFrame { 3 public Paveikslas1() { 4 ImageIcon imicon = new ImageIcon("Sunset.jpg"); 5 JLabel label1 = new JLabel(imicon); 6 getcontentpane().add(label1); 7 } 8 public static void main(string[] args) { 9 Paveikslas1 frame = new Paveikslas1(); 10 frame.setdefaultcloseoperation(jframe.exit_on_close); 11 frame.setvisible(true); 12 frame.setsize(800,600); 13 } 14} P.Kasparaitis. Objektinis programavimas. Paveikslėliai 9

10 Paveikslėlio paėmimas iš piktogramos ir įdėjimas į piktogramą 1 import java.awt.*; 2 import javax.swing.*; 3 public class Paveikslas1a extends JFrame { 4 public Paveikslas1a() { 5 ImageIcon imicon = new ImageIcon("Sunset.jpg"); 6 Image im = imicon.getimage(); // apdoroti paveikslėlį 7 Icon icon = new ImageIcon(im); 8 JLabel label1 = new JLabel(icon); 9 getcontentpane().add(label1); 10 } 11 public static void main(string[] args) { } 13} P.Kasparaitis. Objektinis programavimas. Paveikslėliai 10

11 Klasė PixelGraber Priklauso paketui java.awt.image Paveldėta iš Object Realizuoja interfeisą ImageConsumer Skirta paimti iš paveikslėlio pikselius Susiejama su Image ar ImageProducer klasių objektais P.Kasparaitis. Objektinis programavimas. Paveikslėliai 11

12 Klasė PixelGraber Konstruktorius PixelGrabber(img, x, y, w, h, pixels, 0, w); Metodas grabpixels() throws InterruptedException grąžina true, jei pikseliai sėkmingai paimti Galima naudoti ir konstruktorių PixelGrabber(img, x, y, w, h, true); tada reikia metodu getpixels() pasiimti pikselius (grąžina Object) Jei w<0 ir h<0, imamas visas paveikslėlis pg.getwidth() ir pg.getheight() sužinoti paveikslėlio aukštį ir plotį P.Kasparaitis. Objektinis programavimas. Paveikslėliai 12

13 Pikselių paėmimo pavyzdys 1 Image image =Toolkit.getDefaultToolkit().getImage("Sunset.jpg"); 2 int[] pixels = new int[800 * 600]; 3 PixelGrabber pg = new PixelGrabber(image, 0, 0, 800, 600, pixels, 0, 800); 4 try { 5 pg.grabpixels(); 6 } 7 catch (InterruptedException e1) {... 8 } // atlikti skaičiavimus su pikselių masyvu pixels P.Kasparaitis. Objektinis programavimas. Paveikslėliai 13

14 Klasė MemoryImageSource Priklauso paketui java.awt.image Paveldėta iš Object Realizuoja interfeisą ImageProducer Iš pikselių masyvo sukuria paveikslėlį int pix[] = new int[w * h]; Image img = createimage(new MemoryImageSource(w, h, pix, 0, w)); //čia createimage java.awt.component metodas P.Kasparaitis. Objektinis programavimas. Paveikslėliai 14

15 Paveikslėlio sukūrimo pavyzdys 1 int w = 255; 2 int h = 255; 3 int pix[] = new int[w * h]; 4int index = 0; 5 for (int y = 0; y < h; y++) { 6 int red = (y * 255) / (h - 1); 7 for (int x = 0; x < w; x++) { 8 int blue = (x * 255) / (w - 1); 9 pix[index++] = (255 << 24) (red << 16) blue; 10 } 11 } 12 Image img = createimage(new MemoryImageSource(w, h, pix, 0, w)); P.Kasparaitis. Objektinis programavimas. Paveikslėliai 15

16 Sukurtas paveikslėlis P.Kasparaitis. Objektinis programavimas. Paveikslėliai 16

17 Klasė Color Konstruktoriai Color(int rgb) Color(int rgba, boolean hasalpha) Color(int r, int g, int b) Color(int r, int g, int b, int a) Metodai int getred() int getgreen() int getblue() int getalpha() P.Kasparaitis. Objektinis programavimas. Paveikslėliai 17

18 Spalvų naudojimas Alpha nusako spalvos permatomumą Color objektų kūrimas užima laiko, todėl jie paprastai nenaudojami, o pikseliai koduojami sveikais skaičiais Prieš atliekant veiksmus su pikseliais juos reikia išskaidyti į spalvų komponentes Paprastai veiksmai su pačiomis pikselių reikšmėmis (neišskaidytomis) yra beprasmiai P.Kasparaitis. Objektinis programavimas. Paveikslėliai 18

19 Pikselių išskaidymas ir jungimas Išskaidymas int alpha = (pixel >> 24) & 0xff; int red = (pixel >> 16) & 0xff; int green = (pixel >> 8) & 0xff; int blue = (pixel ) & 0xff; Jungimas int rgb = (alpha << 24) (red << 16) (green << 8) blue; P.Kasparaitis. Objektinis programavimas. Paveikslėliai 19

20 Paveikslėlio apdorojimo pavyzdys 1 public class Paveikslas2 extends JFrame { 2 public Paveikslas2() { 3 Image image = Toolkit.getDefaultToolkit().getImage("Sunset.jpg"); 4 PixelGrabber pg = new PixelGrabber(image, 0, 0, -1, -1, true); 5 try { pg.grabpixels(); } 6 catch (InterruptedException e1) 7 {e1.printstacktrace();} 8 int w = pg.getwidth(); 9 int h = pg.getheight(); 10 int[] data = (int[]) pg.getpixels(); //duomenų apdorojimo vieta 11 for(int i=0; i<h; i++) data[w*i+i]=data[w*i+i] & 0xff000000; 12 image = createimage(new MemoryImageSource(w, h, data, 0, w); 13 ImageIcon imicon = new ImageIcon(image); 14 JLabel label1 = new JLabel(imicon); 15 getcontentpane().add(label1); 16 } P.Kasparaitis. Objektinis programavimas. Paveikslėliai 20

21 ImageProducer/Consumer interfeisai Interfeisas ImageProducer. Realizuoja: MemoryImageSource FilteredImageSource Interfeisas ImageConsumer. Realizuoja: PixelGrabber ImageFilter ir iš jo paveldėti: AreaAveragingScaleFilter CropImageFilter RGBImageFilter P.Kasparaitis. Objektinis programavimas. Paveikslėliai 21

22 Filtrų panaudojimas 1 public class Paveikslas3 extends JFrame { 2 public Paveikslas3() { 3 Image image = Toolkit.getDefaultToolkit().getImage("Sunset.jpg"); 4 ImageFilter filter1 = new AreaAveragingScaleFilter(20, 200); 5 ImageFilter filter2 = new ReplicateScaleFilter(300, 50); 6 ImageProducer prod1 = image.getsource(); 7 ImageProducer prod2 = new FilteredImageSource(prod1, filter1); 8 ImageProducer prod3 = new FilteredImageSource(prod2, filter2); 9 Image resultimage = createimage(prod3); 10 ImageIcon imicon = new ImageIcon(resultImage); 11 JLabel label1 = new JLabel(imicon); 12 getcontentpane().add(label1); 13 } P.Kasparaitis. Objektinis programavimas. Paveikslėliai 22

23 Elementarus filtras 1 class EiluteFilter extends ImageFilter { 2 public void setpixels( int x, int y, int w, int h, ColorModel cm, int[] pixels, int offset, int scansize) { 3 pixels[10]=pixels[10] & 0xff000000; 4 consumer.setpixels(x, y, w, h, cm, pixels, offset, scansize); 5 } 6 } //metodas setpixels kviečiamas tik po vieną eilutę, t. y. h=1 //piešia vertikalią juodą liniją ties 10-tu pikseliu P.Kasparaitis. Objektinis programavimas. Paveikslėliai 23

Apletai (įskiepiai) Lekt. dr. Pijus Kasparaitis m. m. pavasario semestras.

Apletai (įskiepiai) Lekt. dr. Pijus Kasparaitis m. m. pavasario semestras. Apletai (įskiepiai) Lekt. dr. Pijus Kasparaitis pkasparaitis@yahoo.com 2008-2009 m. m. pavasario semestras Java grafinės bibliotekos AWT (Abstract Window Toolkit) Swing 2009.04.09 P.Kasparaitis. Objektinis

More information

Rendering with Java. Jim Graham Staff Engineer JavaSoft

Rendering with Java. Jim Graham Staff Engineer JavaSoft Rendering with Java Jim Graham Staff Engineer JavaSoft Overview AWT paint/update callback model Graphics rendering Image rendering and manipulation Basic image fetching and drawing Off-screen images for

More information

Graphics -- To be discussed

Graphics -- To be discussed Graphics -- To be discussed 1 Canvas Class... 1 2 Graphics Class... 1 3 Painting... 1 4 Color Models... 4 5 Animation's Worst Enemy: Flicker... 4 6 Working with Java Images... 5 6.1 Image Loading Chain

More information

Polimorfizmas. Lekt. dr. Pijus Kasparaitis m. m. pavasario semestras.

Polimorfizmas. Lekt. dr. Pijus Kasparaitis m. m. pavasario semestras. Polimorfizmas Lekt. dr. Pijus Kasparaitis pkasparaitis@yahoo.com 2009-2010 m. m. pavasario semestras Dar apie paveldėjimą Java kalboje kiekvienas paveldėtos klasės objektas gali būti naudojamas ten, kur

More information

Išdėstymai. Lekt. dr. Pijus Kasparaitis m. m. pavasario semestras.

Išdėstymai. Lekt. dr. Pijus Kasparaitis m. m. pavasario semestras. Išdėstymai Lekt. dr. Pijus Kasparaitis pkasparaitis@yahoo.com 2008-2009 m. m. pavasario semestras Išdėstymo valdymas Java kalboje komponentų išdėstymą valdo programos kodas, o ne resursai (kaip kitose

More information

JAVA pagrindai Lek. Liudas Drejeris

JAVA pagrindai Lek. Liudas Drejeris JAVA pagrindai Lek. Liudas Drejeris Programa (1) Programa, tai eilė instrukcijų (vadinamų programiniais sakiniais), kurie vykdomi paeiliui, kol gaunamas norimas rezultatas. Programa (2) Programa (2) /*

More information

C++ programavimo kalba. Konstruktorius, destruktorius, klasių metodų modifikatoriai, objektų masyvai (4 paskaita)

C++ programavimo kalba. Konstruktorius, destruktorius, klasių metodų modifikatoriai, objektų masyvai (4 paskaita) C++ programavimo kalba Konstruktorius, destruktorius, klasių metodų modifikatoriai, objektų masyvai (4 paskaita) Konstruktorius Sukuriant objektą, jo duomenims paprastai turi būti priskiriamos pradinės

More information

AWT COLOR CLASS. Introduction. Class declaration. Field

AWT COLOR CLASS. Introduction. Class declaration. Field http://www.tutorialspoint.com/awt/awt_color.htm AWT COLOR CLASS Copyright tutorialspoint.com Introduction The Color class states colors in the default srgb color space or colors in arbitrary color spaces

More information

Image Size vs. File Size. gif File Compression. 1 Review. Slides05 - Pixels.key - September 28, 2015

Image Size vs. File Size. gif File Compression. 1 Review. Slides05 - Pixels.key - September 28, 2015 1 Review What is a pixel? What is RGB? Image Size vs. File Size 857 2 1280 The Picture use 857 * 1280 * 3 bytes 3.3 MB (MB = megabytes = millions of bytes) of memory The jpeg file uses 201 KB (KB = kilobytes

More information

H212 Introduction to Software Systems Honors

H212 Introduction to Software Systems Honors Introduction to Software Systems Honors Lecture #19: November 4, 2015 1/14 Third Exam The third, Checkpoint Exam, will be on: Wednesday, November 11, 2:30 to 3:45 pm You will have 3 questions, out of 9,

More information

Dr. Hikmat A. M. AbdelJaber

Dr. Hikmat A. M. AbdelJaber Dr. Hikmat A. M. AbdelJaber Portion of the Java class hierarchy that include basic graphics classes and Java 2D API classes and interfaces. java.lang.object Java.awt.Color Java.awt.Component Java.awt.Container

More information

Elektroninis.lt šakninių sertifikatų diegimas

Elektroninis.lt šakninių sertifikatų diegimas Elektroninis.lt šakninių sertifikatų diegimas Ši instrukcija aprašo, kaip į kompiuterį įdiegti šakninius elektroninis.lt sertifikatus. Diegimo darbus galima atlikti turint kompiuterio administratoriaus

More information

The JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class

The JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class CHAPTER GRAPHICAL USER INTERFACES 10 Slides by Donald W. Smith TechNeTrain.com Final Draft 10/30/11 10.1 Frame Windows Java provides classes to create graphical applications that can run on any major graphical

More information

Image Java Foundation Classes (JFC) java.awt.image JFC. Image. Image. Image PNG GIF JPEG

Image Java Foundation Classes (JFC) java.awt.image JFC. Image. Image. Image PNG GIF JPEG 11 2013 6 25 11.1.............................. 11 1 11.2.............................. 11 2 11.3................................... 11 5 11.4.............................. 11 6 11.5.......................................

More information

CS 209 Programming in Java #13 Multimedia

CS 209 Programming in Java #13 Multimedia CS 209 Programming in Java #13 Multimedia Part of Textbook Chapter 14 Spring, 2006 Instructor: J.G. Neal 1 Topics Multimedia Displaying Images Using the MediaTracker class Images in Applets and Applications

More information

// autor igre Ivan Programerska sekcija package mine;

// autor igre Ivan Programerska sekcija package mine; // autor igre Ivan Bauk @ Programerska sekcija package mine; import java.awt.color; import java.awt.flowlayout; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener;

More information

The AWT Package, Graphics- Introduction to Images

The AWT Package, Graphics- Introduction to Images Richard G Baldwin (512) 223-4758, baldwin@austin.cc.tx.us, http://www2.austin.cc.tx.us/baldwin/ The AWT Package, Graphics- Introduction to Images Java Programming, Lecture Notes # 170, Revised 09/23/98.

More information

2017 m. pagrindinės sesijos informacinių technologijų valstybinio brandos egzamino programavimo užduoties galimi sprendimai

2017 m. pagrindinės sesijos informacinių technologijų valstybinio brandos egzamino programavimo užduoties galimi sprendimai Pavyzdys A 2017 m. pagrindinės sesijos informacinių technologijų valstybinio brandos egzamino programavimo užduoties galimi sprendimai int konvertuojamas(int skaic, int id); char konvertuojamas2(int dal);

More information

Final Examination Semester 2 / Year 2010

Final Examination Semester 2 / Year 2010 Southern College Kolej Selatan 南方学院 Final Examination Semester 2 / Year 2010 COURSE : JAVA PROGRAMMING COURSE CODE : PROG1114 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM PEI GEOK Student

More information

2018/2/5 话费券企业客户接入文档 语雀

2018/2/5 话费券企业客户接入文档 语雀 1 2 2 1 2 1 1 138999999999 2 1 2 https:lark.alipay.com/kaidi.hwf/hsz6gg/ppesyh#2.4-%e4%bc%81%e4%b8%9a%e5%ae%a2%e6%88%b7%e6%8e%a5%e6%94%b6%e5%85%85%e5 1/8 2 1 3 static IAcsClient client = null; public static

More information

Final Examination Semester 2 / Year 2012

Final Examination Semester 2 / Year 2012 Final Examination Semester 2 / Year 2012 COURSE : JAVA PROGRAMMING COURSE CODE : PROG1114 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM PEI GEOK Student s ID : Batch No. : Notes to candidates:

More information

CS 335 Graphics and Multimedia. Image Manipulation

CS 335 Graphics and Multimedia. Image Manipulation CS 335 Graphics and Multimedia Image Manipulation Image Manipulation Independent pixels: image subtraction image averaging grey level mapping thresholding Neighborhoods of pixels: filtering, convolution,

More information

Masyvai Javoje. Masyvai. Objektų talpyklos. Masyvo tipas. Deklaravimo pavyzdžiai. Deklaracija ir sukūrimas. Masyvo superklas - Object

Masyvai Javoje. Masyvai. Objektų talpyklos. Masyvo tipas. Deklaravimo pavyzdžiai. Deklaracija ir sukūrimas. Masyvo superklas - Object Masyvai Javoje Masyvai. Objektų talpyklos (Arrays, collections) Dinamiškai sukuriami java objektai iš anksto apibr žtam komponenčių skaičiui saugoti. Komponent s g.b. primityvaus tipo arba nuorodos tipo

More information

Projektas. .h failai Header failai (interface) .m failai Pačios programos failai ( .xib /.storyboard Vartotojo sąsajos failai

Projektas. .h failai Header failai (interface) .m failai Pačios programos failai ( .xib /.storyboard Vartotojo sąsajos failai ios Projektas.h failai Header failai (interface).m failai Pačios programos failai (.xib /.storyboard Vartotojo sąsajos failai AppDelegate.h / AppDelegate.m aplikacijos pradiniai startavimo prpograminiai

More information

Graphical User Interfaces 2

Graphical User Interfaces 2 Graphical User Interfaces 2 CSCI 136: Fundamentals CSCI 136: Fundamentals of Computer of Science Computer II Science Keith II Vertanen Keith Vertanen Copyright 2011 Extending JFrame Dialog boxes Overview

More information

OOP Assignment V. For example, the scrolling text (moving banner) problem without a thread looks like:

OOP Assignment V. For example, the scrolling text (moving banner) problem without a thread looks like: OOP Assignment V If we don t use multithreading, or a timer, and update the contents of the applet continuously by calling the repaint() method, the processor has to update frames at a blinding rate. Too

More information

CSC 1214: Object-Oriented Programming

CSC 1214: Object-Oriented Programming CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:

More information

Lab 4. D0010E Object-Oriented Programming and Design. Today s lecture. GUI programming in

Lab 4. D0010E Object-Oriented Programming and Design. Today s lecture. GUI programming in Lab 4 D0010E Object-Oriented Programming and Design Lecture 9 Lab 4: You will implement a game that can be played over the Internet. The networking part has already been written. Among other things, the

More information

B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA

B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE

More information

Introduction This assignment will ask that you write a simple graphical user interface (GUI).

Introduction This assignment will ask that you write a simple graphical user interface (GUI). Computing and Information Systems/Creative Computing University of London International Programmes 2910220: Graphical Object-Oriented and Internet programming in Java Coursework one 2011-12 Introduction

More information

Interfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics

Interfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics Interfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics 1 Collections (from the Java tutorial)* A collection (sometimes called a container) is simply an object that

More information

Programmierpraktikum

Programmierpraktikum Programmierpraktikum Claudius Gros, SS2012 Institut für theoretische Physik Goethe-University Frankfurt a.m. 1 of 25 17/01/13 11:45 Swing Graphical User Interface (GUI) 2 of 25 17/01/13 11:45 Graphical

More information

Chapter 12 GUI Basics

Chapter 12 GUI Basics Chapter 12 GUI Basics 1 Creating GUI Objects // Create a button with text OK JButton jbtok = new JButton("OK"); // Create a label with text "Enter your name: " JLabel jlblname = new JLabel("Enter your

More information

Kodėl programą sudaro daug failų? Sukurtos tipinės funkcijų galėtų būti panaudojamos dar kartą; Sudaroma aiškesnė programos struktūra; Sudaroma galimy

Kodėl programą sudaro daug failų? Sukurtos tipinės funkcijų galėtų būti panaudojamos dar kartą; Sudaroma aiškesnė programos struktūra; Sudaroma galimy C programavimo kalba 12 paskaita (Daugiafailinės programos, laiko ir datos funkcijos) Kodėl programą sudaro daug failų? Sukurtos tipinės funkcijų galėtų būti panaudojamos dar kartą; Sudaroma aiškesnė programos

More information

ios Uždara operacinė sistema skirta tik Apple įrenginiams: iphone ipad ipod touch Apple TV

ios Uždara operacinė sistema skirta tik Apple įrenginiams: iphone ipad ipod touch Apple TV ios Uždara operacinė sistema skirta tik Apple įrenginiams: iphone ipad ipod touch Apple TV Pagrindas OS X, skirtas ARM įrenginiams Programavimo aplinka: XCode ir Objective-C Programavimo kompiuteris -

More information

Parengė ITMM Artūras Šakalys 1

Parengė ITMM Artūras Šakalys 1 2014.02.02 Parengė ITMM Artūras Šakalys 1 2014.02.02 Parengė ITMM Artūras Šakalys 2 Kaip suprantame masyvą? Pavyzdys: Peteliškių šeima; Gėlių laukas; 2014.02.02 Parengė ITMM Artūras Šakalys 3 Kaip suprasti

More information

Introduction to Graphical Interface Programming in Java. Introduction to AWT and Swing

Introduction to Graphical Interface Programming in Java. Introduction to AWT and Swing Introduction to Graphical Interface Programming in Java Introduction to AWT and Swing GUI versus Graphics Programming Graphical User Interface (GUI) Graphics Programming Purpose is to display info and

More information

Using the Java 2D LookupOp Filter Class to Scramble and Unscramble Images. Preface

Using the Java 2D LookupOp Filter Class to Scramble and Unscramble Images. Preface Using the Java 2D LookupOp Filter Class to Scramble and Unscramble Images Learn how to use the LookupOp image-filtering class from the Java 2D API, along with the Random class from the java.util package

More information

Overview. Java2D. Graphics in Java2D: Colour Images Fonts. The bigger picture of Java Graphics: Java Advanced Imaging (JAI) API Java3D

Overview. Java2D. Graphics in Java2D: Colour Images Fonts. The bigger picture of Java Graphics: Java Advanced Imaging (JAI) API Java3D Graphics in Java2D: Colour Images Fonts Overview The bigger picture of Java Graphics: Java Advanced Imaging (JAI) API Java3D The bigger picture of Java multimedia ITNP80: Multimedia 1 ITNP80: Multimedia

More information

CSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University

CSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Events and Listeners CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Some slides

More information

Final Examination Semester 2 / Year 2011

Final Examination Semester 2 / Year 2011 Southern College Kolej Selatan 南方学院 Final Examination Semester 2 / Year 2011 COURSE COURSE CODE TIME DEPARTMENT LECTURER : JAVA PROGRAMMING : PROG1114 : 2 1/2 HOURS : COMPUTER SCIENCE : LIM PEI GEOK Student

More information

Chapter 4. Images, Visual Effects, and Animation

Chapter 4. Images, Visual Effects, and Animation Chapter 4. Images, Visual Effects, and Animation Images are a central part of every game, and this chapter examines how we can (efficiently) load and display them, apply visual effects such as blurring,

More information

Building a Java First-Person Shooter

Building a Java First-Person Shooter Building a Java First-Person Shooter Episode 4 How Rendering Works [Last updated 5/02/2017] URL https://www.youtube.com/watch?v=6doiju7--jg&index=5&list=pl656dade0da25adbb Objectives This is a very short

More information

TTTK Program Design and Problem Solving Tutorial 3 (GUI & Event Handlings)

TTTK Program Design and Problem Solving Tutorial 3 (GUI & Event Handlings) TTTK1143 - Program Design and Problem Solving Tutorial 3 (GUI & Event Handlings) Topic: JApplet and ContentPane. 1. Complete the following class to create a Java Applet whose pane s background color is

More information

Java. GUI building with the AWT

Java. GUI building with the AWT Java GUI building with the AWT AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many applications Uses the controls defined by your OS therefore

More information

Graphical User Interfaces 2

Graphical User Interfaces 2 Graphical User Interfaces 2 CSCI 136: Fundamentals of Computer Science II Keith Vertanen Copyright 2011 Extending JFrame Dialog boxes Ge?ng user input Overview Displaying message or error Listening for

More information

Come to the TypeScript

Come to the TypeScript Come to the TypeScript we have type hinting! Sergej Kurakin Sergej Kurakin Amžius: 36 Dirbu: NFQ Technologies Pareigos: Programuotojas Programuoti pradėjau mokytis 1996 metais. Programuotoju dirbu nuo

More information

Chapter #1. Program to demonstrate applet life cycle

Chapter #1. Program to demonstrate applet life cycle Chapter #1. Program to demonstrate applet life cycle import java.applet.applet; import java.awt.*; public class LifeCycle extends Applet{ public void init(){ System.out.println(" init()"); public void

More information

Objectives. OO Exceptions (ch( ch.. 10) and a little Applets thrown in. Applets. Understand Applet model Understand Exceptions

Objectives. OO Exceptions (ch( ch.. 10) and a little Applets thrown in. Applets. Understand Applet model Understand Exceptions Objectives OO Exceptions (ch( ch.. 10) and a little Applets thrown in CS201 Spring 2005 Week 7 Understand Applet model Understand Exceptions throw-catch block rethrowing Development Methods 2 Applets import

More information

An Implementation for Merging Images for Version Control

An Implementation for Merging Images for Version Control An Implementation for Merging Images for Version Control JUSTIN WONG, MIRIAM A. M. CAPRETZ Department of Electrical and Computer Engineering The University of Western Ontario London, Ontario, N6A 5B9 CANADA

More information

GUI and its COmponent Textfield, Button & Label. By Iqtidar Ali

GUI and its COmponent Textfield, Button & Label. By Iqtidar Ali GUI and its COmponent Textfield, Button & Label By Iqtidar Ali GUI (Graphical User Interface) GUI is a visual interface to a program. GUI are built from GUI components. A GUI component is an object with

More information

CS 201 Advanced Object-Oriented Programming Lab 1 - Improving Your Image Due: Feb. 3/4, 11:30 PM

CS 201 Advanced Object-Oriented Programming Lab 1 - Improving Your Image Due: Feb. 3/4, 11:30 PM CS 201 Advanced Object-Oriented Programming Lab 1 - Improving Your Image Due: Feb. 3/4, 11:30 PM Objectives The objectives of this assignment are: to refresh your Java programming to become familiar with

More information

GUI Applications. Let s start with a simple Swing application in Java, and then we will look at the same application in Jython. See Listing 16-1.

GUI Applications. Let s start with a simple Swing application in Java, and then we will look at the same application in Jython. See Listing 16-1. GUI Applications The C implementation of Python comes with Tkinter for writing Graphical User Interfaces (GUIs). The GUI toolkit that you get automatically with Jython is Swing, which is included with

More information

JFrame & JLabel. By Iqtidar Ali

JFrame & JLabel. By Iqtidar Ali JFrame & JLabel By Iqtidar Ali JFrame & its Features JFrame is a window with border, title and buttons. The component added to frame are referred to as its contents & are managed by the content pane. To

More information

CAPSTONE PROJECT REPORT (Project Term January-April, 2014)

CAPSTONE PROJECT REPORT (Project Term January-April, 2014) CAPSTONE PROJECT REPORT (Project Term January-April, 2014) IMAGE ENHANCEMENT TOOL Submitted by (Zahid Mushtaq Beigh ) Registration Number : 11006849 (Dharmendra Kumar) Registration Number : 11002022 (Akash

More information

C++ programavimo kalba

C++ programavimo kalba C++ programavimo kalba I/O biblioteka (2 paskaita) I/O operatoriai Išvedimo > #include using namespace std; void main() { float A = 18.236; cout

More information

Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks)

Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks) M257 MTA Spring2010 Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks) 1. If we need various objects that are similar in structure, but

More information

C++ programavimo kalba

C++ programavimo kalba C++ programavimo kalba Rodyklė this, C++ string klasė (9 paskaita) Rodyklėthis Visos objekto funkcijos gali naudotis rodykle this, kuri rodo į patį objektą. Tokiu būdu kiekviena funkcija gali rasti objekto,

More information

ว ฒนพงศ ส ทธภ กด Java Programming ( )

ว ฒนพงศ ส ทธภ กด Java Programming ( ) ว ฒนพงศ ส ทธภ กด Java Programming (254372 ) Basic GUI - Frame(new Windows) - Component - popup - addcomponentlistener - addmouselistener - Eclipse plugin for gui(windows Builder) import javax.swing.jframe;

More information

CS 180 Problem Solving and Object Oriented Programming Fall 2011

CS 180 Problem Solving and Object Oriented Programming Fall 2011 CS 180 Problem Solving and Object Oriented Programming Fall 2011 hmp://www.cs.purdue.edu/homes/apm/courses/cs180fall2011/ This Week: Notes for Week : Nov 21-25, 2011 11/21 1. Review 2. Class BufferedImage

More information

COMP Assignment #10 (Due: Monday, March 11:30pm)

COMP Assignment #10 (Due: Monday, March 11:30pm) COMP1406 - Assignment #10 (Due: Monday, March 31st @ 11:30pm) In this assignment you will practice using recursion with data structures. (1) Consider the following BinaryTree class: public class BinaryTree

More information

Introduction to the JAVA UI classes Advanced HCI IAT351

Introduction to the JAVA UI classes Advanced HCI IAT351 Introduction to the JAVA UI classes Advanced HCI IAT351 Week 3 Lecture 1 17.09.2012 Lyn Bartram lyn@sfu.ca About JFC and Swing JFC Java TM Foundation Classes Encompass a group of features for constructing

More information

2-3 PASKAITOS. Paprasčiausia programa:

2-3 PASKAITOS. Paprasčiausia programa: 2-3 PASKAITOS Turinys: Paprasčiausios programos pavyzdys. Darbas su programavimo terpėmis. Duomenys. Duomenų tipai ir charakteristikos. Paprasčiausia įvestis/išvestis. Paprasčiausia programa: /* Pirmoji

More information

STRUKTUR PROGRAM JAVA: //Daftar paket yang digunakan dalam program import namapaket;

STRUKTUR PROGRAM JAVA: //Daftar paket yang digunakan dalam program import namapaket; STRUKTUR PROGRAM JAVA: //Daftar paket yang digunakan dalam program import namapaket; //Membuat Kelas public class namakelas //Metode Utama public static void main(string[] args) perintah-perintah;... LATIHAN

More information

1.00 Lecture 14. Lecture Preview

1.00 Lecture 14. Lecture Preview 1.00 Lecture 14 Introduction to the Swing Toolkit Lecture Preview Over the next 5 lectures, we will introduce you to the techniques necessary to build graphic user interfaces for your applications. Lecture

More information

EDA095 HTML. Pierre Nugues. April 13, Lund University

EDA095 HTML. Pierre Nugues. April 13, Lund University EDA095 HTML Pierre Nugues Lund University http://cs.lth.se/pierre_nugues/ April 13, 2016 Covers: Chapter 8, pages 248-266, Java Network Programming, 3 rd ed., Elliotte Rusty Harold Pierre Nugues EDA095

More information

Shared Collection of Java Course Materials: New Topics Covered. Agenda

Shared Collection of Java Course Materials: New Topics Covered. Agenda Shared Collection of Java Course Materials: New Topics Covered Dragoslav Pešovi ović DAAD project Joint Course on OOP using Java Humboldt University Berlin, University of Novi Sad, Polytehnica University

More information

C programavimo kalba. 3 paskaita (Sąlygos ir ciklo operatoriai, funkcija scanf() )

C programavimo kalba. 3 paskaita (Sąlygos ir ciklo operatoriai, funkcija scanf() ) C programavimo kalba 3 paskaita (Sąlygos ir ciklo operatoriai, funkcija scanf() ) Sąlygos operatorius if - else Sąlygos operatoriai skirti perduoti programos vykdymą vienai ar kitai programos šakai. Operatorius

More information

Graphical User Interfaces. Swing. Jose Jesus García Rueda

Graphical User Interfaces. Swing. Jose Jesus García Rueda Graphical User Interfaces. Swing Jose Jesus García Rueda Introduction What are the GUIs? Well known examples Basic concepts Graphical application. Containers. Actions. Events. Graphical elements: Menu

More information

Multiprocessing Threads/Lightweight objects Thread methods Concurrency Issues

Multiprocessing Threads/Lightweight objects Thread methods Concurrency Issues Concurrency Multiprocessing Threads/Lightweight objects Thread methods Concurrency Issues What is program execution? In order to run, a program must be loaded into memory and given an initial state. Code

More information

Swing - JTextField. Adding a text field to the main window (with tooltips and all)

Swing - JTextField. Adding a text field to the main window (with tooltips and all) Swing - JTextField Adding a text field to the main window (with tooltips and all) Prerequisites - before this lecture You should have seen: The lecture on JFrame The lecture on JButton Including having

More information

TestQueue. Oklahoma Indiana Georgia Texas

TestQueue. Oklahoma Indiana Georgia Texas Lecture 7 Queues Queue Definition A queue represents a waiting list. It can be viewed as a special type of list whose elements are inserted into the end (tail) of the queue, and are accessed and deleted

More information

The University of Western Ontario Department of Computer Science Computer Science 1026a Midterm Exam 2 hours

The University of Western Ontario Department of Computer Science Computer Science 1026a Midterm Exam 2 hours The University of Western Ontario Department of Computer Science Computer Science 1026a Midterm Exam 2 hours PRINT YOUR NAME: PRINT YOUR STUDENT NUMBER: Do not turn this page until instructed to do so!

More information

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT CSE 143 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/

More information

CS 251 Intermediate Programming GUIs: Components and Layout

CS 251 Intermediate Programming GUIs: Components and Layout CS 251 Intermediate Programming GUIs: Components and Layout Brooke Chenoweth University of New Mexico Fall 2017 import javax. swing.*; Hello GUI public class HelloGUI extends JFrame { public HelloGUI ()

More information

TA Programming of Interactive Systems

TA Programming of Interactive Systems TA Programming of Interactive Systems https://www.lri.fr/~cfleury/teaching/isi2014/ Arnaud Prouzeau (M1 Info)! prouzeau@lri.fr Cédric Fleury (M1 HCID)! cfleury@lri.fr The presentation is based on last

More information

import java.applet.applet; import java.applet.audioclip; import java.net.url; public class Vjesala2 {

import java.applet.applet; import java.applet.audioclip; import java.net.url; public class Vjesala2 { import java.awt.color; import java.awt.flowlayout; import java.awt.font; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton;

More information

Chapter 1 Introduction to Java

Chapter 1 Introduction to Java Chapter 1 Introduction to Java Lesson page 0-1. Introduction to Livetexts Question 1. A livetext is a text that relies not only on the printed word but also on graphics, animation, audio, the computer,

More information

First Name: AITI 2004: Exam 2 July 19, 2004

First Name: AITI 2004: Exam 2 July 19, 2004 First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: Standard Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand

More information

Object-oriented programming in Java (2)

Object-oriented programming in Java (2) Programming Languages Week 13 Object-oriented programming in Java (2) College of Information Science and Engineering Ritsumeikan University plan last week intro to Java advantages and disadvantages language

More information

COMPSCI 230. Software Design and Construction. Swing

COMPSCI 230. Software Design and Construction. Swing COMPSCI 230 Software Design and Construction Swing 1 2013-04-17 Recap: SWING DESIGN PRINCIPLES 1. GUI is built as containment hierarchy of widgets (i.e. the parent-child nesting relation between them)

More information

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7 PROGRAMMING DESIGN USING JAVA (ITT 303) Graphical User Interface Unit 7 Learning Objectives At the end of this unit students should be able to: Build graphical user interfaces Create and manipulate buttons,

More information

Trumpai-ilga istorija

Trumpai-ilga istorija Įvadas į Web Services Kas yra Web Service? Kas ką žino??? 70-ieji: Mainframe Trumpai-ilga istorija 80-ieji: Client-Server Istorijos 90-ieji: Web 2000: SOA 2010: Cloud Computing Šaltinis: Sergejus Barinovas,

More information

Graphical User Interfaces 2

Graphical User Interfaces 2 Graphical User Interfaces 2 CSCI 136: Fundamentals of Computer Science II Keith Vertanen Copyright 2014 2011 Extending JFrame Dialog boxes Overview Ge

More information

COMP-202: Foundations of Programming. Lecture 26: Image Manipulation; Wrap-Up Jackie Cheung, Winter 2015

COMP-202: Foundations of Programming. Lecture 26: Image Manipulation; Wrap-Up Jackie Cheung, Winter 2015 COMP-202: Foundations of Programming Lecture 26: Image Manipulation; Wrap-Up Jackie Cheung, Winter 2015 Announcements Assignment 6 due Tue Apr 14 at 11:59pm Final is scheduled for Apr 29, 6pm 9pm Please

More information

Object-Oriented Programming Design. Topic : Graphics Programming GUI Part I

Object-Oriented Programming Design. Topic : Graphics Programming GUI Part I Electrical and Computer Engineering Object-Oriented Topic : Graphics GUI Part I Maj Joel Young Joel.Young@afit.edu 15-Sep-03 Maj Joel Young A Brief History Lesson AWT Abstract Window Toolkit Implemented

More information

MIT AITI Swing Event Model Lecture 17

MIT AITI Swing Event Model Lecture 17 MIT AITI 2004 Swing Event Model Lecture 17 The Java Event Model In the last lecture, we learned how to construct a GUI to present information to the user. But how do GUIs interact with users? How do applications

More information

Types of Specifications

Types of Specifications A software specification indicates the task (or some aspect of the task) that is supposed to be performed when software executes. Types of Specifications Class Diagrams Object Diagrams Activity Diagrams

More information

Graphic Interface Programming II Events and Threads. Uppsala universitet

Graphic Interface Programming II Events and Threads. Uppsala universitet Graphic Interface Programming II Events and Threads IT Uppsala universitet Animation Animation adds to user experience Done right, it enhances the User Interface Done wrong, it distracts and irritates

More information

Programming Languages and Techniques (CIS120)

Programming Languages and Techniques (CIS120) Programming Languages and Techniques (CIS120) Lecture 32 April 9, 2018 Swing I: Drawing and Event Handling Chapter 29 HW8: Spellchecker Available on the web site Due: Tuesday! Announcements Parsing, working

More information

Class 14: Introduction to the Swing Toolkit

Class 14: Introduction to the Swing Toolkit Introduction to Computation and Problem Solving Class 14: Introduction to the Swing Toolkit Prof. Steven R. Lerman and Dr. V. Judson Harward 1 Class Preview Over the next 5 lectures, we will introduce

More information

Higher National Diploma in Information Technology First Year, Second Semester Examination 2015

Higher National Diploma in Information Technology First Year, Second Semester Examination 2015 [All Rights Reserved] SLIATE SRI LANKA INSTITUTE OF ADVANCED TECHNOLOGICAL EDUCATION (Established in the Ministry of Higher Education, vide in Act No. 29 of 1995) Higher National Diploma in Information

More information

CP122 Computer Science I. Chapter 2: Using Objects

CP122 Computer Science I. Chapter 2: Using Objects CP122 Computer Science I Chapter 2: Using Objects Tech News! Cyber Monday: $3.3B https://youtu.be/r4rfcay9fiq Tech News! Cyber Monday: $3.3B https://youtu.be/r4rfcay9fiq Small drone warfare https://cdn1.tnwcdn.com/wpcontent/blogs.dir/1/files/2016/11/ezgif.comoptimize-1-1.mp4

More information

First Name: AITI 2004: Exam 2 July 19, 2004

First Name: AITI 2004: Exam 2 July 19, 2004 First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: JSP Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand

More information

6-7-8 PASKAITOS. Bendros žinios

6-7-8 PASKAITOS. Bendros žinios 6-7-8 PASKAITOS Turinys: Paveldimumas Bendros žinios. Išvestinės klasės konstruktoriai. Paveldimumas ir metodų perkrovimas. Įvadas į abstrakčias klases. Bendrasis ir dalinis paveldimumas. Daugybinis paveldimumas.

More information

import javax.swing.*; import java.awt.*; import java.awt.event.*;

import javax.swing.*; import java.awt.*; import java.awt.event.*; I need to be walked through with why the stocks are being recognized "half way." They will print out in the console but won't be recognized by certain code. Every line of code seems to look right and that's

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSITY SCHOOL OF COMPUTING HAND IN Answers Are Recorded on Question Paper CISC124, FALL TERM, 2013 FINAL EXAMINATION 7pm to 10pm, 18 DECEMBER 2013 Instructor: Alan McLeod If the instructor

More information

CSC 1051 Data Structures and Algorithms I

CSC 1051 Data Structures and Algorithms I Repetition CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Some slides in this

More information

) / Java ( )

) / Java ( ) 2002 3 2003.1.29 1 3 ( ) ( ) / Java ( ) 1 ( )? ( ) 2 (3 ) 3 Java Java Java (dynamic dispatch) ( ) import java.awt.*; import java.awt.event.*; public class Sample30 extends Frame { boolean go; double time;

More information

Java Swing Introduction

Java Swing Introduction Course Name: Advanced Java Lecture 18 Topics to be covered Java Swing Introduction What is Java Swing? Part of the Java Foundation Classes (JFC) Provides a rich set of GUI components Used to create a Java

More information