Package chrriis.dj.nativeswing.swtimpl.components.win32.core

Examples of chrriis.dj.nativeswing.swtimpl.components.win32.core.NativeWShellExplorer


  public static JComponent createContent() {
    final JPanel contentPane = new JPanel(new BorderLayout());
    // Create the player.
    JPanel playerPanel = new JPanel(new BorderLayout());
    playerPanel.setBorder(BorderFactory.createTitledBorder("Native Media Player component"));
    final JWMediaPlayer player = new JWMediaPlayer();
    playerPanel.add(player, BorderLayout.CENTER);
    contentPane.add(playerPanel, BorderLayout.CENTER);
    // Create the components that allow to load a file in the player.
    GridBagLayout gridBag = new GridBagLayout();
    GridBagConstraints cons = new GridBagConstraints();
    JPanel playerFilePanel = new JPanel(gridBag);
    JLabel playerFileLabel = new JLabel("File: ");
    cons.gridx = 0;
    cons.gridy = 0;
    cons.insets = new Insets(2, 2, 2, 0);
    cons.fill = GridBagConstraints.HORIZONTAL;
    gridBag.setConstraints(playerFileLabel, cons);
    playerFilePanel.add(playerFileLabel);
    final JTextField playerFileTextField = new JTextField();
    cons.gridx++;
    cons.weightx = 1;
    gridBag.setConstraints(playerFileTextField, cons);
    final Runnable loadPlayerFileRunnable = new Runnable() {
      public void run() {
        player.load(playerFileTextField.getText());
      }
    };
    playerFileTextField.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        loadPlayerFileRunnable.run();
      }
    });
    playerFilePanel.add(playerFileTextField);
    JButton playerFileButton = new JButton("...");
    cons.gridx++;
    cons.insets = new Insets(2, 2, 2, 2);
    cons.weightx = 0;
    gridBag.setConstraints(playerFileButton, cons);
    playerFileButton.addActionListener(new ActionListener() {
      JFileChooser fileChooser;
      public void actionPerformed(ActionEvent e) {
        if(fileChooser == null) {
          fileChooser = new JFileChooser();
        }
        if(fileChooser.showOpenDialog(contentPane) == JFileChooser.APPROVE_OPTION) {
          File selectedFile = fileChooser.getSelectedFile();
          playerFileTextField.setText(selectedFile.getAbsolutePath());
          loadPlayerFileRunnable.run();
        }
      }
    });
    playerFilePanel.add(playerFileButton);
    contentPane.add(playerFilePanel, BorderLayout.NORTH);
    // Create the button pane with a check box to show/hide the control bar
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4));
    player.setControlBarVisible(false);
    final JCheckBox controlBarCheckBox = new JCheckBox("Control Bar");
    controlBarCheckBox.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        player.setControlBarVisible(e.getStateChange() == ItemEvent.SELECTED);
      }
    });
    buttonPanel.add(controlBarCheckBox);
    contentPane.add(buttonPanel, BorderLayout.SOUTH);
    return contentPane;
