Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

610
LINES

< > BotCompany Repo | #1016326 // VLCJ Player (external frame, Dyn Module, dev.)

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 0K of libraries. Click here for Pure Java version (5261L/34K).

1  
!7
2  
3  
lib 1400072 // vlcj player (hacked)
4  
lib 1400069 // vlcj player libs
5  
6  
import static uk.co.caprica.vlcjplayer.Application.application;
7  
import static uk.co.caprica.vlcjplayer.Application.resources;
8  
import static uk.co.caprica.vlcjplayer.view.action.Resource.resource;
9  
10  
import java.util.prefs.Preferences;
11  
import java.text.*;
12  
13  
import net.miginfocom.swing.*;
14  
15  
import uk.co.caprica.vlcj.player.*;
16  
import uk.co.caprica.vlcjplayer.view.snapshot.*;
17  
import uk.co.caprica.vlcjplayer.view.action.mediaplayer.*;
18  
import uk.co.caprica.vlcjplayer.view.*;
19  
import uk.co.caprica.vlcj.player.embedded.*;
20  
import uk.co.caprica.vlcjplayer.event.*;
21  
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
22  
import uk.co.caprica.vlcj.discovery.NativeDiscovery;
23  
import uk.co.caprica.vlcj.log.NativeLog;
24  
import uk.co.caprica.vlcj.runtime.RuntimeUtil;
25  
import uk.co.caprica.vlcj.runtime.streams.NativeStreams;
26  
import uk.co.caprica.vlcjplayer.view.debug.DebugFrame;
27  
import uk.co.caprica.vlcjplayer.view.effects.EffectsFrame;
28  
import uk.co.caprica.vlcjplayer.view.main.MainFrame;
29  
import uk.co.caprica.vlcjplayer.view.messages.NativeLogFrame;
30  
import uk.co.caprica.vlcjplayer.view.action.*;
31  
import uk.co.caprica.vlcjplayer.view.main.*;
32  
33  
import com.google.common.eventbus.Subscribe;
34  
35  
sclass VLCJPlayer extends DynModule {
36  
  transient EmbeddedMediaPlayerComponent mediaPlayerComponent;
37  
  transient NativeStreams nativeStreams;
38  
  transient JInternalFrame mainFrame;
39  
  transient JFrame messagesFrame, effectsFrame, debugFrame;
40  
  transient NativeLog nativeLog;
41  
42  
  void start {
43  
    // This will locate LibVLC for the vast majority of cases
44  
    new NativeDiscovery().discover();
45  
    startPlayer();
46  
  }
47  
  
48  
  void unvisualize() {
49  
    mediaPlayerComponent.getMediaPlayer().stop();
50  
    mediaPlayerComponent.release();
51  
    if (nativeStreams != null) nativeStreams.release();
52  
    application().post(ShutdownEvent.INSTANCE);
53  
  }
54  
  
55  
  void startPlayer() swing {
56  
    mediaPlayerComponent = application().mediaPlayerComponent();
57  
  
58  
    mainFrame = new MainFrame();
59  
    
60  
    EmbeddedMediaPlayer embeddedMediaPlayer = mediaPlayerComponent.getMediaPlayer();
61  
    //embeddedMediaPlayer.setFullScreenStrategy(new VlcjPlayerFullScreenStrategy(mainFrame));
62  
63  
    nativeLog = mediaPlayerComponent.getMediaPlayerFactory().newLog();
64  
65  
    messagesFrame = new NativeLogFrame(nativeLog);
66  
    effectsFrame = new EffectsFrame();
67  
    debugFrame = new DebugFrame();
68  
    
69  
    mainFrame.setVisible(true);
70  
  }
71  
}
72  
73  
sclass VlcjPlayerFullScreenStrategy extends DefaultAdaptiveRuntimeFullScreenStrategy {
74  
  *(Window window) { super(window); }
75  
76  
  @Override
77  
  protected void beforeEnterFullScreen() {
78  
      application().post(BeforeEnterFullScreenEvent.INSTANCE);
79  
  }
80  
81  
  @Override
82  
  protected  void afterExitFullScreen() {
83  
      application().post(AfterExitFullScreenEvent.INSTANCE);
84  
  }
85  
}
86  
87  
// TODO: BaseFrame subscribes
88  
89  
sclass MainFrame extends JInternalFrame {
90  
91  
    private static final String ACTION_EXIT_FULLSCREEN = "exit-fullscreen";
92  
93  
    private static final KeyStroke KEYSTROKE_ESCAPE = KeyStroke.getKeyStroke("ESCAPE");
94  
95  
    private static final KeyStroke KEYSTROKE_TOGGLE_FULLSCREEN = KeyStroke.getKeyStroke("F11");
96  
97  
    private final EmbeddedMediaPlayerComponent mediaPlayerComponent;
98  
99  
    private final Action mediaOpenAction;
100  
    private final Action mediaQuitAction;
101  
102  
    private final StandardAction videoFullscreenAction;
103  
104  
    private final Action subtitleAddSubtitleFileAction;
105  
106  
    private final Action toolsEffectsAction;
107  
    private final Action toolsMessagesAction;
108  
    private final Action toolsDebugAction;
109  
110  
    private final StandardAction viewStatusBarAction;
111  
112  
    private final Action helpAboutAction;
113  
114  
    private final JMenuBar menuBar;
115  
116  
    private final JMenu mediaMenu;
117  
    private final JMenu mediaRecentMenu;
118  
119  
    private final JMenu playbackMenu;
120  
    private final JMenu playbackTitleMenu;
121  
    private final JMenu playbackChapterMenu;
122  
    private final JMenu playbackSpeedMenu;
123  
124  
    private final JMenu audioMenu;
125  
    private final JMenu audioTrackMenu;
126  
    private final JMenu audioDeviceMenu;
127  
    private final JMenu audioStereoMenu;
128  
129  
    private final JMenu videoMenu;
130  
    private final JMenu videoTrackMenu;
131  
    private final JMenu videoZoomMenu;
132  
    private final JMenu videoAspectRatioMenu;
133  
    private final JMenu videoCropMenu;
134  
135  
    private final JMenu subtitleMenu;
136  
    private final JMenu subtitleTrackMenu;
137  
138  
    private final JMenu toolsMenu;
139  
140  
    private final JMenu viewMenu;
141  
142  
    private final JMenu helpMenu;
143  
144  
    private final JFileChooser fileChooser;
145  
146  
    private final PositionPane positionPane;
147  
148  
    private final ControlsPane controlsPane;
149  
150  
    private final StatusBar statusBar;
151  
152  
    private final VideoContentPane videoContentPane;
153  
154  
    private final JPanel bottomPane;
155  
156  
    private final MouseMovementDetector mouseMovementDetector;
157  
158  
    public MainFrame() {
159  
        super("vlcj player");
160  
161  
        this.mediaPlayerComponent = application().mediaPlayerComponent();
162  
163  
        MediaPlayerActions mediaPlayerActions = application().mediaPlayerActions();
164  
165  
        mediaOpenAction = new StandardAction(resource("menu.media.item.openFile")) {
166  
            @Override
167  
            public void actionPerformed(ActionEvent e) {
168  
                if (JFileChooser.APPROVE_OPTION == fileChooser.showOpenDialog(MainFrame.this)) {
169  
                    File file = fileChooser.getSelectedFile();
170  
                    String mrl = file.getAbsolutePath();
171  
                    application().addRecentMedia(mrl);
172  
                    mediaPlayerComponent.getMediaPlayer().playMedia(mrl);
173  
                }
174  
            }
175  
        };
176  
177  
        mediaQuitAction = new StandardAction(resource("menu.media.item.quit")) {
178  
            @Override
179  
            public void actionPerformed(ActionEvent e) {
180  
                /*dispose();
181  
                System.exit(0);*/
182  
                // TODO
183  
            }
184  
        };
185  
186  
        videoFullscreenAction = new StandardAction(resource("menu.video.item.fullscreen")) {
187  
            @Override
188  
            public void actionPerformed(ActionEvent e) {
189  
                mediaPlayerComponent.getMediaPlayer().toggleFullScreen();
190  
            }
191  
        };
192  
193  
        subtitleAddSubtitleFileAction = new StandardAction(resource("menu.subtitle.item.addSubtitleFile")) {
194  
            @Override
195  
            public void actionPerformed(ActionEvent e) {
196  
                if (JFileChooser.APPROVE_OPTION == fileChooser.showOpenDialog(MainFrame.this)) {
197  
                    File file = fileChooser.getSelectedFile();
198  
                    mediaPlayerComponent.getMediaPlayer().setSubTitleFile(file);
199  
                }
200  
            }
201  
        };
202  
203  
        toolsEffectsAction = new StandardAction(resource("menu.tools.item.effects")) {
204  
            @Override
205  
            public void actionPerformed(ActionEvent e) {
206  
                application().post(ShowEffectsEvent.INSTANCE);
207  
            }
208  
        };
209  
210  
        toolsMessagesAction = new StandardAction(resource("menu.tools.item.messages")) {
211  
            @Override
212  
            public void actionPerformed(ActionEvent e) {
213  
                application().post(ShowMessagesEvent.INSTANCE);
214  
            }
215  
        };
216  
217  
        toolsDebugAction = new StandardAction(resource("menu.tools.item.debug")) {
218  
            @Override
219  
            public void actionPerformed(ActionEvent e) {
220  
                application().post(ShowDebugEvent.INSTANCE);
221  
            }
222  
        };
223  
224  
        viewStatusBarAction = new StandardAction(resource("menu.view.item.statusBar")) {
225  
            @Override
226  
            public void actionPerformed(ActionEvent e) {
227  
                boolean visible;
228  
                Object source = e.getSource();
229  
                if (source instanceof JCheckBoxMenuItem) {
230  
                    JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem)source;
231  
                    visible = menuItem.isSelected();
232  
                }
233  
                else {
234  
                    throw new IllegalStateException("Don't know about source " + source);
235  
                }
236  
                statusBar.setVisible(visible);
237  
                bottomPane.invalidate();
238  
                bottomPane.revalidate();
239  
                bottomPane.getParent().invalidate();
240  
                bottomPane.getParent().revalidate();
241  
                MainFrame.this.invalidate();
242  
                MainFrame.this.revalidate();
243  
            }
244  
        };
245  
246  
        helpAboutAction = new StandardAction(resource("menu.help.item.about")) {
247  
            @Override
248  
            public void actionPerformed(ActionEvent e) {
249  
                AboutDialog dialog = new AboutDialog(null);
250  
                dialog.setVisible(true);
251  
            }
252  
        };
253  
254  
        menuBar = new JMenuBar();
255  
256  
        mediaMenu = new JMenu(resource("menu.media").name());
257  
        mediaMenu.setMnemonic(resource("menu.media").mnemonic());
258  
        mediaMenu.add(new JMenuItem(mediaOpenAction));
259  
        mediaRecentMenu = new RecentMediaMenu(resource("menu.media.item.recent")).menu();
260  
        mediaMenu.add(mediaRecentMenu);
261  
        mediaMenu.add(new JSeparator());
262  
        mediaMenu.add(new JMenuItem(mediaQuitAction));
263  
        menuBar.add(mediaMenu);
264  
265  
        playbackMenu = new JMenu(resource("menu.playback").name());
266  
        playbackMenu.setMnemonic(resource("menu.playback").mnemonic());
267  
268  
        playbackTitleMenu = new TitleTrackMenu().menu();
269  
270  
        // Chapter could be an "on-demand" menu too, and it could be with radio buttons...
271  
272  
        playbackMenu.add(playbackTitleMenu);
273  
274  
        playbackChapterMenu = new ChapterMenu().menu();
275  
276  
        playbackMenu.add(playbackChapterMenu);
277  
        playbackMenu.add(new JSeparator());
278  
        playbackSpeedMenu = new JMenu(resource("menu.playback.item.speed").name());
279  
        playbackSpeedMenu.setMnemonic(resource("menu.playback.item.speed").mnemonic());
280  
        for (Action action : mediaPlayerActions.playbackSpeedActions()) {
281  
            playbackSpeedMenu.add(new JMenuItem(action));
282  
        }
283  
        playbackMenu.add(playbackSpeedMenu);
284  
        playbackMenu.add(new JSeparator());
285  
        for (Action action : mediaPlayerActions.playbackSkipActions()) {
286  
            playbackMenu.add(new JMenuItem(action));
287  
        }
288  
        playbackMenu.add(new JSeparator());
289  
        for (Action action : mediaPlayerActions.playbackChapterActions()) {
290  
            playbackMenu.add(new JMenuItem(action));
291  
        }
292  
        playbackMenu.add(new JSeparator());
293  
        for (Action action : mediaPlayerActions.playbackControlActions()) {
294  
            playbackMenu.add(new JMenuItem(action) { // FIXME need a standardmenuitem that disables the tooltip like this, very poor show...
295  
                @Override
296  
                public String getToolTipText() {
297  
                    return null;
298  
                }
299  
            });
300  
        }
301  
        menuBar.add(playbackMenu);
302  
303  
        audioMenu = new JMenu(resource("menu.audio").name());
304  
        audioMenu.setMnemonic(resource("menu.audio").mnemonic());
305  
306  
        audioTrackMenu = new AudioTrackMenu().menu();
307  
308  
        audioMenu.add(audioTrackMenu);
309  
        audioDeviceMenu = new AudioDeviceMenu().menu();
310  
        audioMenu.add(audioDeviceMenu);
311  
        audioStereoMenu = new JMenu(resource("menu.audio.item.stereoMode").name());
312  
        audioStereoMenu.setMnemonic(resource("menu.audio.item.stereoMode").mnemonic());
313  
        for (Action action : mediaPlayerActions.audioStereoModeActions()) {
314  
            audioStereoMenu.add(new JRadioButtonMenuItem(action));
315  
        }
316  
        audioMenu.add(audioStereoMenu);
317  
        audioMenu.add(new JSeparator());
318  
        for (Action action : mediaPlayerActions.audioControlActions()) {
319  
            audioMenu.add(new JMenuItem(action));
320  
        }
321  
        menuBar.add(audioMenu);
322  
323  
        videoMenu = new JMenu(resource("menu.video").name());
324  
        videoMenu.setMnemonic(resource("menu.video").mnemonic());
325  
326  
        videoTrackMenu = new VideoTrackMenu().menu();
327  
328  
        videoMenu.add(videoTrackMenu);
329  
        videoMenu.add(new JSeparator());
330  
        videoMenu.add(new JCheckBoxMenuItem(videoFullscreenAction));
331  
        videoMenu.add(new JSeparator());
332  
        videoZoomMenu = new JMenu(resource("menu.video.item.zoom").name());
333  
        videoZoomMenu.setMnemonic(resource("menu.video.item.zoom").mnemonic());
334  
        addActions(mediaPlayerActions.videoZoomActions(), videoZoomMenu/*, true*/); // FIXME how to handle zoom 1:1 and fit to window - also, probably should not use addActions to select
335  
        videoMenu.add(videoZoomMenu);
336  
        videoAspectRatioMenu = new JMenu(resource("menu.video.item.aspectRatio").name());
337  
        videoAspectRatioMenu.setMnemonic(resource("menu.video.item.aspectRatio").mnemonic());
338  
        addActions(mediaPlayerActions.videoAspectRatioActions(), videoAspectRatioMenu, true);
339  
        videoMenu.add(videoAspectRatioMenu);
340  
        videoCropMenu = new JMenu(resource("menu.video.item.crop").name());
341  
        videoCropMenu.setMnemonic(resource("menu.video.item.crop").mnemonic());
342  
        addActions(mediaPlayerActions.videoCropActions(), videoCropMenu, true);
343  
        videoMenu.add(videoCropMenu);
344  
        videoMenu.add(new JSeparator());
345  
        videoMenu.add(new JMenuItem(mediaPlayerActions.videoSnapshotAction()));
346  
        menuBar.add(videoMenu);
347  
348  
        subtitleMenu = new JMenu(resource("menu.subtitle").name());
349  
        subtitleMenu.setMnemonic(resource("menu.subtitle").mnemonic());
350  
        subtitleMenu.add(new JMenuItem(subtitleAddSubtitleFileAction));
351  
352  
        subtitleTrackMenu = new SubtitleTrackMenu().menu();
353  
354  
        subtitleMenu.add(subtitleTrackMenu);
355  
        menuBar.add(subtitleMenu);
356  
357  
        toolsMenu = new JMenu(resource("menu.tools").name());
358  
        toolsMenu.setMnemonic(resource("menu.tools").mnemonic());
359  
        toolsMenu.add(new JMenuItem(toolsEffectsAction));
360  
        toolsMenu.add(new JMenuItem(toolsMessagesAction));
361  
        toolsMenu.add(new JSeparator());
362  
        toolsMenu.add(new JMenuItem(toolsDebugAction));
363  
        menuBar.add(toolsMenu);
364  
365  
        viewMenu = new JMenu(resource("menu.view").name());
366  
        viewMenu.setMnemonic(resource("menu.view").mnemonic());
367  
        viewMenu.add(new JCheckBoxMenuItem(viewStatusBarAction));
368  
        menuBar.add(viewMenu);
369  
370  
        helpMenu = new JMenu(resource("menu.help").name());
371  
        helpMenu.setMnemonic(resource("menu.help").mnemonic());
372  
        helpMenu.add(new JMenuItem(helpAboutAction));
373  
        menuBar.add(helpMenu);
374  
375  
        setJMenuBar(menuBar);
376  
377  
        videoContentPane = new VideoContentPane();
378  
379  
        JPanel contentPane = new JPanel();
380  
        contentPane.setLayout(new BorderLayout());
381  
        contentPane.add(videoContentPane, BorderLayout.CENTER);
382  
        contentPane.setTransferHandler(new MediaTransferHandler() {
383  
            @Override
384  
            protected void onMediaDropped(String[] uris) {
385  
                mediaPlayerComponent.getMediaPlayer().playMedia(uris[0]);
386  
            }
387  
        });
388  
389  
        setContentPane(contentPane);
390  
391  
        fileChooser = new JFileChooser();
392  
393  
        bottomPane = new JPanel();
394  
        bottomPane.setLayout(new BorderLayout());
395  
396  
        JPanel bottomControlsPane = new JPanel();
397  
        bottomControlsPane.setLayout(new MigLayout("fill, insets 0 n n n", "[grow]", "[]0[]"));
398  
399  
        positionPane = new PositionPane(mediaPlayerComponent.getMediaPlayer());
400  
        bottomControlsPane.add(positionPane, "grow, wrap");
401  
402  
        controlsPane = new ControlsPane(mediaPlayerActions);
403  
        bottomPane.add(bottomControlsPane, BorderLayout.CENTER);
404  
        bottomControlsPane.add(controlsPane, "grow");
405  
406  
        statusBar = new StatusBar();
407  
        bottomPane.add(statusBar, BorderLayout.SOUTH);
408  
409  
        contentPane.add(bottomPane, BorderLayout.SOUTH);
410  
411  
        mediaPlayerComponent.getMediaPlayer().addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
412  
413  
            @Override
414  
            public void playing(MediaPlayer mediaPlayer) {
415  
                videoContentPane.showVideo();
416  
                mouseMovementDetector.start();
417  
                application().post(PlayingEvent.INSTANCE);
418  
            }
419  
420  
            @Override
421  
            public void paused(MediaPlayer mediaPlayer) {
422  
                mouseMovementDetector.stop();
423  
                application().post(PausedEvent.INSTANCE);
424  
            }
425  
426  
            @Override
427  
            public void stopped(MediaPlayer mediaPlayer) {
428  
                mouseMovementDetector.stop();
429  
                videoContentPane.showDefault();
430  
                application().post(StoppedEvent.INSTANCE);
431  
            }
432  
433  
            @Override
434  
            public void finished(MediaPlayer mediaPlayer) {
435  
                videoContentPane.showDefault();
436  
                mouseMovementDetector.stop();
437  
                application().post(StoppedEvent.INSTANCE);
438  
            }
439  
440  
            @Override
441  
            public void error(MediaPlayer mediaPlayer) {
442  
                videoContentPane.showDefault();
443  
                mouseMovementDetector.stop();
444  
                application().post(StoppedEvent.INSTANCE);
445  
                JOptionPane.showMessageDialog(MainFrame.this, MessageFormat.format(resources().getString("error.errorEncountered"), fileChooser.getSelectedFile().toString()), resources().getString("dialog.errorEncountered"), JOptionPane.ERROR_MESSAGE);
446  
            }
447  
448  
            @Override
449  
            public void mediaParsedChanged(final MediaPlayer mediaPlayer, int newStatus) {
450  
                SwingUtilities.invokeLater(new Runnable() {
451  
                    @Override
452  
                    public void run() {
453  
                        statusBar.setTitle(mediaPlayer.getMediaMeta().getTitle());
454  
                    }
455  
                });
456  
            }
457  
458  
            @Override
459  
            public void mediaDurationChanged(final MediaPlayer mediaPlayer, final long newDuration) {
460  
                swing {
461  
                  positionPane.setDuration(newDuration);
462  
                  statusBar.setDuration(newDuration);
463  
                }
464  
            }
465  
466  
            @Override
467  
            public void timeChanged(final MediaPlayer mediaPlayer, final long newTime) {
468  
                SwingUtilities.invokeLater(new Runnable() {
469  
                    @Override
470  
                    public void run() {
471  
                        positionPane.setTime(newTime);
472  
                        statusBar.setTime(newTime);
473  
                    }
474  
                });
475  
            }
476  
        });
