SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Collaborate


Knowledge Byte
    In this section, you will learn about:


         •   Property Sheets and Property Editor
         •   The PropertyEditorSupport and PropertyDescriptor Class
         •   The BeanInfo Interface




 ©NIIT                          Collaborate            Lesson 2C / Slide 1 of 23
Collaborate


Property Sheets and Property Editor
    •    Property sheets and property editors enable easy access to the exposed
         JavaBean properties.
    •    Property sheet or the Properties window of BDK displays a list of all the
         exposed properties of a JavaBean.
    •    A property editor window is used to edit the values of JavaBean properties,
         which cannot be edited in property sheets.
    •    The property editor is always associated with a specific JavaBean property.
    •    The property editor is displayed whenever an attempt is made to modify the
         value of the associated JavaBean property during the build phase.




 ©NIIT                          Collaborate                  Lesson 2C / Slide 2 of 23
Collaborate


The PropertyEditorSupport and
PropertyDescriptor Class
    •    The PropertyEditorSupport Class:
           • Enables you to create a text-based or a GUI based customized property
             editor.
           • Implements the PropertyEditor interface of the java.beans package.
           • Is extended by a class to create a customized property editor.




 ©NIIT                          Collaborate                 Lesson 2C / Slide 3 of 23
Collaborate


The PropertyEditorSupport and
PropertyDescriptor Class (Contd.)
    •    The following table lists some methods of the PropertyEditorSupport Class:

                   Method                                Description



   void addPropertyChangeListener(           Registers a new
   PropertyChangeListener pcl)               PropertyChangeListener to handle
                                             the PropertyChange events. The
                                             method accepts an object of
                                             PropertyChangeListener interface.
   void firePropertyChange()                 Informs all the listeners when there
                                             is a change in the JavaBean
                                             property.


 ©NIIT                         Collaborate                  Lesson 2C / Slide 4 of 23
Collaborate


 The PropertyEditorSupport and
 PropertyDescriptor Class (Contd.)
     •    The methods of PropertyEditorSupport class: (Contd.)
             Method                                     Description


void paintValue(Graphics g,          Paints a graphics object in a rectangle on the
Rectangle rec)                       screen area. The graphics to paint and the area in
                                     which the graphics is painted are passed as
                                     parameters to the paintValue() method.
boolean isPaintable()                Returns a boolean value that specifies if the
                                     JavaBean supports the paintValue() method.

void                                 Removes a registered PropertyChangeListener
removePropertyChangeListener(        from the list of listeners for the PropertyChange
PropertyChangeListener plist)        events.

  ©NIIT                         Collaborate                  Lesson 2C / Slide 5 of 23
Collaborate


The PropertyEditorSupport and
PropertyDescriptor Class (Contd.)
    •    The methods of PropertyEditorSupport class: (Contd.)

         Method                                  Description

boolean                     Returns a boolean value that determines whether the
supportsCustomEditor()      property editor object supports the custom editor or
                            not.
String getAsText()          Returns the string value of a JavaBean property.

Component                   Returns a custom property editor as a component that
getCustomEditor()           enables you to edit the value of JavaBean properties.

void setAsText(String       Sets the value of a property to the string passed as a
text)                       parameter to this method.

 ©NIIT                      Collaborate                  Lesson 2C / Slide 6 of 23
Collaborate


The PropertyEditorSupport and
PropertyDescriptor Class (Contd.)
    •    The methods of PropertyEditorSupport class: (Contd.)

                Method                                  Description

 String[] getTags()                        Returns an array of tag values that
                                           consists of all the possible values for
                                           a JavaBean property.
 void setValue(Object value)               Sets the value of a JavaBean property
                                           to the value passed as parameter.

 Object getValue()                         Enables you to retrieve the value of a
                                           JavaBean property.



 ©NIIT                      Collaborate                  Lesson 2C / Slide 7 of 23
Collaborate


The PropertyEditorSupport and
PropertyDescriptor Class (Contd.)
    •    The PropertyDescriptor Class
         • The PropertyDescriptor Class restricts the JavaBean properties that
              are displayed in the Properties window.
         • To create customized properties window, you need to create an
              information class that contains information about the properties,
              events, and methods of a JavaBean.
         • The information class extends the SimpleBeanInfo class and have a
              name ending with BeanInfo. For example,
              class PropBeanInfo extends SimpleBeanInfo
              {
              //Class body
              }


 ©NIIT                       Collaborate                 Lesson 2C / Slide 8 of 23
