本文整理汇总了Java中org.pushingpixels.trident.Timeline.addCallback方法的典型用法代码示例。如果您正苦于以下问题:Java Timeline.addCallback方法的具体用法?Java Timeline.addCallback怎么用?Java Timeline.addCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pushingpixels.trident.Timeline
的用法示例。
在下文中一共展示了Timeline.addCallback方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fadeOutAndEnd
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
/**
* @param window
* @param fadeOutDuration
*/
private static void fadeOutAndEnd(final Window window, int fadeOutDuration,
final boolean exit) {
Timeline dispose = new Timeline(new WindowFader(window));
dispose.addPropertyToInterpolate("opacity", 1.0f,
// AWTUtilitiesWrapper.getWindowOpacity(window),
0.0f);
dispose.addCallback(new UIThreadTimelineCallbackAdapter() {
@Override
public void onTimelineStateChanged(TimelineState oldState,
TimelineState newState, float durationFraction,
float timelinePosition) {
if (newState == TimelineState.DONE) {
if (exit) {
Runtime.getRuntime().exit(0);
} else {
window.dispose();
}
}
}
});
dispose.setDuration(fadeOutDuration);
dispose.play();
}
示例2: fadeOutAndEnd
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
/**
* @param window
* @param fadeOutDuration
*/
private static void fadeOutAndEnd(final Window window, int fadeOutDuration,
final boolean exit) {
Timeline dispose = new Timeline(new WindowFader(window));
dispose.addPropertyToInterpolate("opacity", 1.0f,
// AWTUtilitiesWrapper.getWindowOpacity(window),
0.0f);
dispose.addCallback(new UIThreadTimelineCallbackAdapter() {
@Override
public void onTimelineStateChanged(TimelineState oldState,
TimelineState newState, float durationFraction,
float timelinePosition) {
if (newState == TimelineState.DONE) {
if (exit) {
Runtime.getRuntime().exit(0);
} else {
window.dispose();
}
}
}
});
dispose.setDuration(fadeOutDuration);
dispose.play();
}
示例3: configure
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
/**
* Configures the achievement.
*/
private void configure() {
// create a new achievement
if(view == null) {
window = new AchievementWindow(title, description, config);
} else {
window = new AchievementWindow(context, view, config);
}
// set the window height and width
config.setWindowHeight(window.getHeight());
config.setWindowWidth(window.getWidth());
// create the three timelines
timelineIntro = new Timeline(window);
timelineStay = new Timeline(window);
timelineAway = new Timeline(window);
// configure the intro animation, when the window enters
timelineIntro.addPropertyToInterpolate("position",
config.getInitialCoordinates(), config.getFinalCoordinates());
timelineIntro.addCallback(new AudioCallback(this, timelineStay));
timelineIntro.setDuration(config.getInDuration());
// configure the time the window should wait in the screen
timelineStay.setDuration(config.getDuration());
timelineStay.addCallback(new SimpleCallback(timelineAway));
// configure the end animation, when the window goes away
timelineAway.addPropertyToInterpolate("position",
config.getFinalCoordinates(), config.getInitialCoordinates());
timelineAway.setDuration(config.getOutDuration());
timelineAway.addCallback(new EndCallback(window));
}
示例4: done
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
@Override
protected void done() {
final LoginDialog dialog = LoginDialog.getInstance();
if ( !loginResult ) {
dialog.getResultLabel().setText("登陆失败");
dialog.getOKButton().setEnabled(true);
dialog.getOKButton().setText("确定");
} else {
ConfigManager.saveConfigKeyValue(ConfigKey.adminUsername, username);
ConfigManager.saveConfigKeyValue(ConfigKey.adminPassword, password);
ConfigManager.saveConfigKeyValue(ConfigKey.adminDatabaseServer, mongoServer);
Point to = dialog.getLocation();
to.y = MainFrame.screenHeight;
Timeline timeline = MyWindowUtil.createLocationTimeline(dialog, to, 200);
timeline.addCallback(new TimelineCallbackAdapter() {
/* (non-Javadoc)
* @see org.pushingpixels.trident.callback.TimelineCallbackAdapter#onTimelineStateChanged(org.pushingpixels.trident.Timeline.TimelineState, org.pushingpixels.trident.Timeline.TimelineState, float, float)
*/
@Override
public void onTimelineStateChanged(TimelineState oldState,
TimelineState newState, float durationFraction,
float timelinePosition) {
if ( newState == TimelineState.DONE ) {
dialog.dispose();
}
}
});
timeline.play();
}
}
示例5: doDropAnimation
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
private void doDropAnimation() {
dropTimeline = new Timeline(this);
dropTimeline.addCallback(this);
dropTimeline.addPropertyToInterpolate("ImageScale", 6f, 1f);
dropTimeline.setDuration(500);
dropTimeline.play();
}
示例6: getShrinkTimeline
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
private Timeline getShrinkTimeline() {
final Timeline timeline = new Timeline(this);
timeline.addPropertyToInterpolate("ShrinkRectangle", getPreviewRectangle(), getEnd());
timeline.setDuration(SHRINK_DURATION);
timeline.setEase(new Spline(0.8f));
timeline.addCallback(new TimelineCallbackAdapter() {
@Override
public void onTimelineStateChanged(Timeline.TimelineState oldState, Timeline.TimelineState newState, float durationFraction, float timelinePosition) {
if (newState == Timeline.TimelineState.DONE) {
scenario.cancel();
}
}
});
return timeline;
}
示例7: getViewTimeline
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
private Timeline getViewTimeline() {
final Timeline timeline = new Timeline();
timeline.setDuration(getViewDuration());
timeline.addCallback(new TimelineCallbackAdapter() {
@Override
public void onTimelineStateChanged(Timeline.TimelineState oldState, Timeline.TimelineState newState, float durationFraction, float timelinePosition) {
if (newState == Timeline.TimelineState.PLAYING_FORWARD) {
// ensures arrow is painted correctly.
getCanvas().repaint();
}
}
});
return timeline;
}
示例8: trackTabModification
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
private void trackTabModification(int tabIndex, Component tabComponent) {
Timeline modifiedTimeline = new Timeline(tabPane);
AnimationConfigurationManager.getInstance().configureModifiedTimeline(
modifiedTimeline);
modifiedTimeline.addCallback(new TabRepaintCallback(tabPane, tabIndex));
modifiedTimeline.playLoop(RepeatBehavior.REVERSE);
modifiedTimelines.put(tabComponent, modifiedTimeline);
}
示例9: nextCall
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
private void nextCall(){
if( isBusy || queue.isEmpty() )
return;
synchronized( notifs ){
if( notifs.size() >= CAPACITY )
return;
}
isBusy = true;
final JHolla n = queue.poll();
if( !n.hasBeenBuilt() )
n.build();
//n.setLocation(new Point(screenDimension.width - n.getPreferredSize().width - 10, screenDimension.height));
if( alignment == Alignment.LEFT )
n.setLocation(new Point(insetsLeft + 20, screenDimension.height));
else
n.setLocation(new Point(screenDimension.width - n.getPreferredSize().width - insetsRight - 20, screenDimension.height));
n.setVisible(true);
SwingUtilities.invokeLater(new Runnable(){
public void run(){
n.pack();
n.revalidate();
n.repaint();
((BorderLayout) n.getContentPane().getLayout()).invalidateLayout(n.getContentPane());
n.pack();
}
});
Timeline t = new Timeline(n);
t.setDuration(500);
t.addPropertyToInterpolate("location", n.getLocation(), new Point(n.getLocation().x, screenDimension.height - n.getHeight() - 10));
t.addCallback(new TimelineCallbackAdapter() {
@Override
public void onTimelineStateChanged(TimelineState state1, TimelineState state2,
float arg2, float arg3) {
if( state2 == TimelineState.DONE ){
n.setAsFullyVisible();
notifs.add(n);
executor.execute(n);//start timeout thread
repaint();
isBusy = false;
SwingUtilities.invokeLater(new Runnable(){
public void run(){
nextCall();
}
});
}
}
});
t.play();
}
示例10: removeNotification
import org.pushingpixels.trident.Timeline; //导入方法依赖的package包/类
public void removeNotification(final JHolla n){
synchronized( queue ){
if( queue.contains(n) ){
queue.remove();
return;
}
}
synchronized( queue ){
if( !notifs.contains(n) )
return;
}
Timeline t = new Timeline(n);
t.setDuration(500);
//t.addPropertyToInterpolate("opacity", n.getOpacity(), 0.0f);
t.addPropertyToInterpolate("location", n.getLocation(), new Point(n.getLocation().x, screenDimension.height));
t.addCallback(new TimelineCallbackAdapter() {
@Override
public void onTimelineStateChanged(TimelineState state1, TimelineState state2,
float arg2, float arg3) {
if( state2 == TimelineState.DONE ){
JHolla.JHollaListener[] listeners = n.getListeners();
n.setVisible(false);
n.dispose();
notifs.remove(n);
for( int i = 0 ; i < listeners.length; i++ )
listeners[i].removed();
repaint();
SwingUtilities.invokeLater(new Runnable(){
public void run(){
nextCall();
}
});
}
}
});
t.play();
}