477  
478  
        getActionMap().put(ACTION_EXIT_FULLSCREEN, new AbstractAction() {
479  
            @Override
480  
            public void actionPerformed(ActionEvent e) {
481  
                mediaPlayerComponent.getMediaPlayer().toggleFullScreen();
482  
                videoFullscreenAction.select(false);
483  
            }
484  
        });
485  
486  
        applyPreferences();
487  
488  
        mouseMovementDetector = new VideoMouseMovementDetector(mediaPlayerComponent.getVideoSurface(), 500, mediaPlayerComponent);
489  
490  
        setMinimumSize(new Dimension(370, 240));
491  
    }
492  
493  
    private ButtonGroup addActions(List<Action> actions, JMenu menu, boolean selectFirst) {
494  
        ButtonGroup buttonGroup = addActions(actions, menu);
495  
        if (selectFirst) {
496  
            Enumeration<AbstractButton> en = buttonGroup.getElements();
497  
            if (en.hasMoreElements()) {
498  
                StandardAction action = (StandardAction) en.nextElement().getAction();
499  
                action.select(true);
500  
            }
501  
        }
502  
        return buttonGroup;
503  
    }
504  
505  
    private ButtonGroup addActions(List<Action> actions, JMenu menu) {
506  
        ButtonGroup buttonGroup = new ButtonGroup();
507  
        for (Action action : actions) {
508  
            JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(action);
509  
            buttonGroup.add(menuItem);
510  
            menu.add(menuItem);
511  
        }
512  
        return buttonGroup;
513  
    }