Collaborate


The PropertyEditorSupport and
PropertyDescriptor Class (Contd.)
         •   You also need to override the getPropertyDescriptors() method that
             returns an array of PropertyDescriptor objects in the PropBeanInfo
             class. For example,
             public PropertyDescriptor[] getPropertyDescriptors()
             {
             //Method_body
             }




 ©NIIT                      Collaborate                Lesson 2C / Slide 9 of 23
Collaborate


The BeanInfo Interface
    •    The BeanInfo interface provides the methods that enable you to specify and
         retrieve the information about a JavaBean.
    •    The following table lists some of the methods of BeanInfo interface:

           Method                                 Description


   MethodDescriptor[]          Returns an array of the method descriptor objects
   getMethodDescriptors(       of a JavaBean. The method descriptor objects are
   )                           used to determine information about the various
                               methods defined in a JavaBean.
   EventDescriptor[]           Returns an array of the event descriptor objects of
   getEventDescriptors()       a JavaBean. The event descriptor objects
                               determine the information about the events
                               associated with a JavaBean.


 ©NIIT                        Collaborate                  Lesson 2C / Slide 10 of 23
Collaborate


The BeanInfo Interface(Contd.)
    •    The methods of BeanInfo interface: (Contd.)

           Method                                 Description



   PropertyDescriptor[]        Returns an array of the property descriptor objects
   getPropertyDescriptor       of a JavaBean. The property descriptor objects are
   s()                         used to determine information about the various
                               custom properties of a JavaBean.

   Image getIcon( int          Returns a corresponding image object for one of
   icon_type )                 the fields of the BeanInfo interface passed as a
                               parameter to this method. The BeanInfo interface
                               defines int fields, such as ICON_COLOR_32x32 and
                               ICON_MONO_32x32 to represent icons.



 ©NIIT                       Collaborate                  Lesson 2C / Slide 11 of 23
Collaborate


From the Expert’s Desk
    In this section, you will learn:


         •    Tips on:
              • Using the sample JavaBeans of BDK1.1 in Java 2 SDKv1.4.x
              • Creating a single manifest file that contains entries for multiple
                   JavaBeans
         •    FAQs on JavaBeans




 ©NIIT                           Collaborate               Lesson 2C / Slide 12 of 23
Collaborate


Tips
Using the Sample JavaBeans of BDK1.1 in Java 2
SDK v 1.4.x
    •    The steps to use the sample JavaBeans of BDK in Java 2 SDK 1.4.x are:
          •    Open the C:BDK1.1beansdemosunwdemobuttons folder
               using the Windows Explorer.
          •    Open the folder for the sample JavaBean, for example, open the
               folder for ExplicitButton JavaBean that is not supported by Java 2 SDK
               1.4.x.




 ©NIIT                        Collaborate                 Lesson 2C / Slide 13 of 23
Collaborate


Tips
Using the Sample JavaBeans of BDK1.1 in Java 2
SDK v 1.4.x (Contd.)
         •   Change the code in the public EventSetDescriptor[]
             getEventSetDescriptors() method. For example, to load the
             ExplicitButton JavaBean, you need to change the following code:
             EventSetDescriptor push = new EventSetDescriptor(beanClass,
             "actionPerformed", java.awt.event.ActionListener.class,
             "actionPerformed");
             The preceding code should be changed to the following code:
             EventSetDescriptor push = new EventSetDescriptor(beanClass,
             "action", java.awt.event.ActionListener.class,
             "actionPerformed");



 ©NIIT                      Collaborate               Lesson 2C / Slide 14 of 23
Collaborate


Tips
Using the Sample JavaBeans of BDK1.1 in Java 2
SDK v 1.4.x (Contd.)
         •    Compile all files of C:BDK1.1beansdemosunwdemobuttons
              directory.
         •    Download Microsoft nmake utility to the C:BDK1.1beansbeanbox
              directory from the following url:
              ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe
         •    Add the C:BDK1.1beansbeanbox directory path to your system
              path.
         •    Go to C:BDK1.1beansdemo and type:
              nmake buttons.mk
         7.   Run BDK. The ExplicitButton JavaBean will get loaded in the BDK.


 ©NIIT                       Collaborate               Lesson 2C / Slide 15 of 23
Collaborate


