org.pushingpixels.trident.callback.TimelineCallbackAdapter Java Examples
The following examples show how to use
org.pushingpixels.trident.callback.TimelineCallbackAdapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdrCapturePanel.java From MercuryTrade with MIT License | 6 votes |
@Override public void onViewInit() { this.setLayout(new GridLayout(1, 1)); this.setPreferredSize(this.descriptor.getSize()); this.captureLabel = new JLabel(); this.setBackground(AppThemeColor.ADR_CAPTURE_BG); this.setBorder(BorderFactory.createLineBorder(AppThemeColor.BORDER, 1)); this.progressTl = new Timeline(this); this.progressTl.addPropertyToInterpolate("captureCount", 0, this.descriptor.getFps()); this.captureLabel.setIcon(new ImageIcon(Scalr.resize(getCapture(), descriptor.getSize().width, descriptor.getSize().height))); this.progressTl.addCallback(new TimelineCallbackAdapter() { @Override public void onTimelineStateChanged(Timeline.TimelineState oldState, Timeline.TimelineState newState, float durationFraction, float timelinePosition) { captureLabel.setIcon(new ImageIcon(Scalr.resize(getCapture(), descriptor.getSize().width, descriptor.getSize().height))); } }); this.progressTl.setDuration(1000 / this.descriptor.getFps()); this.add(this.captureLabel); MercuryStoreUI.adrRepaintSubject.onNext(true); }
Example #2
Source File: AdrDurationCellPanel.java From MercuryTrade with MIT License | 6 votes |
@Override public void onViewInit() { this.setLayout(new GridLayout(1, 1)); this.setPreferredSize(this.descriptor.getSize()); this.tracker = new MercuryTracker(this.descriptor); this.add(this.tracker); this.tracker.addTimelineCallback(new TimelineCallbackAdapter() { @Override public void onTimelineStateChanged(Timeline.TimelineState oldState, Timeline.TimelineState newState, float durationFraction, float timelinePosition) { if (newState.equals(Timeline.TimelineState.IDLE) && !inSettings) { if (!descriptor.isAlwaysVisible()) { setVisible(false); } else { tracker.setStringPainted(!descriptor.isAlwaysVisible()); tracker.setMaskPainted(!descriptor.isAlwaysVisible()); } MercuryStoreUI.adrRepaintSubject.onNext(true); } else if (newState.equals(Timeline.TimelineState.PLAYING_FORWARD)) { setVisible(true); JFrame parent = (JFrame) SwingUtilities.getWindowAncestor(AdrDurationCellPanel.this); parent.pack(); } } }); MercuryStoreUI.adrRepaintSubject.onNext(true); }
Example #3
Source File: MercuryLoading.java From MercuryTrade with MIT License | 6 votes |
public MercuryLoading() { this.setValue(0); this.setMaximum(3000); this.setForeground(AppThemeColor.TEXT_NICKNAME); this.setBackground(AppThemeColor.ADR_FOOTER_BG); this.setUI(new MercuryLoadingUi(this)); this.progressTl = new Timeline(this); this.progressTl.setDuration(2400); this.progressTl.addPropertyToInterpolate("value", this.getMaximum(), 0); this.progressTl.setEase(new Spline(1)); this.progressTl.addCallback(new TimelineCallbackAdapter() { @Override public void onTimelineStateChanged(Timeline.TimelineState oldState, Timeline.TimelineState newState, float durationFraction, float timelinePosition) { swapColors(); } }); }
Example #4
Source File: LoginService.java From gameserver with Apache License 2.0 | 5 votes |
@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(); } }
Example #5
Source File: CardAnimation.java From magarena with GNU General Public License v3.0 | 5 votes |
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; }
Example #6
Source File: CardAnimation.java From magarena with GNU General Public License v3.0 | 5 votes |
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; }