View Full Code Here


 
  private static class CMJ_sendDocumentCompleteEvent extends ControlCommandMessage {
    @Override
    public Object run(Object[] args) {
      NativeWShellExplorer nativeShellExplorer = (NativeWShellExplorer)getNativeComponent();
      JWShellExplorer shellExplorer = nativeShellExplorer == null? null: nativeShellExplorer.shellExplorer.get();
      if(shellExplorer == null) {
        return null;
      }
      Object[] listeners = nativeShellExplorer.listenerList.getListenerList();
      ShellExplorerDocumentCompleteEvent e = null;
View Full Code Here

  public static JComponent createContent() {
    final JPanel contentPane = new JPanel(new BorderLayout());
    // Create the player.
    JPanel playerPanel = new JPanel(new BorderLayout());
    playerPanel.setBorder(BorderFactory.createTitledBorder("Native Shell Explorer component"));
    final JWShellExplorer shellExplorer = new JWShellExplorer();
    playerPanel.add(shellExplorer, BorderLayout.CENTER);
    contentPane.add(playerPanel, BorderLayout.CENTER);
    // Create the components that allow to load a file in the shell explorer.
    GridBagLayout gridBag = new GridBagLayout();
    GridBagConstraints cons = new GridBagConstraints();
    JPanel shellExplorerFilePanel = new JPanel(gridBag);
    JLabel playerFileLabel = new JLabel("File: ");
    cons.gridx = 0;
    cons.gridy = 0;
    cons.insets = new Insets(2, 2, 2, 0);
    cons.fill = GridBagConstraints.HORIZONTAL;
    gridBag.setConstraints(playerFileLabel, cons);
    shellExplorerFilePanel.add(playerFileLabel);
    final JTextField playerFileTextField = new JTextField();
    cons.gridx++;
    cons.weightx = 1;
    gridBag.setConstraints(playerFileTextField, cons);
    final Runnable loadPlayerFileRunnable = new Runnable() {
      public void run() {
        shellExplorer.load(playerFileTextField.getText());
      }
    };
    playerFileTextField.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        loadPlayerFileRunnable.run();
      }
    });
    shellExplorerFilePanel.add(playerFileTextField);
    JButton playerFileButton = new JButton("...");
    cons.gridx++;
    cons.insets = new Insets(2, 2, 2, 2);
    cons.weightx = 0;
    gridBag.setConstraints(playerFileButton, cons);
    playerFileButton.addActionListener(new ActionListener() {
      JFileChooser fileChooser;
      public void actionPerformed(ActionEvent e) {
        if(fileChooser == null) {
          fileChooser = new JFileChooser();
        }
        if(fileChooser.showOpenDialog(contentPane) == JFileChooser.APPROVE_OPTION) {
          File selectedFile = fileChooser.getSelectedFile();
          playerFileTextField.setText(selectedFile.getAbsolutePath());
          loadPlayerFileRunnable.run();
        }
      }
    });
    shellExplorerFilePanel.add(playerFileButton);
    contentPane.add(shellExplorerFilePanel, BorderLayout.NORTH);
    JPanel statusPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    final JLabel statusLabel = new JLabel("Document Complete: ");
    statusPane.add(statusLabel);
    shellExplorer.addShellExplorerListener(new ShellExplorerListener() {
      public void documentComplete(ShellExplorerDocumentCompleteEvent e) {
        statusLabel.setText("Document Complete: " + e.getLocation());
      }
    });
    contentPane.add(statusPane, BorderLayout.SOUTH);
View Full Code Here

      JWShellExplorer shellExplorer = nativeShellExplorer == null? null: nativeShellExplorer.shellExplorer.get();
      if(shellExplorer == null) {
        return null;
      }
      Object[] listeners = nativeShellExplorer.listenerList.getListenerList();
      ShellExplorerDocumentCompleteEvent e = null;
      for(int i=listeners.length-2; i>=0; i-=2) {
        if(listeners[i] == ShellExplorerListener.class) {
          if(e == null) {
            e = new ShellExplorerDocumentCompleteEvent(shellExplorer, (String)args[0]);
          }
          ((ShellExplorerListener)listeners[i + 1]).documentComplete(e);
        }
      }
      return null;
View Full Code Here

    shellExplorerFilePanel.add(playerFileButton);
    contentPane.add(shellExplorerFilePanel, BorderLayout.NORTH);
    JPanel statusPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    final JLabel statusLabel = new JLabel("Document Complete: ");
    statusPane.add(statusLabel);
    shellExplorer.addShellExplorerListener(new ShellExplorerListener() {
      public void documentComplete(ShellExplorerDocumentCompleteEvent e) {
        statusLabel.setText("Document Complete: " + e.getLocation());
      }
    });
    contentPane.add(statusPane, BorderLayout.SOUTH);
View Full Code Here

TOP

Related Classes of chrriis.dj.nativeswing.swtimpl.components.win32.core.NativeWShellExplorer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.