Tips
Creating Manifest File for Multiple JavaBeans
    •    The syntax to define the entries for multiple JavaBean files in the same
         manifest file is:
         Name: <beanFile1.class>
         Java-Bean: <status>

         Name: <beanFile2.class>
         Java-Bean: <status>

         Name: <file3.gif>
         In the preceding syntax, a blank line is left between each of the file
         declarations.




 ©NIIT                           Collaborate                   Lesson 2C / Slide 16 of 23
Collaborate


FAQs
    •    What type of JavaBean will you use to display the current time in an
         application?

         You can display the current time in a Java application using a control
         JavaBean. The control JavaBean adds a new feature to an existing Java
         application.


    •    How can you count the number of hits for a particular Web page using
         JavaBeans?

         You can count the number of hits for a Web page using an invisible runtime
         JavaBean. This JavaBean performs a hidden background function.




 ©NIIT                          Collaborate                  Lesson 2C / Slide 17 of 23
Collaborate


FAQs (Contd.)

    •    How would you change the foreground color of a component using
         JavaBeans?

         The foreground color of a component can be changed using the JavaBean
         properties. You need to create a JavaBean for the component and define a
         property, foreground color for the component. The setForegroundColor()
         method for the JavaBean property can be used to specify and change the
         value of the foreground color for the JavaBean component.




 ©NIIT                        Collaborate                Lesson 2C / Slide 18 of 23
Collaborate


FAQs (Contd.)

    •    What is introspection?

         Introspection is the process of examining the class structure of a JavaBean
         and determining the properties, methods, and events supported by the
         JavaBean. Introspection helps you to find only the list of methods and the
         method signatures of a JavaBean. It does not help you to find the source
         code of the methods and how the JavaBean functionality has been
         implemented. The introspection technique is used by a programmer during
         the design and build phases to identify the JavaBean functionality. The end
         user will not be interested in knowing the internal functionalities of a
         JavaBean.




 ©NIIT                            Collaborate              Lesson 2C / Slide 19 of 23
Collaborate


FAQs (Contd.)

    •    Where is the manifest file of a JavaBean stored in the JAR file?

         The manifest file is stored inside the directory, META-INF inside the JAR file.


    •    How does the compiler recognize the file to execute while running a JAR file?

         When a JAR file is executed, the Main-Class entry in the manifest file
         instructs the java -jar command about the class to execute. The java -jar
         command enables you to execute a runnable JAR file on the command
         prompt. The -jar option enables the Java Runtime Environment (JRE) to
         recognize that the specified file is a runnable JAR file. The command to
         execute a runnable JAR file, SampleJar.jar, on the command prompt is:
         java -jar SampleJar.jar


 ©NIIT                         Collaborate                   Lesson 2C / Slide 20 of 23
Collaborate


Challenge
    1.   Select the option that allows you to view the sequence of method invocation
         in BDK 1.1:
         a.   ToolBox Window
         b.   BeanBox Window
         c.   Method Tracer Window
         d.   Properties Window
    •    What is the use of the addPropertyChangeListener() method of the
         PropertyEditorSupport class?
    •    Select the class that you need to use for implementing bound properties in
         JavaBeans:
         •    PropertyChangeSupport class
         •    VetobaleChangeSupport class
         •    ProperyChangeEvent class
         •    PropertyDescriptor class


 ©NIIT                        Collaborate                 Lesson 2C / Slide 21 of 23
Collaborate


Challenge (Contd.)

    •    The PropertyEditorSupport class implements the __________interface.
    •    What is the purpose of implementing the BeanInfo interface for a JavaBean?
    •    The ___________enables you to modify the JavaBean properties that are
         displayed in the property sheet.




 ©NIIT                        Collaborate                Lesson 2C / Slide 22 of 23
Collaborate


Solutions to Challenge

         •   c. Method Tracer Window
         •   The addPropertyChangeListener() method registers a new listener to
             handle the PropertyChange events.
         •   a. PropertyChangeSupport class
         •   PropertyEditor
         •   The BeanInfo interface enables you to provide the information about
             the properties, events, and methods of a JavaBean in the JavaBean
             information class.
         •   Property Editors




 ©NIIT                      Collaborate                Lesson 2C / Slide 23 of 23

Weitere ähnliche Inhalte

Was ist angesagt?

Java Beans Unit 4(part 2)
Java Beans Unit 4(part 2)Java Beans Unit 4(part 2)
Java Beans Unit 4(part 2)SURBHI SAROHA
 
