הרצאה מספר: GUI components רכיבים נוספים חלק ג' צבי מלמד מכללת הדסה/מכללה חרדית כל הזכויות שמורות תכנות ג'אווה + אינטרנט JAVA & WEB PROGRAMMING
|
|
- Camron Ball
- 6 years ago
- Views:
Transcription
1 הרצאה מספר: #07 GUI components רכיבים נוספים חלק ג' תכנות ג'אווה + אינטרנט JAVA & WEB PROGRAMMING צבי מלמד מכללת הדסה/מכללה חרדית כל הזכויות שמורות 1
2 המחלקה JOptionPane אפליקציות רבות משתמשות ב- dialog boxes למטרת אינטראקציה עם המשתמש למשל: "למחוק את הקובץ? כן / לא / בטל המחלקה JOptionPane מספקת מספר אפשרויות מוגדרות מראש לדיאלוגים ההפעלה על ידי קריאה למתודות סטטיות 2
3 - דיאלוג בסיסי ch14_2 jhtp GUI היכנסו לתיקייה המתאימה הריצו את הפקודה java Addition סקרו את הקוד של הדוגמא היכנסו לתיעוד JAVA וחפשו את המחלקה Class JOptionPane קראו בקצרה את ההקדמה של כל אחת מהמחלקות בהיררכיה שקודמת למחלקה זאת דוגמה אחרת להרצה: GUI_01_JOptionPane 3
4 המחלקה JOptionPane המארז: javax.swing המחלקה מספקת dialog boxes באמצעות מתודות סטטיות הנדסת אנוש: תיבות-הדיאלוג לא מאפשרות למשתמשים לעבוד עם האפליקציה כל עוד הן פתוחות. לעתים קרובות הן "מעצבנות" יש למעט בשימוש בהן להשתמש רק כשאתה אכן רוצה למנוע מהמשתמש את המשך האינטראקציה עם האפליקציה 4
5 - דיאלוג בסיסי ch14_2 jhtp GUI 5
6 המחלקה JOptionPane המחלקה מספקת קבועים להצגת אייקונים בתיבת הדו-שיח 6
7 Message Dialogs Message Dialogs באמצעות showmessagedialog שהיא פונקציה סטטית של JOptionPane ארגומנט ראשון: מיקום החלון. אם NULL אז באמצע המסך ארגומנט שני: הטקסט של ההודעה להציג ארגומנט שלישי: הכותרת של החלון titel bar ארגומנט רביעי: איזה סוג הודעה להציג. משתמשים בקבועים של המחלקה כגון YES_NO_OPTIONאו YES_NO_CANCEL_OPTION JOption-Pane.PLAIN_MESSAGE גורם לכך שלא מוצג ICON משמאל להודעה 7
8 הצגה של טקסט ותמונות דוגמא 14_06_07 8
9 הצגה של טקסט ותמונות דוגמא 14_06_07 9
10 יצירת Icon בד"כ על ידי העברתו כארגומנט לקונסטרקטור או למתודה seticon() Icon הוא אובייקט של מחלקה שמממשת את הממשק Icon במארז javax.swing. ImageIcon (package javax.swing) supports several image formats, including Graphics Interchange Format (GIF), Portable Network Graphics (PNG) and Joint Photographic Experts Group (JPEG). 10
11
12
13
14 גיבוי getclass().getresource("bug1.png") Invokes method getclass (inherited indirectly from class Object) to retrieve a reference to the Class object that represents the LabelFrame class declaration. Next, invokes Class method getresource, which returns the location of the image as a URL. The ImageIcon constructor uses the URL to locate the image, then loads it into memory. The class loader knows where each class it loads is located on disk. Method getresource uses the Class object s class loader to determine the location of a resource, such as an image file. Copyright by Pearson Education, Inc. All Rights Reserved.
15 גיבוי A JLabel can display an Icon. JLabel constructor can receive text and an Icon. The last constructor argument indicates the justification of the label s contents. Interface SwingConstants (package javax.swing) declares a set of common integer constants (such as SwingConstants.LEFT) that are used with many Swing components. By default, the text appears to the right of the image when a label contains both text and an image. The horizontal and vertical alignments of a JLabel can be set with methods sethorizontalalignment and setverticalalignment, respectively. Copyright by Pearson Education, Inc. All Rights Reserved.
16 גיבוי
17 כפתורי מצבים 17
18 JButtons ButtonGroup ActionEvent מייצר JButton state-button JCheckBox, JRadioButton יש להם מצבים של on/off true/false מייצרים ItemEvent מתודת האזנה: itemstatechanged לקבל ערך נוכחי: isselected Deitel 14_17 JRadioButton מוחזקים יחדיו על ידי אובייקט add() להוספת כפתור לקבוצה Deitel 14_19 18
19
20
21
22
23 JRadioButton 23 יוצרים כפתורים מוסיפים אותם למחלקה )שיורשת מ )Jframe יוצרים ButtonGroup מוסיפים את הכפתורים ל- ButtonGroup מוסיפים מאזין לכל כפתור צבי מלמד כל הזכויות שמורות
24 JRadioButton יוצרים כפתורים מוסיפים אותם למחלקה )שיורשת מ )Jframe יוצרים ButtonGroup מוסיפים את הכפתורים ל- ButtonGroup מוסיפים מאזין לכל כפתור מגדירים )כותבים( את המחלקה RadioButtonHandlerשמממשת ItemListener
25 JRadioButton מגדירים )כותבים( את המחלקה ItemListener RadioButtonHandlerשמממשת.6 25
26 JComboBox 26
27 JComboBox מערך names ישמש ליצירת ה- combo יצירת ה- icons 27
28 JComboBox ה- listener הוא מחלקה אנונימית 28
29 JComboBox יוצרים מערך של ערכים ל-קומבו names יוצרים מערך של אייקונים להציג, בהתאמה במאזין המתודה getstatechangeמזומנת כשיש בחירת ערך חדש המתודה של האירוע מטיפוס getstatechange - ItemEvent מחזירה את סוג השינוי. במקרה שלנו: ItemEvent.SELECTED המתודה של הקומבו - getselectedindexמחזירה את האינדקס שנבחר, ומשתמשים בו לפי הצורך setmaximumrowcount להגדרת כמה פריטים להציג כאשר המשתמש לחץ על הרכיב. מייצר פס גלילה אם יש יותר רכיבים
30 JList JList משמש לבחירה שהמשתמש יכול לבחור ממנה מייצר ListSelectionEvents ברשימה שבוחרים איבר אחד 24_14 Deitel בחירת צבע מתוך רשימת צבעים מתודת האזנה: itemstatechanged setvisiblerowcountלהגדרת כמה פריטים להציג setselectionmode המחלקה לקבוע את אופן הבחירה ListSelectionModel SINGLE_SELECTION SINGLE_INTERVAL_SELECTION MULTIPLE_INTERVAL_SELECTION )בודד או מרובה( קובעת את מוד הבחירה 30
31 JList המאזין הוא מהמחלקה ListSelectionListener ובהתאמה addlistselectionlistener כאמור - setvisiblerowcountלהגדרת כמה פריטים להציג... אבל אם יש יותר פריטים ממספר השורות לא מוסיף אוטומטית scroll-bar אז מה עושים? מוסיפים )בעצמנו( JScrollPane 31
32
33
34
35 עוד על אירועי עכבר ממשקים MouseListener and MouseMotionListener לאירועי עכבר על כל רכיב GUI שהוא. הממשק MouseInputListener )במארז: )javax.swing.event מרחבי את שני הממשקים הנ"ל ויוצר ממשק אחד שמכיל את המתודות של שניהם 35
36 עוד על אירועי עכבר 36
37
38
39 טיפול באירועי עכבר המתודות שמטפלות באירועי עכבר מקבלות אובייקט מטיפוס MouseEvent שמכיל את המידע על האירוע, כולל הקואורדינטות של האירוע (0,0) פינה שמאלי עליונה של האובייקט GUI שעליו התרחש האירוע מתודות וקבועים של המחלקה InputEvent )שהיא מחלקת על של )Mouse-Event s מאפשרים לדעת איזה כפתור נלחץ 39
40 תיקייה: שורת ההרצה: תרגיל דוגמא לאירועי עכבר: MouseDrag or GUI_02_MouseDrag C:\Dropbox\workspaces\workspace\java-A\bin java gui_demo.mousedrag pink-mouse-md.png 40
41 MouseTracker 41
42 MouseTracker 42
43 MouseTracker 43
44 MouseTracker 44
45 MouseTracker 45
46 MouseTracker 46
47 Adapter Class 47
48 תזכורת מחלקות Event-Adapter
49
50
51
52 טיפול במקשים Key Event Handling הממשק KeyListenerמגיב על אירועי מקלדת המתודות שהוא מממש: keyreleased, keypressed, keytyped keytyped מגיבה )נקראת בתגובה( ללחיצת מקש שאיננו )ENTER )כגון action-key הן מקבלות אירוע KeyEvent קבלת ערך המקש: getkeycode קבלת מחרוזת שמתארת את המקש: getkeytext קבלת ערך UNICODE של המקש: getkeychar האם זה היה כפתור פעולה: isactionkey 52
53 טיפול במקשים Key Event Handling )המשך( המתודה getmodifiers מחזירה אם נלחץ CNTL SHIFT וכו' getkeymodifierstext לקבלת שמות המקשים שנלחצו מתודות של InputEvent שהיא מחלקת העל של KeyEvent ששימושיות כאן: iscontroldown, isaltdown, ismetadown, isshiftdown דוגמא 14_36 deitel 53
54 בדיקה אם Meta-key נלחצו לצורך ההדגמה )ושלא לצורך המחשבון(... כיצד נבדוק אם כפתור META )כלומר: CNTL, )ALT, SHIFT, נלחץ? למשל, לבדוק אם המשתמש הקיש A+CNTL if (event.getkeycode() == 'A' && (event.getmodifiers() & InputEvent.CTRL_MASK)!= 0) { } CNTL וגם ALT נלחצו: if ((event.getmodifiers() & (Event.ALT_MASK Event.CTRL_MASK))!=0) { } בכדי לבדוק אם או... if ((event.getmodifiers() & InputEvent.CTRL_MASK)!= 0) && event.getmodifiers() & InputEvent.ALT_MASK)!= 0) ) { } 54
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 information12/22/11. Copyright by Pearson Education, Inc. All Rights Reserved.
} Radio buttons (declared with class JRadioButton) are similar to checkboxes in that they have two states selected and not selected (also called deselected). } Radio buttons normally appear as a group
More informationCS111: PROGRAMMING LANGUAGE II
CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 10(b): Working with Controls Agenda 2 Case study: TextFields and Labels Combo Boxes buttons List manipulation Radio buttons and checkboxes
More informationSummary. Section 14.1 Introduction. Section 14.2 Java s New Nimbus Look-and-Feel. 618 Chapter 14 GUI Components: Part 1
618 Chapter 14 GUI Components: Part 1 erence to a JScrollPane, the program can use JScrollPane methods sethorizontal- ScrollBarPolicy and setverticalscrollbarpolicy to change the scrollbar policies at
More informationתוכנה 1. תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes
תוכנה 1 תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes class Outer { static class NestedButNotInner {... class Inner {... מחלקות מקוננות NESTED CLASSES 2 מחלקה מקוננת Class) )Nested
More information14.2 Java s New Nimbus Look-and-Feel 551 Sample GUI: The SwingSet3 Demo Application As an example of a GUI, consider Fig. 14.1, which shows the SwingS
550 Chapter 14 GUI Components: Part 1 14.1 Introduction 14.2 Java s New Nimbus Look-and-Feel 14.3 Simple GUI-Based Input/Output with JOptionPane 14.4 Overview of Swing Components 14.5 Displaying Text and
More informationלתיכנות עם MATLAB Lecture 5: Boolean logic and Boolean expressions
מבוא לתיכנות עם MATLAB 234127 Lecture 5: Boolean logic and Boolean expressions Written by Prof. Reuven Bar-Yehuda, Technion 2013 Based on slides of Dr. Eran Eden, Weizmann 2008 1 >>g = [89 91 80 98]; >>p
More informationלתיכנות עם MATLAB Lecture 5: Boolean logic and Boolean expressions
מבוא לתיכנות עם MATLAB 23427 Lecture 5: Boolean logic and Boolean expressions Written by Prof. Reuven Bar-Yehuda, Technion 203 Based on slides of Dr. Eran Eden, Weizmann 2008 ביטויים לוגיים דוגמא: תקינות
More informationSimple Web Service. namespace MyService { public class Service1 : System.Web.Services.WebService {
Simple Web Service WS פתיחת פרוייקט File New Project ASP.Net web service project - >http://localhost/webservice1 יצירת שירות המחשב חיבור וחילוק 2 מספרים : הטיפוסים הבסיסיים using System; איסוף וניהוף אוספי
More informationDr. Hikmat A. M. AbdelJaber
Dr. Hikmat A. M. AbdelJaber GUI are event driven (i.e. when user interacts with a GUI component, the interaction (event) derives the program to perform a task). Event: click button, type in text field,
More informationהנכות 1 םוכיס לוגרת 13 1
תוכנה 1 סיכום תרגול 13 1 קצת על מנשקים מנשק יכול להרחיב יותר ממנשק אחד שירותים במנשק הם תמיד מופשטים וציבוריים public interface MyInterface { public abstract int foo1(int i); int foo2(int i); The modifiers
More informationתוכנה 1 * לא בהכרח בסדר הזה
תוכנה 1 תרגול 7: מנשקים, פולימורפיזם ועוד * לא בהכרח בסדר הזה 2 מנשקים מנשקים מנשק )interface( הוא מבנה תחבירי ב- Java המאפשר לחסוך בקוד לקוח. מנשק מכיל כותרות של מתודות המימוש שלהן. )חתימות( ללא קוד אשר
More informationASP.Net Web API.
ASP.Net Web API 1 מה זה? Web API View בלבד ולא Data אותו מממש השרת והוא מחזיר לקליינט API הוא Web API הבקשה והתשובה הן בפרוטוקול Http\Https הקליינטים של Web API יכולים להיות רבים : אפשר להשתמש גם בMVC
More informationסכום (סדרת ערכים) אחרת - דוגמא: סכום-ספרות (num) אם < 10 num החזר 1 או אם = 0 = num החזר 0 public static int numofdigits (int num)
1 תבנית צבירה תבניות אלגוריתמיות לפעולות רקורסיביות תבנית צבירה לסדרת ערכים: סכום (סדרת ערכים) החזר את ערך הקצה + סכום (סדרת הערכים ללא ערך הקצה) דוגמא: פעולה המחזירה את סכום הספרות שבמספר שלם לא שלילי
More informationGUI Event Handlers (Part II)
GUI Event Handlers (Part II) 188230 Advanced Computer Programming Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University 1 Agenda Listener
More informationמערכים שעור מס. 4 כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1
מערכים שעור מס. 4 דרור טובי דר' כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1 למה מערכים? ברצוננו לאחסן בתוכנית ציוני בחינה כדי לחשב את ממוצע הציונים וסטיית התקן. נניח ש 30 סטודנטים לקחו
More informationמשתנים שעור מס. 2 כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1
משתנים שעור מס. 2 דרור טובי דר' כל הזכויות שמורות דר ' דרור טובי המרכז האוניברסיטאי אריאל 1 תפקיד המשתנים הצהרה על משתנה השמת ערך במשתנה int a, b, c; a = 1234; b = 99; c = a + b; משתנים מאפשרים לנו לשמור
More informationתוכנה 1 ומחלקות פנימיות
תוכנה 1 Design Patterns ומחלקות פנימיות תרגול 11: 1 Design Patterns A general reusable solution to recurring design problems. Not a recipe A higher level language for design Factory, Singleton, Observer
More informationAlgorithms. Intro2CS week 5
Algorithms Intro2CS week 5 1 Computational problems A computational problem specifies an inputoutput relationship What does the input look like? What should the output be for each input? Example: Input:
More informationNir Adar
שפת Java למתכנתי ++C - חלק שני מסמך זה הורד מהאתר. אין להפיץ מסמך זה במדיה כלשהי, ללא אישור מפורש מאת המחבר. מחבר המסמך איננו אחראי לכל נזק, ישיר או עקיף, שיגרם עקב השימוש במידע המופיע במסמך, וכן לנכונות
More informationChapter 6: Graphical User Interfaces
Chapter 6: Graphical User Interfaces CS 121 Department of Computer Science College of Engineering Boise State University April 21, 2015 Chapter 6: Graphical User Interfaces CS 121 1 / 36 Chapter 6 Topics
More informationContents Chapter 1 Introduction to Programming and the Java Language
Chapter 1 Introduction to Programming and the Java Language 1.1 Basic Computer Concepts 5 1.1.1 Hardware 5 1.1.2 Operating Systems 8 1.1.3 Application Software 9 1.1.4 Computer Networks and the Internet
More informationהנכות 1 םוכיס לוגרת 13 1
תוכנה 1 סיכום תרגול 13 1 בחינה באופק! הבחינה תכלול את כל הנושאים שכיסינו במהלך הסמסטר: כל ההרצאות כל תרגולים כל תרגילי בית חומר סגור שאלות אמריקאיות 2 קצת על מנשקים מנשק יכול להרחיב שירותים במנשק הם תמיד
More informationממשק משתמש גרפי בעזרת SWT. תוכנה 1 בשפת Java
ממשק משתמש גרפי בעזרת SWT תוכנה 1 בשפת Java 1 SWT ה בנויה על העיקרון של publish/subscribe אלמנטים בסיסיים )Widgets( מייצרים אירועים )Events( שאליהם נרשמים מאזינים )Listener( דוגמא 1: משתמש לוחץ על כפתור,
More informationModule 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani
Module 5 The Applet Class, Swings OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani The layout manager helps lay out the components held by this container. When you set a layout to null, you tell the
More informationהקלחמ ה תמרב ת ונ וכ ת (static members ) יליזרב דהוא Java תפשב ם דקת מ תונכת ביבא ל ת תטיסרבינוא
ת כו נו ת ברמת ה מחלקה (static members) אוהד ברזילי תכנות מ תקד ם בשפת Java אוניברסיטת ת ל אביב static keyword שדות המוגדרים כ static מציינים כי הם מוגדרים ברמת המחלקה ולא ברמת עצם כל העצמים של אותה מחלקה
More informationהנכות 1 םוכיס לוגרת 14 1
תוכנה 1 סיכום תרגול 14 1 קצת על מנשקים מנשק יכול להרחיב יותר ממנשק אחד שירותים במנשק הם תמיד מופשטים וציבוריים public interface MyInterface { public abstract int foo1(int i); int foo2(int i); The modifiers
More informationמבוא למדעי המחשב תרגול 8 רשימה משורשרת כללית, Comparator
מבוא למדעי המחשב 2017 תרגול 8 רשימה משורשרת כללית, Comparator בתרגול היום. LinkedList בניית ההכללה מ- LinkIntList תרגול המבנה ושימושיו ממשקים: Comparator Sorted Linked List ל- LinkedList ע"י שימוש ב- Comparator
More informationממשק משתמש גרפי בעזרת SWT
ממשק משתמש גרפי בעזרת SWT מה עושים היום? קריאת Stack Trace של חריגה hashcode ו- equals ממשק משתמש גרפי תוכנה 1 בשפת Java 2 1 Interpreting Stack Trace of an Exception Exception in thread "main" java.lang.outofmemoryerror:
More informationEngineering Programming A
Engineering Programming A תרגול 5 25.11.2012 מערכים חד-מימדיים )תזכורת( לדוגמא: מערך בשם Arr בגודל 8 שאיבריו מטיפוס int 3 7 5 6 8 1 23 16 0 1 2 3 4 5 6 7 ב - arr[0] ב יושב ערך שהוא המספר השלם 3 arr[1]
More informationתוכנה 1 תרגול מספר 13
1 תוכנה 1 תרגול מספר 13 ו- HashCode Equals עוד על טיפוסים מוכללים )Advanced Generics( חריגים )Exceptions( בית הספר למדעי המחשב אוניברסיטת תל אביב 1 2 ו- HASHCODE EQUALS 3 תזכורת: המחלקה Object package
More informationתוכנה 1 תרגול מספר 13
1 2 תוכנה 1 תרגול מספר 13 ו- HashCode Equals עוד על טיפוסים מוכללים )Advanced Generics( ו- HASHCODE EQUALS חריגים )Exceptions( בית הספר למדעי המחשב אוניברסיטת תל אביב 1 3 4 package java.lang; תזכורת: המחלקה
More informationמבוא לתכנות ב- JAVA מעבדה 2
מבוא לתכנות ב- JAVA מעבדה 2 מה בתרגול טיפוסים פרימיטיביים המרות טיפוסים אופרטורים יחסיים ולוגיים משפט if-else בתרגול הקודם טיפוסים פרימיטביים לייצוג מספרים שלמים וממשיים ואופרטורים לפעולות בין מספרים.1
More informationGUI Software Architecture
GUI Software Architecture P2: Requirements Analysis User Analysis Task Analysis Problem Scenarios Usability Criteria Scenario Your engineers just developed a new desktop computer. They give you the following
More informationלתיכנות עם MATLAB Lecture 5: Boolean logic and Boolean expressions
מבוא לתיכנות עם MATLAB 234127 Lecture 5: Boolean logic and Boolean expressions Written by Prof. Reuven Bar-Yehuda, Technion 2013 Based on slides of Dr. Eran Eden, Weizmann 2008 1 motivation Proper academic
More informationהנכות 1 םוכיס לוגרת 13 1
תוכנה 1 סיכום תרגול 13 1 בחינה באופק! הבחינה תכלול את כל הנושאים שכיסינו במהלך הסמסטר: כל ההרצאות כל תרגולים כל תרגילי בית חומר סגור שאלות אמריקאיות 2 קצת על מנשקים מנשק יכול להרחיב יותר ממנשק אחד שירותים
More informationAmortized Analysis, Union-Find,
Practical Session No. 13 Amortized Analysis, Union-Find, AMORTIZED ANALYSIS Refers to finding the average running time per operation, over a worst-case sequence of operations. Amortized analysis differs
More informationתרשים המחלקות ותרשים העצמים
1 תרשים המחלקות ותרשים העצמים חלק שלישי: ניתוח ועיצוב מערכות מידע באמצעות שימוש ב- UML ומתודולוגיית ה- Process )UP( Unified E1 3 E2 2 Outline UML Introduction Class Diagram Class Association Self association
More informationChapter 12 Advanced GUIs and Graphics
Chapter 12 Advanced GUIs and Graphics Chapter Objectives Learn about applets Explore the class Graphics Learn about the classfont Explore the classcolor Java Programming: From Problem Analysis to Program
More informationCompSci 125 Lecture 17. GUI: Graphics, Check Boxes, Radio Buttons
CompSci 125 Lecture 17 GUI: Graphics, Check Boxes, Radio Buttons Announcements GUI Review Review: Inheritance Subclass is a Parent class Includes parent s features May Extend May Modify extends! Parent
More informationמבוא לתכנות ב- JAVA תרגול 7
מבוא לתכנות ב- JAVA תרגול 7 רקורסיה - הקדמה הגדרה רקורסיבית: חדר הוא מסודר אם צד שמאל שלו מסודר שלו מסודר. וצד ימין שיטת פתרון רקורסיבית: פתרון מופעים פשוטים יותר של בעיה בכדי לפתור את הבעיה המקורית רקורסיה
More informationTutorial 10. Introduction to C++ שימו
Introduction to ++ שימו תרגול זה אינו התרגול הרישמי של הקורס. הוא מבוסס על חוברת התרגולים אך מכיל שינויים, הסברים נוספים ודוגמאות שונות או נוספות. + + תוכנ ית רא שונה ב הכרו ת עם + + תרגול // First ++
More informationגירסה
גירסה 1.00 29.02.2004 לולאות בשפת C מסמך זה הורד מהאתר.http://underwar.livedns.co.il אין להפיץ מסמך זה במדיה כלשהי, ללא אישור מפורש מאת המחבר. מחבר המסמך איננו אחראי לכל נזק, ישיר או עקיף, שיגרם עקב השימוש
More informationמבוא לתכנות בשפת C. Tzachi (Isaac) Rosen
מבוא לתכנות בשפת C מצביעים והקצאה דינאמית כתובות של משתנים לכל משתנה כתובת של המקום שלו בזיכרון כבר ראינו: שם של מערך הוא למעשה הכתובת של התא הראשון )באינדקס 0( של המערך להזכירכם: תא של מערך הינו משתנה
More informationתוכנה 1 סמסטר א' תשע"א
General Tips on Programming תוכנה 1 סמסטר א' תשע"א תרגול מס' 6 מנשקים, דיאגרמות וביטים * רובי בוים ומתי שמרת Write your code modularly top-down approach Compile + test functionality on the fly Start with
More informationGraphical Applications
Graphical Applications The example programs we've explored thus far have been text-based They are called command-line applications, which interact with the user using simple text prompts Let's examine
More informationSwing. By Iqtidar Ali
Swing By Iqtidar Ali Background of Swing We have been looking at AWT (Abstract Window ToolKit) components up till now. Programmers were not comfortable when doing programming with AWT. Bcoz AWT is limited
More informationמבוא לתכנות ב- JAVA מעבדה 4
מבוא לתכנות ב- JAVA מעבדה 4 מה בתרגול מערכים מחרוזות מערך חד מימדי מערך הוא מבנה המחזיק סדרה של איברים מאותו טיפוס גודל המערך הוא קבוע )נקבע בעת יצירת המערך( הגישה לכל איבר היא באמצעות אינדקס למה לי מערך?
More informationתור שימושים בעולם התוכנה
מבוא למדעי המחשב הרצאה : Queue, Iterator & Iterable תור מבנה נתונים אבסטרקטי תור שימושים בעולם התוכנה השימושים של תורים בעולם התוכנה מזכירים מאוד תורים במציאות: )VoIP( )YouTube( מקלדת שידור סרט באינטרנט
More information2010 가을학기부산대학교정보컴퓨터공학부 OVERVIEW OF GUI PROGRAMMING
2010 가을학기부산대학교정보컴퓨터공학부 OVERVIEW OF GUI PROGRAMMING Outline Graphic User Interface (GUI) Introduction AWT and Swing Graphics Programming Event Handling User Interface Components with Swing 2 Graphic User
More informationCommunication Networks ( ) / Spring 2011 The Blavatnik School of Computer Science, Tel-Aviv University. Allon Wagner
Communication Networks (0368-3030) / Spring 2011 The Blavatnik School of Computer Science, Tel-Aviv University Allon Wagner Kurose & Ross, Chapter 3.5.5, 3.7 (5 th ed.) Many slides adapted from: J. Kurose
More informationJava פעולות עוברות בירושה סביבת יסודות מדעי המחשב נספח הורשה
1 נספח הורשה פעולות עוברות בירושה.1 הפעולה ToString המחלקה קלף Card נכתוב את המחלקה המגדירה עצם מסוג קלף. תכונות המחלקה: מחרוזת המתארת את צורת הקלף )תלתן, מעוין, לב, עלה( מספר שלם בתחום 13-1 )כולל( המהווה
More informationתוכנה 1 * לא בהכרח בסדר הזה
תוכנה 1 תרגול 7: מנשקים, פולימורפיזם ועוד * לא בהכרח בסדר הזה 2 מנשקים מנשקים - תזכורת מנשק )interface( הוא מבנה תחבירי ב- Java המאפשר לחסוך בקוד לקוח. מנשק מכיל כותרות של מתודות )חתימות(. מימוש דיפולטיבי
More informationתרגול 4 פונקציות. מבנה של פונקציה: public static <return value type> <function name> (<arg1 type> <arg1>, <arg2 type> <arg2>, ) { <function body> }
נושאי התרגול: מה הן פונקציות הגדרת פונקציה,קריאה לפונקציה העברת ארגומנטים,החזרת ערך או void העברת משתנים פרימיטיביים ומערכים לפונקציה העמסה של פונקציות תרגול 4 פונקציות מוטיבציה לעיתים,אנו נזקקים לבצע
More informationתרגול 12. Standard Template Library כתיבת אלגוריתמים גנריים מצביעים חכמים
תרגול 12 Standard Template Library כתיבת אלגוריתמים גנריים מצביעים חכמים ספרית התבניות הסטנדרטית קיימת בכל מימוש של ++C מכילה אוספים (Containers) ואלגוריתמים. משתמשת בתבניות :(templates) אוספי הנתונים
More informationתוכנה 1. תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes בית הספר למדעי המחשב אוניברסיטת תל אביב
תוכנה 1 תרגול מספר 11: Static vs. Dynamic Binding מחלקות מקוננות Nested Classes בית הספר למדעי המחשב אוניברסיטת תל אביב 1 2 STATIC VS. DYNAMIC BINDING 3 Static versus Dynamic Binding public class Account
More informationPractical Session - Heap
Practical Session - Heap Heap Heap Maximum-Heap Minimum-Heap Heap-Array A binary heap can be considered as a complete binary tree, (the last level is full from the left to a certain point). For each node
More informationChapter 17 Creating User Interfaces
Chapter 17 Creating User Interfaces 1 Motivations A graphical user interface (GUI) makes a system user-friendly and easy to use. Creating a GUI requires creativity and knowledge of how GUI components work.
More informationSD Module-1 Advanced JAVA
Assignment No. 4 SD Module-1 Advanced JAVA R C (4) V T Total (10) Dated Sign Title: Transform the above system from command line system to GUI based application Problem Definition: Write a Java program
More informationSD Module-1 Advanced JAVA. Assignment No. 4
SD Module-1 Advanced JAVA Assignment No. 4 Title :- Transform the above system from command line system to GUI based application Problem Definition: Write a Java program with the help of GUI based Application
More informationJava GUI Design: the Basics
Java GUI Design: the Basics Daniel Brady July 25, 2014 What is a GUI? A GUI is a graphical user interface, of course. What is a graphical user interface? A graphical user interface is simply a visual way
More informationדף הדרכה ליצירת שרת/ לקוח עם GUI
דף הדרכה ליצירת שרת/ לקוח עם GUI בשיעורים הקודמים למדנו כיצד ליצור שרת לקוח פשוט, ויצירת טופס המכיל פקדים כלומר יצירת GUI למשתמש, בשיעור זה נרצה להראות את הדרך לשילוב בין השניים כלומר ליצור לקוח client
More informationמחרוזות ב Java ותכנות מונחה בדיקות )Test Driven Development(
מחרוזות ב Java ותכנות מונחה בדיקות )Test Driven Development( תוכנה 1 תרגול 8 String Immutability Strings are constants String s = " Tea "; s = s.trim(); s = s.replace('t', 'S'); s 1 2 3 " Tea " "Tea" "Sea"
More informationGUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline
Sequential vs. Event-driven Programming Reacting to the user GUI Program Organization Let s digress briefly to examine the organization of our GUI programs We ll do this in stages, by examining three example
More informationתוכנה 1 תרגול מספר 10: תרגיל חזרה חברת הייטק בית הספר למדעי המחשב אוניברסיטת תל אביב
1 תוכנה 1 תרגול מספר 10: תרגיל חזרה חברת הייטק בית הספר למדעי המחשב אוניברסיטת תל אביב 1 2 חברת הייטק בתרגיל זה נתרגל מספר נושאים אותם למדנו בשיעורים האחרונים: עיצוב ובניית מודל המורכב ממחלקות לתיאור סביבה
More informationתרגול מס' 5: IO )קלט-פלט(
תוכנה 1 אוניברסיטת תל אביב תרגול מס' 5: IO )קלט-פלט( זרמי קלט וזרמי פלט Streams(,(Input & Output קוראים וכותבים, והשימוש בהם לצורך עבודה עם קבצים 2 Input/Output in Java פעולות קלט-פלט הן רכיב מרכזי בכל
More informationתוכנה 1 טיפוסי השפה טיפוסים לא פרימיטיביים הטיפוסים הפרימיטיביים מחרוזות המרה למספרים תרגול 2: טיפוסי שפה, מחרוזות, מערכים ושגיאות
טיפוסי השפה תוכנה 1 תרגול 2: טיפוסי שפה, מחרוזות, מערכים ושגיאות טיפוסים יסודיים (פרימיטיביים): 8 טיפוסים מוגדרים בשפה שמיועדים להכיל ערכים פשוטים: מספרים שלמים: byte, short, int, long מספרים ממשיים: float,
More informationתרגול 6 רקורסיה ותכנות מונחה עצמים
מבוא למדעי המחשב 2017 תרגול 6 רקורסיה ותכנות מונחה עצמים מבוא למדעי המחשב 1 ראינו בהרצאה רקורסיה תכנות מונחה עצמים: מחלקה ואובייקט שדות, בנאים ושיטות מימוש מערך דינאמי של ראשוניים בתרגול היום רקורסיה הדפסת
More informationStarting Out with Java: From Control Structures Through Objects Sixth Edition
Starting Out with Java: From Control Structures Through Objects Sixth Edition Chapter 12 A First Look at GUI Applications Chapter Topics 12.1 Introduction 12.2 Creating Windows 12.3 Equipping GUI Classes
More informationJava Foundations John Lewis Peter DePasquale Joe Chase Third Edition
Java Foundations John Lewis Peter DePasquale Joe Chase Third Edition Pearson Education Limited Edinburgh Gate Harlow Essex CM20 2JE England and Associated Companies throughout the world Visit us on the
More informationהנכות 1 תואיגש םע תודדומתהו תואלול,םי : כרעמ 2 לוגרת
תוכנה 1 תרגול 2: מערכים, לולאות והתמודדות עם שגיאות מערכים מערכים Array: A fixed-length data structure for storing multiple values of the same type Example from last week: An array of odd numbers: Indices
More informationתוכנה 1 תרגול 2: מערכים, מבני בקרה ושגיאות
תוכנה 1 תרגול 2: מערכים, מבני בקרה ושגיאות מערכים Array: A fixed-length data structure for storing multiple values of the same type Example: An array of odd numbers: Indices (start from 0) 0 1 2 3 4 5
More informationהנכות 1 תואיגש םע תודדומתהו תואלול,םיכרעמ : לו 2 גרת
תוכנה 1 תרגול 2: מערכים, לולאות והתמודדות עם שגיאות מערכים Array: A fixed-length data structure for storing multiple values of the same type Example from last week: An array of odd numbers: Indices (start
More information10/16/2008. CSG 170 Round 5. Prof. Timothy Bickmore. User Analysis Task Analysis (6) Problem Scenarios (3)
Human-Computer Interaction CSG 170 Round 5 Prof. Timothy Bickmore T2: Requirements Analysis Review User Analysis Task Analysis (6) Problem Scenarios (3) 1 T2 Review Requirements Analysis Who is the user?
More informationExample Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing.
COSC User Interfaces Module 3 Sequential vs. Event-driven Programming Example Programs DemoLargestConsole.java DemoLargestGUI.java Demo programs will be available on the course web page. GUI Program Organization
More informationקורס תכנות שיעור שני: שימוש במשתנים,
קורס תכנות שיעור שני: שימוש במשתנים, בקרת זרימה, לולאות 1 נושאי השיעור היום משתנים )variables( טיפוסי משתנים בשפת C הגדרת משתנים השמה למשתנים פעולות על משתנים קליטת ערכים מהמשתמש הדפסה משתנים בקרת זרימה
More informationIntroduction to Programming in C תרגול 8
Introduction to Programming in C תרגול 8 1 1 נושאים מצביעים רקע אופרטורים על מצביעים מצביעים כפרמטרים לפונקציה הקצאה דינמית מבנים תאור הזיכרון של המחשב: מצביעים ניתן לחשוב על זיכרון המחשב כעל רצף של תאים,
More informationת ונכת סרוק תורשוקמ תומישר :יעישת רועיש 1
קורס תכנות שיעור תשיעי: רשימות מקושרות 1 הקצאה דינאמית של מערכים דו-ממדיים )לפחות( שלוש גישות אפשריות:.1 מערך של מערכים מצביעים לתוך מערך "גדול".2 3. מצביע יחיד למערך גדול 2 The Interface 3 (Simple) Usage
More information$ gcc check.c. $ a.out. $ gcc check.c -o check. $ check. $ gcc -Wall check.c -o check. #include <stdio.h>
תכנות בסיסי בשפת C תוכנית ראשונה תוכנית ב - C מורכבת מאוסף פונקציות והגדרות טיפוסים. C איננה שפה object oriented כך שאין בה מושגים של מחלקה ואובייקט. נתחיל בתוכנית הראשונה המסורתית, זו המדפיסה הודעה יחידה
More informationתוכנה 1 * לא בהכרח בסדר הזה
תוכנה 1 תרגול 7: מנשקים, פולימורפיזם ועוד * לא בהכרח בסדר הזה 2 מנשקים מנשקים מנשק )interface( הוא מבנה תחבירי ב- Java המאפשר לחסוך בקוד לקוח. מנשק מכיל כותרות של מתודות המימוש שלהן. )חתימות( ללא קוד אשר
More informationComputer Programming A תרגול 9
Computer Programming A תרגול 9 1 מטרת התרגול הקצאת זיכרון מבנים רשימות דינאמית ניהול הזיכרון בתוכנית עד כה כל המשתנים שראינו היו לוקאליים. משך הקיום של משתנים מקומיים הוא הזמן אשר הפונקציה בה הם נמצאים
More informationספרית התבניות הסטנדרטית (STL) כתיבת אלגוריתמים גנריים מצביעים חכמים. .vector. list iterator נכיר תחילה את האוסף הפשוט ביותר בספריה
ספרית התבניות הסטנדרטית (STL) כתיבת אלגוריתמים גנריים מצביעים חכמים vector list iterator 2 קיימת בכל מימוש של ++C מכילה אוספים (Containers) ואלגוריתמים נכיר תחילה את האוסף הפשוט ביותר בספריה.vector מערך
More informationCS 251 Intermediate Programming GUIs: Event Listeners
CS 251 Intermediate Programming GUIs: Event Listeners Brooke Chenoweth University of New Mexico Fall 2017 What is an Event Listener? A small class that implements a particular listener interface. Listener
More informationEVENTS, EVENT SOURCES AND LISTENERS
Java Programming EVENT HANDLING Arash Habibi Lashkari Ph.D. Candidate of UTM University Kuala Lumpur, Malaysia All Rights Reserved 2010, www.ahlashkari.com EVENTS, EVENT SOURCES AND LISTENERS Important
More informationComputer Science 210: Data Structures. Intro to Java Graphics
Computer Science 210: Data Structures Intro to Java Graphics Summary Today GUIs in Java using Swing in-class: a Scribbler program READING: browse Java online Docs, Swing tutorials GUIs in Java Java comes
More informationתוך כדי ריצה יכולה לבוא אירוע שמפסיק את מהלך הריצה )או באופן לא רצוני כגון שיחה נכנסת או באופן רצוני על ידי זימון )pauseapp()
בואו נכיר את ה- Midlet מחזור החיים של ה- Midlet במהלך חיי ה- Midlet הוא נמצא ב- 3 מצבים. מצב ריצה שמזמן את הפעולה StartApp() תוך כדי ריצה יכולה לבוא אירוע שמפסיק את מהלך הריצה )או באופן לא רצוני כגון שיחה
More informationControl Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User
CSE3461 Control Flow Paradigms: Reacting to the User Control Flow: Overview Definition of control flow: The sequence of execution of instructions in a program. Control flow is determined at run time by
More informationמצליחה. 1. int fork-bomb() 2. { 3. fork(); 4. fork() && fork() fork(); 5. fork(); printf("bla\n"); 8. return 0; 9. }
שאלה : (4 נקודות) א. ב. ג. (5 נקודות) הגדירו את המונח race-condition במדוייק לא להשמיט פרטים. ספקו דוגמא. (5 נקודות) מהו? Monitor נא לספק הגדרה מלאה. ( נקודות) ( נקודות) ציינו כמה תהליכים יווצרו בקוד הבא
More informationשפת XML הפכה להיות נפוצה ובעלת תפקידים רבים, במיוחד עקב גמישותה הרבה:
שעור extensible Markup Language - XML 11 XML היא שפת סימון בדומה ל- HTML, גם XML היא שפת סימון. XML איננה שפת תכנות שמאפשרת פיתוח תכניות אשר מבצעות פעולות חישוב. בדומה ל- HTML גם XML מורכבת, למעשה, מתגיות
More informationמבוא לתכנות ב- JAVA תרגול 6
מבוא לתכנות ב- JAVA תרגול 6 מה בתרגול )methods( פונקציות/שיטות ב- Java הגדרת פונקציה קריאה/הפעלה העברת ארגומנטים ערכי החזרה מבוא לפונקציות- שימוש חוזר בקוד נניח שבמהלך תוכנית נדרשתם לחשב את הסכום של המספרים
More informationמבוא למדעי המחשב השפעת השינוי על סטודנט הרצאה 18: פולימורפיזם ומחלקות אבסטרקטיות אם ברצוננו ששכר הלימוד לא יעלה על 2500.
public class { private static final int COURSE_PRICE = 1000; private String nae; private int id; private int nuofcourses; מבוא למדעי המחשב הרצאה 18 פולימורפיזם ומחלקות אבסטרקטיות תזכורת public (int id,
More informationUser Interface components with swing
User Interface components with swing A graphical user interface (GUI) presents a user-friendly mechanism for interacting with an application. A GUI (pronounced GOO-ee ) gives an application a distinctive
More information- מבחן. - 4 עבודות ב- JAVA. הגשה בזוגות דרך ה- System Submission
1 - מבחן. - 4 עבודות ב- JAVA 60% 40% הגשה בזוגות דרך ה- System Submission 2 UML Class Diagrams Packages Class Path JAR Files חלק ראשון: חלק שני: 3 An abstraction of software features A structure that singles
More informationOutline. More on the Swing API Graphics: double buffering and timers Model - View - Controller paradigm Applets
Advanced Swing Outline More on the Swing API Graphics: double buffering and timers Model - View - Controller paradigm Applets Using menus Frame menus add a menu bar to the frame (JMenuBar) add menus to
More informationיישומונים (Applets) 2007 Zindell Technologies, Ltd. הקדמה. המגבלות על פעולותיו של ה- applet. המחלקה Applet. המחלקה Graphics.
1 יישומונים (Applets) הקדמה המגבלות על פעולותיו של ה- applet המחלקה Applet המחלקה Graphics תגית ה- applet העברת פרמטרים ל- applet מחזור החיים של ה- applet הסביבה שבה פועל ה- applet ה. ה. 2 הקדמה ה- applet
More informationGraphical 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 informationCSS תגיות עיצוב - Document Level style sheet. הגדרת עיצוב inline { ;ערך : תכונה ;ערך :תכונה } שם-התגית CSS תכנות בסביבת האינטרנט 1
תכנות בסביבת האינטרנט 1 תגיות עיצוב - הגדרות עיצוב לגופן, צבע, יישור וכד'. קיימות חמש רמות לכתיבה והוספת עיצובים:.1 style - In Line עיצוב ברמת התגית..2 sheet - Document Level style עיצוב ברמת המסמך. 3.
More informationמבוא לתכנות ב- JAVA תרגול 5. Ipc161- practical session 5
מבוא לתכנות ב- JAVA תרגול 5 Ipc161- practical session 5 מה בתרגול מערכים דו ממדיים )methods( פונקציות/שיטות ב- Java הגדרת פונקציה קריאה/הפעלה העברת ארגומנטים ערכי החזרה מערך דו ממדי מערך של מערכים חד ממדיים
More informationקורס גרפיקה ממוחשבת 2008 סמסטר ב' ליאור שפירא 1 חלק מהשקפים מעובדים משקפים של פרדו דוראנד, טומס פנקהאוסר ודניאל כהן-אור
קורס גרפיקה ממוחשבת 2008 סמסטר ב' ליאור שפירא 1 חלק מהשקפים מעובדים משקפים של פרדו דוראנד, טומס פנקהאוסר ודניאל כהן-אור מרצה: ליאור שפירא liors@post.tau.ac.il אתר שלי: אתר הקורס: שעת קבלה: יום ג' 14-15
More informationGraphical 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