sFTP Secure FTP Hosting Web Hosting, web hosting, JSP, Servlets, Tomcat, website hosting, web site hosting
Web Hosting, web hosting, JSP, Servlets, Tomcat, website hosting, web site hosting
Web Hosting, web hosting, JSP, Servlets, Tomcat, website hosting, web site hosting

Alden Hosting provides professional, efficient, and reliable business-class Web hosting services to small- and medium-sized businesses.

WWW.

Call Us Toll-Free
(877) 256-0328

Outside USA
1 - (201) 505-0430

sFTP Secure FTP Hosting Welcome sFTP Secure FTP Hosting Web Hosting Plans Overview , Fund Raising, Fundraising, web hosting, website hosting, web site hosting sFTP Secure FTP Hosting Fund Raising, Fundraising, web hosting sFTP Secure FTP Hosting Resellers, web Hosting sFTP Secure FTP Hosting Web Design, web Hosting sFTP Secure FTP Hosting Extra Services,  web Hosting sFTP Secure FTP Hosting Traffic Booster, web hosting sFTP Secure FTP Hosting Traffic Booster, web hosting sFTP Secure FTP Hosting Technical Support,  web Hosting sFTP Secure FTP Hosting webmaster tips,  web Hosting sFTP Secure FTP Hosting 30 Day Money Back, web hosting sFTP Secure FTP Hosting Legal Notices for Web Hosting sFTP Secure FTP Hosting Glossary Computer Terms for web Hosting sFTP Secure FTP Hosting Contact Information - web hosting

Site Map

  sFTP Secure FTP Hosting Web Hosting Sign-Up   sFTP Secure FTP Hosting Fund Raising, Fundraising, web hosting, website hosting, web site hosting    sFTP Secure FTP Hosting Resellers web hosting, website hosting, web site hosting   sFTP Secure FTP Hosting EZ Site Control Panel for web hosting,website hosting, web site hosting

Secure FTP (sFTP) Hosting

Alden Hosting offers Secure FTP (sFTP) on our WEB 5 PLAN and our WEB 6 PLAN .

At Alden Hosting we eat and breathe Secure FTP (sFTP)! We are the industry leader in providing affordable, quality and efficient Secure FTP (sFTP) hosting in the shared hosting marketplace.


Bound Properties (The Java™ Tutorials > JavaBeans(TM) > Properties)
Trail: JavaBeans(TM)
Lesson: Properties
Home Page > JavaBeans(TM) > Properties
Bound Properties

Bound properties support the PropertyChangeListener (in the API reference documentation) class.

Sometimes when a Bean property changes, another object might need to be notified of the change, and react to the change.

Whenever a bound property changes, notification of the change is sent to interested listeners.

The accessor methods for a bound property are defined in the same way as those for simple properties. However, you also need to provide the event listener registration methods forPropertyChangeListener classes and fire a PropertyChangeEvent (in the API reference documentation) event to the PropertyChangeListener objects by calling their propertyChange methods

The convenience PropertyChangeSupport (in the API reference documentation) class enables your bean to implement these methods. Your bean can inherit changes from the PropertyChangeSupportclass, or use it as an inner class.

In order to listen for property changes, an object must be able to add and remove itself from the listener list on the bean containing the bound property. It must also be able to respond to the event notification method that signals a property change.

The PropertyChangeEvent class encapsulates property change information, and is sent from the property change event source to each object in the property change listener list with the propertyChange method.

Implementing Bound Property Support Within a Bean

To implement a bound property in your application, follow these steps:

  1. Import the java.beans package. This gives you access to the PropertyChangeSupport class.
  2. Instantiate a PropertyChangeSupport object. This object maintains the property change listener list and fires property change events. You can also make your class a PropertyChangeSupport subclass.
  3. Implement methods to maintain the property change listener list. Since a PropertyChangeSupport subclass implements these methods, you merely wrap calls to the property-change support object's methods.
  4. Modify a property's set method to fire a property change event when the property is changed.

Creating a Bound Property

To create the title property as a bound property for the MyBean component in the NetBeans GUI Builder, perform the following sequence of operations:
  1. Right-click the Bean Patterns node in the MyBean class hierarchy.
  2. Select Add|Property from the pop-up menu.
  3. Fill the New Property Pattern form as shown on the following figure and click OK.

    Creating a bound property.

  4. Note that the title property and the multicast event source pattern PropertyChangeListener were added to the Bean Patterns structure.

You can also modify existing code generated in the previous lesson to convert the title and lines properties to the bound type as follows (where newly added code is shown in bold):

import java.awt.Graphics;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.swing.JComponent;

/**
 * Bean with bound properties.
 */