514  
515  
    private void applyPreferences() {
516  
        Preferences prefs = Preferences.userNodeForPackage(MainFrame.class);
517  
        setBounds(
518  
            prefs.getInt("frameX"     , 100),
519  
            prefs.getInt("frameY"     , 100),
520  
            prefs.getInt("frameWidth" , 800),
521  
            prefs.getInt("frameHeight", 600)
522  
        );
523  
        /*boolean alwaysOnTop = prefs.getBoolean("alwaysOnTop", false);
524  
        setAlwaysOnTop(alwaysOnTop);
525  
        videoAlwaysOnTopAction.select(alwaysOnTop);*/
526  
        boolean statusBarVisible = prefs.getBoolean("statusBar", false);
527  
        statusBar.setVisible(statusBarVisible);
528  
        viewStatusBarAction.select(statusBarVisible);
529  
        fileChooser.setCurrentDirectory(new File(prefs.get("chooserDirectory", ".")));
530  
        String recentMedia = prefs.get("recentMedia", "");
531  
        if (recentMedia.length() > 0) {
532  
            List<String> mrls = Arrays.asList(prefs.get("recentMedia", "").split("\\|"));
533  
            Collections.reverse(mrls);
534  
            for (String mrl : mrls) {
535  
                application().addRecentMedia(mrl);
536  
            }
537  
        }
538  
    }