Session 5 Tp5
Session 5 Tp5Session 5 Tp5
Session 5 Tp5phanleson
 
Vb.net session 16
Vb.net session 16Vb.net session 16
Vb.net session 16Niit Care
 
Java session16
Java session16Java session16
Java session16Niit Care
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesecosio GmbH
 
Hibernate inheritance and relational mappings with examples
Hibernate inheritance and relational mappings with examplesHibernate inheritance and relational mappings with examples
Hibernate inheritance and relational mappings with examplesEr. Gaurav Kumar
 
Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)ejlp12
 
Java questions with answers
Java questions with answersJava questions with answers
Java questions with answersKuntal Bhowmick
 
jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentationJohn Slick
 
Hibernate presentation
Hibernate presentationHibernate presentation
Hibernate presentationManav Prasad
 
Java Web Programming Using Cloud Platform: Module 3
Java Web Programming Using Cloud Platform: Module 3Java Web Programming Using Cloud Platform: Module 3
Java Web Programming Using Cloud Platform: Module 3IMC Institute
 

Was ist angesagt? (20)

Java Beans Unit 4(part 2)
Java Beans Unit 4(part 2)Java Beans Unit 4(part 2)
Java Beans Unit 4(part 2)
 
Javabean1
Javabean1Javabean1
Javabean1
 
Session 5 Tp5
Session 5 Tp5Session 5 Tp5
Session 5 Tp5
 
Java Beans
Java BeansJava Beans
Java Beans
 
Vb.net session 16
Vb.net session 16Vb.net session 16
Vb.net session 16
 
Jpa
JpaJpa
Jpa
 
Java session16
Java session16Java session16
Java session16
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examples
 
Java EE and Glassfish
Java EE and GlassfishJava EE and Glassfish
Java EE and Glassfish
 
Introduction to JPA Framework
Introduction to JPA FrameworkIntroduction to JPA Framework
Introduction to JPA Framework
 
Hibernate
HibernateHibernate
Hibernate
 
Hibernate inheritance and relational mappings with examples
Hibernate inheritance and relational mappings with examplesHibernate inheritance and relational mappings with examples
Hibernate inheritance and relational mappings with examples
 
Java beans
Java beansJava beans
Java beans
 
introduction of Java beans
introduction of Java beansintroduction of Java beans
introduction of Java beans
 
Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)Introduction to JPA (JPA version 2.0)
Introduction to JPA (JPA version 2.0)
 
Java questions with answers
Java questions with answersJava questions with answers
Java questions with answers
 
jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentation
 
Hibernate presentation
Hibernate presentationHibernate presentation
Hibernate presentation
 
Bean Intro
Bean IntroBean Intro
Bean Intro
 
Java Web Programming Using Cloud Platform: Module 3
Java Web Programming Using Cloud Platform: Module 3Java Web Programming Using Cloud Platform: Module 3
Java Web Programming Using Cloud Platform: Module 3
 

Andere mochten auch

Andere mochten auch (20)

Niit foundation m billionth 2013
Niit foundation m billionth 2013Niit foundation m billionth 2013
Niit foundation m billionth 2013
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Patient Online Programme
Patient Online ProgrammePatient Online Programme
Patient Online Programme
 
Poblacion de america
Poblacion de americaPoblacion de america
Poblacion de america
 
Resume_Steve McHenry
Resume_Steve McHenryResume_Steve McHenry
Resume_Steve McHenry
 
COC_Oracle11g Backup and Recovery Workshop_certificate
COC_Oracle11g Backup and Recovery Workshop_certificateCOC_Oracle11g Backup and Recovery Workshop_certificate
COC_Oracle11g Backup and Recovery Workshop_certificate
 
Gravidez na adolescãªncia[1]
Gravidez na adolescãªncia[1]Gravidez na adolescãªncia[1]
Gravidez na adolescãªncia[1]
 
CV August 2016
CV August  2016CV August  2016
CV August 2016
 
Html5 para Android
Html5 para AndroidHtml5 para Android
Html5 para Android
 
Solutions to Problem 5-41 (Brigham)
Solutions to Problem 5-41 (Brigham)Solutions to Problem 5-41 (Brigham)
Solutions to Problem 5-41 (Brigham)
 
Comp tia a+_session_15
Comp tia a+_session_15Comp tia a+_session_15
Comp tia a+_session_15
 
El poblamiento de américa
El poblamiento de américaEl poblamiento de américa
El poblamiento de américa
 
