Package de.sciss.gui

Examples of de.sciss.gui.GradientPanel


    lmm.setDynamicComponent( metersPanel );
    waveHeaderPanel    = new JPanel( new BorderLayout() );
    channelHeaderPanel  = new JPanel();
    channelHeaderPanel.setLayout( new BoxLayout( channelHeaderPanel, BoxLayout.X_AXIS ));
final Box bbb = Box.createVerticalBox();
final GradientPanel gp = GUIUtil.createGradientPanel();
gp.setBottomBorder( true );
gp.setLayout( null );
gp.setPreferredSize( new Dimension( 0, timeAxis.getPreferredSize().height ));
bbb.add( gp );
bbb.add( markAxisHeader );
    waveHeaderPanel.add( bbb, BorderLayout.NORTH );
    channelHeaderPanel.add( flagsPanel );
    channelHeaderPanel.add( metersPanel );
    channelHeaderPanel.add( rulersPanel );
    waveHeaderPanel.add( channelHeaderPanel, BorderLayout.CENTER );

    waveView      = new WaveformView( doc, wavePanel );
    wavePanel.setLayout( new BoxLayout( wavePanel, BoxLayout.Y_AXIS ));
    wavePanel.add( timeAxis );
    wavePanel.add( markAxis );
    wavePanel.add( waveView );

        scroll        = new TimelineScroll( doc );
    ggTrackPanel    = new JPanel( new BorderLayout() );
    ggTrackPanel.add( wavePanel, BorderLayout.CENTER );
    ggTrackPanel.add( waveHeaderPanel, BorderLayout.WEST );
    ggTrackPanel.add( scroll, BorderLayout.SOUTH );
       
    lbWriteProtected  = new JLabel();
    ggAudioInfo      = new ModificationButton( ModificationButton.SHAPE_INFO );
    ggAudioInfo.setAction( new ActionAudioInfo() );
    ggRevealFile    = new ModificationButton( ModificationButton.SHAPE_REVEAL );
    actionRevealFile  = new ActionRevealFile();
    ggRevealFile.setAction( actionRevealFile );
        //    ggAudioFileDescr  = new JTextField( 32 );
        //    ggAudioFileDescr.setEditable( false );
        //    ggAudioFileDescr.setFocusable( false );
        //    ggAudioFileDescr.setBackground( null );
        //    ggAudioFileDescr.setBorder( null );
        ggAudioFileDescr  = new JLabel();

    lbSRC        = new JLabel( getResourceString( "buttonSRC" ));
    lbSRC.setForeground( colrClear );
    box          = Box.createHorizontalBox();
    box.add( Box.createHorizontalStrut( 4 ));
    box.add( lbWriteProtected );
    box.add( ggAudioInfo );
    if (internalFrames) box.add( ggRevealFile );
    box.add( Box.createHorizontalStrut( 4 ));
   
    pProgress      = new ProgressPanel();
    pOverlay      = new CrossfadePanel();
    pOverlay.setComponentA( ggAudioFileDescr );
    pOverlay.setComponentB( pProgress );
    box.add( pOverlay );
   
    box.add( Box.createHorizontalStrut( 4 ));
    box.add( lbSRC );
    box.add( CoverGrowBox.create( 2, 0 ));

    updateAFDGadget();
    updateCursorFormat();

// ----- afr export -----
    final JButton ggExportAFR = new JButton( getResourceString( "buttonDragRegion" ), new ImageIcon( getClass().getResource( "dragicon.png" )));
    ggExportAFR.setTransferHandler( new AFRTransferHandler() );
    final MouseInputAdapter expAFRmia = new MouseInputAdapter() {
      private MouseEvent dndInit = null;
      private boolean dndStarted = false;

      public void mousePressed( MouseEvent e )
      {
        dndInit    = e;
        dndStarted  = false;
      }
     
      public void mouseReleased( MouseEvent e )
      {
        dndInit    = null;
        dndStarted  = false;
      }
     
      public void mouseDragged( MouseEvent e )
      {
        if( !dndStarted && (dndInit != null) &&
          ((Math.abs( e.getX() - dndInit.getX() ) > 5) ||
           (Math.abs( e.getY() - dndInit.getY() ) > 5))) {
     
          JComponent c = (JComponent) e.getSource();
          c.getTransferHandler().exportAsDrag( c, e, TransferHandler.COPY );
          dndStarted = true;
        }
      }
    };
   
    ggExportAFR.addMouseListener( expAFRmia );
    ggExportAFR.addMouseMotionListener( expAFRmia );

    timeTB.add( Box.createHorizontalStrut( 4 ));
    timeTB.addButton( ggExportAFR );