539  
540  
    /*@Override
541  
    protected void onShutdown() {
542  
        if (wasShown()) {
543  
            Preferences prefs = Preferences.userNodeForPackage(MainFrame.class);
544  
            prefs.putInt    ("frameX"          , getX     ());
545  
            prefs.putInt    ("frameY"          , getY     ());
546  
            prefs.putInt    ("frameWidth"      , getWidth ());
547  
            prefs.putInt    ("frameHeight"     , getHeight());
548  
            //prefs.putBoolean("alwaysOnTop"     , isAlwaysOnTop());
549  
            prefs.putBoolean("statusBar"       , statusBar.isVisible());
550  
            prefs.put       ("chooserDirectory", fileChooser.getCurrentDirectory().toString());
551  
552  
            String recentMedia;
553  
            List<String> mrls = application().recentMedia();
554  
            if (!mrls.isEmpty()) {
555  
                StringBuilder sb = new StringBuilder();
556  
                for (String mrl : mrls) {
557  
                    if (sb.length() > 0) {
558  
                        sb.append('|');
559  
                    }
560  
                    sb.append(mrl);
561  
                }
562  
                recentMedia = sb.toString();
563  
            }
564  
            else {
565  
                recentMedia = "";
566  
            }
567  
            prefs.put("recentMedia", recentMedia);
568  
        }
569  
    }*/