Terapia fisica copia
Terapia fisica   copiaTerapia fisica   copia
Terapia fisica copia
 
Niit
NiitNiit
Niit
 
Del DNA a la ingeniería genética
Del DNA a la ingeniería genéticaDel DNA a la ingeniería genética
Del DNA a la ingeniería genética
 
Case study marki M1 z Albumu Superbrands Polska 2016
Case study marki M1 z Albumu Superbrands Polska 2016 Case study marki M1 z Albumu Superbrands Polska 2016
Case study marki M1 z Albumu Superbrands Polska 2016
 
The 3 e’s of customer experience
The 3 e’s of customer experienceThe 3 e’s of customer experience
The 3 e’s of customer experience
 
Tema 1 1ºeso 2016/2017 .La Tierra.
Tema 1  1ºeso 2016/2017 .La Tierra.Tema 1  1ºeso 2016/2017 .La Tierra.
Tema 1 1ºeso 2016/2017 .La Tierra.
 
Tema3 1ºe so américa africa2017
Tema3 1ºe so américa africa2017Tema3 1ºe so américa africa2017
Tema3 1ºe so américa africa2017
 
11 Tratamientos Térmicos
11 Tratamientos Térmicos11 Tratamientos Térmicos
11 Tratamientos Térmicos
 

Ähnlich wie Dacj 4 2-c

CommercialSystemsBahman.ppt
CommercialSystemsBahman.pptCommercialSystemsBahman.ppt
CommercialSystemsBahman.pptKalsoomTahir2
 
L0043 - Interfacing to Eclipse Standard Views
L0043 - Interfacing to Eclipse Standard ViewsL0043 - Interfacing to Eclipse Standard Views
L0043 - Interfacing to Eclipse Standard ViewsTonny Madsen
 
Java Beans Unit 4(Part 1)
Java Beans Unit 4(Part 1)Java Beans Unit 4(Part 1)
Java Beans Unit 4(Part 1)SURBHI SAROHA
 
Introduction to java beans
Introduction to java beansIntroduction to java beans
Introduction to java beansHitesh Parmar
 
13 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_1913 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_19Niit Care
 
06 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_0806 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_08Niit Care
 
WEB PROGRAMMING UNIT IV NOTES BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT IV NOTES BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT IV NOTES BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT IV NOTES BY BHAVSINGH MALOTHBhavsingh Maloth
 
Bytecode manipulation with Javassist for fun and profit
Bytecode manipulation with Javassist for fun and profitBytecode manipulation with Javassist for fun and profit
Bytecode manipulation with Javassist for fun and profitJérôme Kehrli
 
Effective Java. By materials of Josch Bloch's book
Effective Java. By materials of Josch Bloch's bookEffective Java. By materials of Josch Bloch's book
Effective Java. By materials of Josch Bloch's bookRoman Tsypuk
 
Vb.net session 03
Vb.net session 03Vb.net session 03
Vb.net session 03Niit Care
 
Joel Landis Net Portfolio
Joel Landis Net PortfolioJoel Landis Net Portfolio
Joel Landis Net Portfoliojlshare
 
Java session01
Java session01Java session01
Java session01Niit Care
 

Ähnlich wie Dacj 4 2-c (20)

CommercialSystemsBahman.ppt
CommercialSystemsBahman.pptCommercialSystemsBahman.ppt
CommercialSystemsBahman.ppt
 
L0043 - Interfacing to Eclipse Standard Views
L0043 - Interfacing to Eclipse Standard ViewsL0043 - Interfacing to Eclipse Standard Views
L0043 - Interfacing to Eclipse Standard Views
 
Java Beans Unit 4(Part 1)
Java Beans Unit 4(Part 1)Java Beans Unit 4(Part 1)
Java Beans Unit 4(Part 1)
 
Java beans
Java beansJava beans
Java beans
 
Introduction to java beans
Introduction to java beansIntroduction to java beans
Introduction to java beans
 
13 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_1913 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_19
 
Java beans
Java beansJava beans
Java beans
 
Unit iv
Unit ivUnit iv
Unit iv
 
Deployment
DeploymentDeployment
Deployment
 
06 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_0806 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_08
 
WEB PROGRAMMING UNIT IV NOTES BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT IV NOTES BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT IV NOTES BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT IV NOTES BY BHAVSINGH MALOTH
 