// ----------
   
    topPane.setBorder( BorderFactory.createEmptyBorder( 2, 2, 2, 2 ));
    timeTB.setOpaque( false );
    topPane.add( timeTB );
    transTB.setOpaque( false );
    topPane.add( transTB );
    topPane.add( Box.createHorizontalGlue() );
    cbr      = new ComponentBoundsRestrictor();
    ggTreeExp  = new TreeExpanderButton();
    ggTreeExp.setExpandedToolTip( getResourceString( "buttonExpWaveTT" ));
    ggTreeExp.setCollapsedToolTip( getResourceString( "buttonCollWaveTT" ));
    ggTreeExp.setExpanded( true );
    ggTreeExp.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e )
      {
        final Dimension d  = getSize();
       
        waveExpanded  = ggTreeExp.isExpanded();
        markVisible    = viewMarkers && waveExpanded;
       
        if( waveExpanded ) {
          cbr.remove( getWindow() );
          waveView.setVisible( true );
          channelHeaderPanel.setVisible( true );
          if( viewMarkers ) {
            markAxis.setVisible( true );
            markAxisHeader.setVisible( true );
          }
          scroll.setVisible( true );
          timeTB.setVisible( true );
          pack();

        } else {
          checkDecimatedTrails();
          setPreferredSize( getSize() );

          waveView.setVisible( false );
          channelHeaderPanel.setVisible( false );
          markAxis.setVisible( false );
          markAxisHeader.setVisible( false );
          scroll.setVisible( false );
          timeTB.setVisible( false );
          actionZoomAllOut.perform();

          final int h = d.height - (waveView.getHeight() + scroll.getHeight() +
             (viewMarkers ? markAxis.getHeight() : 0));
          setSize( new Dimension( d.width - timeTB.getWidth(), h ));
          cbr.setMinimumHeight( h );
          cbr.setMaximumHeight( h );
          cbr.add( getWindow() );
        }
      }
    });
    topPane.add( ggTreeExp );
   
    gp.setGradientShift( 0, topPane.getPreferredSize().height );
   
    cp.add( topPane, BorderLayout.NORTH );
    cp.add( ggTrackPanel, BorderLayout.CENTER );
    cp.add( box, BorderLayout.SOUTH );
   
View Full Code Here


//    lmm.setDynamicComponent( metersPanel );
    waveHeaderPanel    = new JPanel( new BorderLayout() );
    channelHeaderPanel  = new JPanel();
    channelHeaderPanel.setLayout( new BoxLayout( channelHeaderPanel, BoxLayout.X_AXIS ));
final Box bbb = Box.createVerticalBox();
final GradientPanel gp = GUIUtil.createGradientPanel();
gp.setBottomBorder( true );
gp.setLayout( null );
gp.setPreferredSize( new Dimension( 0, timeAxis.getPreferredSize().height ));
bbb.add( gp );
bbb.add( markAxisHeader );
    waveHeaderPanel.add( bbb, BorderLayout.NORTH );
    channelHeaderPanel.add( flagsPanel );
//    channelHeaderPanel.add( metersPanel );
    channelHeaderPanel.add( rulersPanel );
    waveHeaderPanel.add( channelHeaderPanel, BorderLayout.CENTER );

    waveView      = new WaveformView( doc, wavePanel );
    wavePanel.setLayout( new BoxLayout( wavePanel, BoxLayout.Y_AXIS ));
    wavePanel.add( timeAxis );
    wavePanel.add( markAxis );
    wavePanel.add( waveView );

        scroll        = new TimelineScroll( doc );
    ggTrackPanel    = new JPanel( new BorderLayout() );
    ggTrackPanel.add( wavePanel, BorderLayout.CENTER );
    ggTrackPanel.add( waveHeaderPanel, BorderLayout.WEST );
    ggTrackPanel.add( scroll, BorderLayout.SOUTH );

    lbWriteProtected  = new JLabel();
// EEE
//    ggAudioInfo      = new ModificationButton( ModificationButton.SHAPE_INFO );
//    ggAudioInfo.setAction( new ActionAudioInfo() );
//    ggRevealFile    = new ModificationButton( ModificationButton.SHAPE_REVEAL );
//    actionRevealFile  = new ActionRevealFile();
//    ggRevealFile.setAction( actionRevealFile );
//    ggAudioFileDescr  = new JTextField( 32 );
//    ggAudioFileDescr.setEditable( false );
//    ggAudioFileDescr.setFocusable( false );
//    ggAudioFileDescr.setBackground( null );
//    ggAudioFileDescr.setBorder( null );