570  
571  
    /*@Subscribe
572  
    public void onBeforeEnterFullScreen(BeforeEnterFullScreenEvent event) {
573  
        menuBar.setVisible(false);
574  
        bottomPane.setVisible(false);
575  
        // As the menu is now hidden, the shortcut will not work, so register a temporary key-binding
576  
        registerEscapeBinding();
577  
    }*/
578  
579  
    /*@Subscribe
580  
    public void onAfterExitFullScreen(AfterExitFullScreenEvent event) {
581  
        deregisterEscapeBinding();
582  
        menuBar.setVisible(true);
583  
        bottomPane.setVisible(true);
584  
    }*/
585  
586  
    @Subscribe
587  
    public void onSnapshotImage(SnapshotImageEvent event) {
588  
        new SnapshotView(event.image());
589  
    }
590  
591  
    private void registerEscapeBinding() {
592  
        getInputMap().put(KEYSTROKE_ESCAPE, ACTION_EXIT_FULLSCREEN);
593  
        getInputMap().put(KEYSTROKE_TOGGLE_FULLSCREEN, ACTION_EXIT_FULLSCREEN);
594  
    }
595  
596  
    private void deregisterEscapeBinding() {
597  
        getInputMap().remove(KEYSTROKE_ESCAPE);
598  
        getInputMap().remove(KEYSTROKE_TOGGLE_FULLSCREEN);
599  
    }
600  
601  
    /*private InputMap getInputMap() {
602  
        JComponent c = (JComponent) getContentPane();
603  
        return c.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
604  
    }
605  
606  
    private ActionMap getActionMap() {
607  
        JComponent c = (JComponent) getContentPane();
608  
        return c.getActionMap();
609  
    }*/
610  
}

Author comment

Began life as a copy of #1016320

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1016326
Snippet name: VLCJ Player (external frame, Dyn Module, dev.)
Eternal ID of this version: #1016326/34
Text MD5: d8dcd877c6278633179823b803075346
Transpilation MD5: f8ba7ade9f8fa350fd37c22d5b8bdc11
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-31 13:38:42
Source code size: 23806 bytes / 610 lines
Pitched / IR pitched: No / No
Views / Downloads: 553 / 730
Version history: 33 change(s)
Referenced in: [show references]