Bytecode manipulation with Javassist for fun and profit
Bytecode manipulation with Javassist for fun and profitBytecode manipulation with Javassist for fun and profit
Bytecode manipulation with Javassist for fun and profit
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Effective Java. By materials of Josch Bloch's book
Effective Java. By materials of Josch Bloch's bookEffective Java. By materials of Josch Bloch's book
Effective Java. By materials of Josch Bloch's book
 
Vb.net session 03
Vb.net session 03Vb.net session 03
Vb.net session 03
 
CiIC4010-chapter-2-f17
CiIC4010-chapter-2-f17CiIC4010-chapter-2-f17
CiIC4010-chapter-2-f17
 
Building richwebapplicationsusingasp
Building richwebapplicationsusingaspBuilding richwebapplicationsusingasp
Building richwebapplicationsusingasp
 
Joel Landis Net Portfolio
Joel Landis Net PortfolioJoel Landis Net Portfolio
Joel Landis Net Portfolio
 
Java session01
Java session01Java session01
Java session01
 
Java beans
Java beansJava beans
Java beans
 

Mehr von Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 
Dacj 1-3 b
Dacj 1-3 bDacj 1-3 b
Dacj 1-3 b
 
Dacj 1-3 a
Dacj 1-3 aDacj 1-3 a
Dacj 1-3 a
 
Dacj 1-2 c
Dacj 1-2 cDacj 1-2 c
Dacj 1-2 c
 
Dacj 1-2 a
Dacj 1-2 aDacj 1-2 a
Dacj 1-2 a
 
Dacj 1-1 c
Dacj 1-1 cDacj 1-1 c
Dacj 1-1 c
 
Dacj 1-1 b
Dacj 1-1 bDacj 1-1 b
Dacj 1-1 b
 

