Java Code Examples for javax.swing.JComponent.setLocation()

The following are Jave code examples for showing how to use setLocation() of the javax.swing.JComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Pogamut3   File: MVTimelineElement.java   Source Code and License Vote up 5 votes
/** when end time is changed, update time axis and if necessary, move
 * viewport at the end.
 */
@Override
public void endTimeChanged(long previousEndTime, long endTime) {
    scene.setTimeAxisLength(database.getElapsedTime());

    // FIXME: if we are at the end and
    int panelWidth = MVTimelineElement.this.getWidth();
    JComponent view = scene.getView();
    if (view.getWidth() > panelWidth) {
        if (view.getX() + view.getWidth() - panelWidth < 10) {
            view.setLocation(-(view.getWidth() - panelWidth), view.getY());
        }
    }
}