Archive for the 'Code' Category

KineticScrolling component is open sourced

This is the first release of the KineticScrolling component (version 0.1), we hope you  find it useful. If you find bugs or if you need help to make it work please feel free to mail us.

To get started you need feedjii.jar, which you’ll find under downloads, and the timingframework which you’ll find here.

feedjii-source.jar contains the source code, the java doc is not completely up to date yet.

This is an example of how easy it is to use:

JPanel panel = new JPanel();

// populate the panel with child elements

JKineticScrolling scrolling = new JKineticScrolling(panel, JKineticScrolling.Direction.VERTICAL);
scrolling.setAnimationTime(1300);
scrolling.setSpeed(0.5f);

frame.add(scrolling);

Enjoy!

KineticScrolling – Open Source

If you have seen our application Feedjii then you might know that we have a component that we call KineticScrolling (actually Apple is calling this type of behaviour KineticScrolling and we reused the same name). Well it’s time to show the implementation details and open source it but before we do it we want to go through the API to make sure nothing is missing. So here it is, if you feel something is missing feel free to comment.

public class JKineticScrolling {

	/**
	* Enumeration describing the direction of the scrolling component.
	*/
	public enum Direction { HORIZONTAL, VERTICAL, ANY };

	/**
	* Constructs a new KineticScrolling instance that uses Direction.VERTICAL
	* as scroll direction.
	*
	* @param componentToScroll component to scroll.
	*/
	public JKineticScrolling( JComponent componentToScroll );

	/**
	* Constructs a new KineticScrolling instance that uses Direction.VERTICAL
	* as scroll direction.
	*
	* @param componentToScroll component to scroll.
	* @param direction direction to scroll.
	*/
	public JKineticScrolling( JComponent componentToScroll, Direction direction);

	/**
	* Sets the animation time used to "throw" the component
	* after the user releases the mouse button.
	*
	* @param animationTime time used to animate the "thow".
	*/
	public void setAnimationTime(int animationTime);

}

So it’s really simple, all you have to do is create a new JKineticScrolling component, specifiy your component in the constructor and optionally change direction and animation time.

Next post contains a runnable example.