Kürzlich hochgeladen

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Kürzlich hochgeladen (20)

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Dacj 4 2-c

  • 1. Collaborate Knowledge Byte In this section, you will learn about: • Property Sheets and Property Editor • The PropertyEditorSupport and PropertyDescriptor Class • The BeanInfo Interface ©NIIT Collaborate Lesson 2C / Slide 1 of 23
  • 2. Collaborate Property Sheets and Property Editor • Property sheets and property editors enable easy access to the exposed JavaBean properties. • Property sheet or the Properties window of BDK displays a list of all the exposed properties of a JavaBean. • A property editor window is used to edit the values of JavaBean properties, which cannot be edited in property sheets. • The property editor is always associated with a specific JavaBean property. • The property editor is displayed whenever an attempt is made to modify the value of the associated JavaBean property during the build phase. ©NIIT Collaborate Lesson 2C / Slide 2 of 23
  • 3. Collaborate The PropertyEditorSupport and PropertyDescriptor Class • The PropertyEditorSupport Class: • Enables you to create a text-based or a GUI based customized property editor. • Implements the PropertyEditor interface of the java.beans package. • Is extended by a class to create a customized property editor. ©NIIT Collaborate Lesson 2C / Slide 3 of 23
  • 4. Collaborate The PropertyEditorSupport and PropertyDescriptor Class (Contd.) • The following table lists some methods of the PropertyEditorSupport Class: Method Description void addPropertyChangeListener( Registers a new PropertyChangeListener pcl) PropertyChangeListener to handle the PropertyChange events. The method accepts an object of PropertyChangeListener interface. void firePropertyChange() Informs all the listeners when there is a change in the JavaBean property. ©NIIT Collaborate Lesson 2C / Slide 4 of 23
  • 5. Collaborate The PropertyEditorSupport and PropertyDescriptor Class (Contd.) • The methods of PropertyEditorSupport class: (Contd.) Method Description void paintValue(Graphics g, Paints a graphics object in a rectangle on the Rectangle rec) screen area. The graphics to paint and the area in which the graphics is painted are passed as parameters to the paintValue() method. boolean isPaintable() Returns a boolean value that specifies if the JavaBean supports the paintValue() method. void Removes a registered PropertyChangeListener removePropertyChangeListener( from the list of listeners for the PropertyChange PropertyChangeListener plist) events. ©NIIT Collaborate Lesson 2C / Slide 5 of 23
  • 6. Collaborate The PropertyEditorSupport and PropertyDescriptor Class (Contd.) • The methods of PropertyEditorSupport class: (Contd.) Method Description boolean Returns a boolean value that determines whether the supportsCustomEditor() property editor object supports the custom editor or not. String getAsText() Returns the string value of a JavaBean property. Component Returns a custom property editor as a component that getCustomEditor() enables you to edit the value of JavaBean properties. void setAsText(String Sets the value of a property to the string passed as a text) parameter to this method. ©NIIT Collaborate Lesson 2C / Slide 6 of 23
  • 7. Collaborate The PropertyEditorSupport and PropertyDescriptor Class (Contd.) • The methods of PropertyEditorSupport class: (Contd.) Method Description String[] getTags() Returns an array of tag values that consists of all the possible values for a JavaBean property. void setValue(Object value) Sets the value of a JavaBean property to the value passed as parameter. Object getValue() Enables you to retrieve the value of a JavaBean property. ©NIIT Collaborate Lesson 2C / Slide 7 of 23
  • 8. Collaborate The PropertyEditorSupport and PropertyDescriptor Class (Contd.) • The PropertyDescriptor Class • The PropertyDescriptor Class restricts the JavaBean properties that are displayed in the Properties window. • To create customized properties window, you need to create an information class that contains information about the properties, events, and methods of a JavaBean. • The information class extends the SimpleBeanInfo class and have a name ending with BeanInfo. For example, class PropBeanInfo extends SimpleBeanInfo { //Class body } ©NIIT Collaborate Lesson 2C / Slide 8 of 23
  • 9. Collaborate The PropertyEditorSupport and PropertyDescriptor Class (Contd.) • You also need to override the getPropertyDescriptors() method that returns an array of PropertyDescriptor objects in the PropBeanInfo class. For example, public PropertyDescriptor[] getPropertyDescriptors() { //Method_body } ©NIIT Collaborate Lesson 2C / Slide 9 of 23
  • 10. Collaborate The BeanInfo Interface • The BeanInfo interface provides the methods that enable you to specify and retrieve the information about a JavaBean. • The following table lists some of the methods of BeanInfo interface: Method Description MethodDescriptor[] Returns an array of the method descriptor objects getMethodDescriptors( of a JavaBean. The method descriptor objects are ) used to determine information about the various methods defined in a JavaBean. EventDescriptor[] Returns an array of the event descriptor objects of getEventDescriptors() a JavaBean. The event descriptor objects determine the information about the events associated with a JavaBean. ©NIIT Collaborate Lesson 2C / Slide 10 of 23
  • 11. Collaborate The BeanInfo Interface(Contd.) • The methods of BeanInfo interface: (Contd.) Method Description PropertyDescriptor[] Returns an array of the property descriptor objects getPropertyDescriptor of a JavaBean. The property descriptor objects are s() used to determine information about the various custom properties of a JavaBean. Image getIcon( int Returns a corresponding image object for one of icon_type ) the fields of the BeanInfo interface passed as a parameter to this method. The BeanInfo interface defines int fields, such as ICON_COLOR_32x32 and ICON_MONO_32x32 to represent icons. ©NIIT Collaborate Lesson 2C / Slide 11 of 23
  • 12. Collaborate From the Expert’s Desk In this section, you will learn: • Tips on: • Using the sample JavaBeans of BDK1.1 in Java 2 SDKv1.4.x • Creating a single manifest file that contains entries for multiple JavaBeans • FAQs on JavaBeans ©NIIT Collaborate Lesson 2C / Slide 12 of 23
  • 13. Collaborate Tips Using the Sample JavaBeans of BDK1.1 in Java 2 SDK v 1.4.x • The steps to use the sample JavaBeans of BDK in Java 2 SDK 1.4.x are: • Open the C:BDK1.1beansdemosunwdemobuttons folder using the Windows Explorer. • Open the folder for the sample JavaBean, for example, open the folder for ExplicitButton JavaBean that is not supported by Java 2 SDK 1.4.x. ©NIIT Collaborate Lesson 2C / Slide 13 of 23
  • 14. Collaborate Tips Using the Sample JavaBeans of BDK1.1 in Java 2 SDK v 1.4.x (Contd.) • Change the code in the public EventSetDescriptor[] getEventSetDescriptors() method. For example, to load the ExplicitButton JavaBean, you need to change the following code: EventSetDescriptor push = new EventSetDescriptor(beanClass, "actionPerformed", java.awt.event.ActionListener.class, "actionPerformed"); The preceding code should be changed to the following code: EventSetDescriptor push = new EventSetDescriptor(beanClass, "action", java.awt.event.ActionListener.class, "actionPerformed"); ©NIIT Collaborate Lesson 2C / Slide 14 of 23
  • 15. Collaborate Tips Using the Sample JavaBeans of BDK1.1 in Java 2 SDK v 1.4.x (Contd.) • Compile all files of C:BDK1.1beansdemosunwdemobuttons directory. • Download Microsoft nmake utility to the C:BDK1.1beansbeanbox directory from the following url: ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe • Add the C:BDK1.1beansbeanbox directory path to your system path. • Go to C:BDK1.1beansdemo and type: nmake buttons.mk 7. Run BDK. The ExplicitButton JavaBean will get loaded in the BDK. ©NIIT Collaborate Lesson 2C / Slide 15 of 23
  • 16. Collaborate Tips Creating Manifest File for Multiple JavaBeans • The syntax to define the entries for multiple JavaBean files in the same manifest file is: Name: <beanFile1.class> Java-Bean: <status> Name: <beanFile2.class> Java-Bean: <status> Name: <file3.gif> In the preceding syntax, a blank line is left between each of the file declarations. ©NIIT Collaborate Lesson 2C / Slide 16 of 23
  • 17. Collaborate FAQs • What type of JavaBean will you use to display the current time in an application? You can display the current time in a Java application using a control JavaBean. The control JavaBean adds a new feature to an existing Java application. • How can you count the number of hits for a particular Web page using JavaBeans? You can count the number of hits for a Web page using an invisible runtime JavaBean. This JavaBean performs a hidden background function. ©NIIT Collaborate Lesson 2C / Slide 17 of 23
  • 18. Collaborate FAQs (Contd.) • How would you change the foreground color of a component using JavaBeans? The foreground color of a component can be changed using the JavaBean properties. You need to create a JavaBean for the component and define a property, foreground color for the component. The setForegroundColor() method for the JavaBean property can be used to specify and change the value of the foreground color for the JavaBean component. ©NIIT Collaborate Lesson 2C / Slide 18 of 23
  • 19. Collaborate FAQs (Contd.) • What is introspection? Introspection is the process of examining the class structure of a JavaBean and determining the properties, methods, and events supported by the JavaBean. Introspection helps you to find only the list of methods and the method signatures of a JavaBean. It does not help you to find the source code of the methods and how the JavaBean functionality has been implemented. The introspection technique is used by a programmer during the design and build phases to identify the JavaBean functionality. The end user will not be interested in knowing the internal functionalities of a JavaBean. ©NIIT Collaborate Lesson 2C / Slide 19 of 23
  • 20. Collaborate FAQs (Contd.) • Where is the manifest file of a JavaBean stored in the JAR file? The manifest file is stored inside the directory, META-INF inside the JAR file. • How does the compiler recognize the file to execute while running a JAR file? When a JAR file is executed, the Main-Class entry in the manifest file instructs the java -jar command about the class to execute. The java -jar command enables you to execute a runnable JAR file on the command prompt. The -jar option enables the Java Runtime Environment (JRE) to recognize that the specified file is a runnable JAR file. The command to execute a runnable JAR file, SampleJar.jar, on the command prompt is: java -jar SampleJar.jar ©NIIT Collaborate Lesson 2C / Slide 20 of 23
  • 21. Collaborate Challenge 1. Select the option that allows you to view the sequence of method invocation in BDK 1.1: a. ToolBox Window b. BeanBox Window c. Method Tracer Window d. Properties Window • What is the use of the addPropertyChangeListener() method of the PropertyEditorSupport class? • Select the class that you need to use for implementing bound properties in JavaBeans: • PropertyChangeSupport class • VetobaleChangeSupport class • ProperyChangeEvent class • PropertyDescriptor class ©NIIT Collaborate Lesson 2C / Slide 21 of 23
  • 22. Collaborate Challenge (Contd.) • The PropertyEditorSupport class implements the __________interface. • What is the purpose of implementing the BeanInfo interface for a JavaBean? • The ___________enables you to modify the JavaBean properties that are displayed in the property sheet. ©NIIT Collaborate Lesson 2C / Slide 22 of 23
  • 23. Collaborate Solutions to Challenge • c. Method Tracer Window • The addPropertyChangeListener() method registers a new listener to handle the PropertyChange events. • a. PropertyChangeSupport class • PropertyEditor • The BeanInfo interface enables you to provide the information about the properties, events, and methods of a JavaBean in the JavaBean information class. • Property Editors ©NIIT Collaborate Lesson 2C / Slide 23 of 23