//    lbSRC        = new JLabel( getResourceString( "buttonSRC" ));
//    lbSRC.setForeground( colrClear );
    box          = Box.createHorizontalBox();
    box.add( Box.createHorizontalStrut( 4 ));
    box.add( lbWriteProtected );
// EEE
//    box.add( ggAudioInfo );
//    box.add( ggRevealFile );
//    box.add( Box.createHorizontalStrut( 4 ));
//
//    pProgress      = new ProgressPanel();
//    pOverlay      = new CrossfadePanel();
//    pOverlay.setComponentA( ggAudioFileDescr );
//    pOverlay.setComponentB( pProgress );
//    box.add( pOverlay );
//   
//    box.add( Box.createHorizontalStrut( 4 ));
//    box.add( lbSRC );
    box.add( CoverGrowBox.create( 2, 0 ));
//
//    updateAFDGadget();
//    updateCursorFormat();
//
// ----- afr export -----
//    final JButton ggExportAFR = new JButton( getResourceString( "buttonDragRegion" ), new ImageIcon( getClass().getResource( "dragicon.png" )));
//    ggExportAFR.setTransferHandler( new AFRTransferHandler() );
//    final MouseInputAdapter expAFRmia = new MouseInputAdapter() {
//      private MouseEvent dndInit = null;
//      private boolean dndStarted = false;
//
//      public void mousePressed( MouseEvent e )
//      {
//        dndInit    = e;
//        dndStarted  = false;
//      }
//     
//      public void mouseReleased( MouseEvent e )
//      {
//        dndInit    = null;
//        dndStarted  = false;
//      }
//     
//      public void mouseDragged( MouseEvent e )
//      {
//        if( !dndStarted && (dndInit != null) &&
//          ((Math.abs( e.getX() - dndInit.getX() ) > 5) ||
//           (Math.abs( e.getY() - dndInit.getY() ) > 5))) {
//     
//          JComponent c = (JComponent) e.getSource();
//          c.getTransferHandler().exportAsDrag( c, e, TransferHandler.COPY );
//          dndStarted = true;
//        }
//      }
//    };
//   
//    ggExportAFR.addMouseListener( expAFRmia );
//    ggExportAFR.addMouseMotionListener( expAFRmia );
//
//    timeTB.add( Box.createHorizontalStrut( 4 ));
//    timeTB.addButton( ggExportAFR );
// ----------
   
    topPane.setBorder( BorderFactory.createEmptyBorder( 2, 2, 2, 2 ));
    timeTB.setOpaque( false );
    topPane.add( timeTB );
//    transTB.setOpaque( false );
//    topPane.add( transTB );
    topPane.add( Box.createHorizontalGlue() );
    cbr      = new ComponentBoundsRestrictor();
    ggTreeExp  = new TreeExpanderButton();
    ggTreeExp.setExpandedToolTip( getResourceString( "buttonExpWaveTT" ));
    ggTreeExp.setCollapsedToolTip( getResourceString( "buttonCollWaveTT" ));
    ggTreeExp.setExpanded( true );
    ggTreeExp.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent e )
      {
        final Dimension d  = getSize();
       
        waveExpanded  = ggTreeExp.isExpanded();
        markVisible    = viewMarkers && waveExpanded;
       
        if( waveExpanded ) {
          cbr.remove( getWindow() );
          waveView.setVisible( true );
          channelHeaderPanel.setVisible( true );
          if( viewMarkers ) {
            markAxis.setVisible( true );
            markAxisHeader.setVisible( true );
          }
          scroll.setVisible( true );
          timeTB.setVisible( true );
          pack();

        } else {
          checkDecimatedTrails();
          setPreferredSize( getSize() );

          waveView.setVisible( false );
          channelHeaderPanel.setVisible( false );
          markAxis.setVisible( false );
          markAxisHeader.setVisible( false );
          scroll.setVisible( false );
          timeTB.setVisible( false );
          actionZoomAllOut.perform();

          final int h = d.height - (waveView.getHeight() + scroll.getHeight() +
             (viewMarkers ? markAxis.getHeight() : 0));
          setSize( new Dimension( d.width - timeTB.getWidth(), h ));
          cbr.setMinimumHeight( h );
          cbr.setMaximumHeight( h );
          cbr.add( getWindow() );
        }
      }
    });
    topPane.add( ggTreeExp );
   
    gp.setGradientShift( 0, topPane.getPreferredSize().height );
   
    cp.add( topPane, BorderLayout.NORTH );
    cp.add( ggTrackPanel, BorderLayout.CENTER );
    cp.add( box, BorderLayout.SOUTH );
   
View Full Code Here

TOP

Related Classes of de.sciss.gui.GradientPanel

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.