public class MyBean
        extends JComponent
        implements Serializable
{
    private String title;
    private String[] lines = new String[10];

    private final PropertyChangeSupport pcs = new PropertyChangeSupport( this );

    public String getTitle()
    {
        return this.title;
    }

    public void setTitle( String title )
    {
        String old = this.title;
        this.title = title;
        this.pcs.firePropertyChange( "title", old, title );
    }

    public String[] getLines()
    {
        return this.lines.clone();
    }

    public String getLines( int index )
    {
        return this.lines[index];
    }

    public void setLines( String[] lines )
    {
        String[] old = this.lines;
        this.lines = lines;
        this.pcs.firePropertyChange( "lines", old, lines );
    }

    public void setLines( int index, String line )
    {
        String old = this.lines[index];
        this.lines[index] = line;
        this.pcs.fireIndexedPropertyChange( "lines", index, old, lines );
    }

    public void addPropertyChangeListener( PropertyChangeListener listener )
    {
        this.pcs.addPropertyChangeListener( listener );
    }

    public void removePropertyChangeListener( PropertyChangeListener listener )
    {
        this.pcs.removePropertyChangeListener( listener );
    }

    protected void paintComponent( Graphics g )
    {
        g.setColor( getForeground() );

        int height = g.getFontMetrics().getHeight();
        paintString( g, this.title, height );

        if ( this.lines != null )
        {
            int step = height;
            for ( String line : this.lines )
                paintString( g, line, height += step );
        }
    }

    private void paintString( Graphics g, String str, int height )
    {
        if ( str != null )
            g.drawString( str, 0, height );
    }
}

Previous page: Simple Properties
Next page: Constrained Properties

Secure FTP (sFTP) Hosting

Alden Hosting offers Secure FTP (sFTP) on our WEB 5 PLAN and our WEB 6 PLAN .

At Alden Hosting we eat and breathe Secure FTP (sFTP)! We are the industry leader in providing affordable, quality and efficient Secure FTP (sFTP) hosting in the shared hosting marketplace.


Web Hosting, web hosting, JSP, Servlets, Tomcat, website hosting, web site hosting
Add to My Yahoo!

XML icon

Add to Google

 

 

 

 

 

 

 

 

 

 

 

http://alden-servlet-Hosting.com
JSP at alden-servlet-Hosting.com
Servlets at alden-servlet-Hosting.com
Servlet at alden-servlet-Hosting.com
Tomcat at alden-servlet-Hosting.com
MySQL at alden-servlet-Hosting.com
Java at alden-servlet-Hosting.com
sFTP at alden-servlet-Hosting.com
http://alden-tomcat-Hosting.com
JSP at alden-tomcat-Hosting.com
Servlets at alden-tomcat-Hosting.com
Servlet at alden-tomcat-Hosting.com
Tomcat at alden-tomcat-Hosting.com
MySQL at alden-tomcat-Hosting.com
Java at alden-tomcat-Hosting.com
sFTP at alden-tomcat-Hosting.com
http://alden-sftp-Hosting.com
JSP at alden-sftp-Hosting.com
Servlets at alden-sftp-Hosting.com
Servlet at alden-sftp-Hosting.com
Tomcat at alden-sftp-Hosting.com
MySQL at alden-sftp-Hosting.com
Java at alden-sftp-Hosting.com
sFTP at alden-sftp-Hosting.com
http://alden-jsp-Hosting.com
JSP at alden-jsp-Hosting.com
Servlets at alden-jsp-Hosting.com
Servlet at alden-jsp-Hosting.com
Tomcat at alden-jsp-Hosting.com
MySQL at alden-jsp-Hosting.com
Java at alden-jsp-Hosting.com
sFTP at alden-jsp-Hosting.com
http://alden-java-Hosting.com
JSp at alden-java-Hosting.com
Servlets at alden-java-Hosting.com
Servlet at alden-java-Hosting.com
Tomcat at alden-java-Hosting.com
MySQL at alden-java-Hosting.com
Java at alden-java-Hosting.com
sFTP at alden-java-Hosting.com
JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP Servlets Tomcat mysql Java JSP at JSP.aldenWEBhosting.com Servlets at servlets.aldenWEBhosting.com Tomcat at Tomcat.aldenWEBhosting.com mysql at mysql.aldenWEBhosting.com Java at Java.aldenWEBhosting.com Web Hosts Portal Web Links Web Links Web Hosting JSP Solutions Web Links JSP Solutions Web Hosting Servlets Solutions Web Links Servlets Solutions Web Hosting Web Links Web Links . .
.
.
. .
. . . . jsp hosting servlets hosting web hosting web sites designed cheap web hosting web site hosting myspace web hosting