Work in progress

This commit is contained in:
denny
2015-09-14 21:31:26 -04:00
parent 732d478502
commit c7227ca780
42 changed files with 978 additions and 1356 deletions

View File

@@ -1,312 +0,0 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
******************************************************************************/
package instrument.gui;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.io.IOException;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import module.decode.Decoder;
import module.decode.DecoderType;
import module.decode.fleetsync2.Fleetsync2Decoder;
import module.decode.lj1200.LJ1200Decoder;
import module.decode.mdc1200.MDCDecoder;
import module.decode.p25.P25Decoder.Modulation;
import module.decode.tait.Tait1200Decoder;
import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import source.wave.WaveSource;
import source.wave.WaveSource.PositionListener;
import controller.ResourceManager;
public class AudioSourceFrame extends JInternalFrame implements PositionListener
{
private static final long serialVersionUID = 1L;
private final static Logger mLog =
LoggerFactory.getLogger( AudioSourceFrame.class );
private WaveSource mSource;
private JDesktopPane mDesktop;
private JLabel mCurrentPosition = new JLabel( "0" );
private JComboBox<DecoderType> mComboDecoders;
private JComboBox<Modulation> mComboModulations;
private JLabel mModulationLabel = new JLabel( "Modulation:" );
public AudioSourceFrame( WaveSource source, JDesktopPane desktop )
{
mSource = source;
mSource.addListener( this );
mDesktop = desktop;
initGui();
}
private void initGui()
{
setTitle( "Audio Source [" + mSource.getSampleType().toString() + "]" );
setPreferredSize( new Dimension( 700, 150 ) );
setSize( 700, 150 );
setResizable( true );
setClosable( true );
setIconifiable( true );
setMaximizable( false );
JPanel panel = new JPanel();
panel.setLayout( new MigLayout() );
JLabel fileLabel = new JLabel( "File: " + mSource.getFile().getName() );
fileLabel.setToolTipText( mSource.getFile().getName() );
panel.add( fileLabel, "span,wrap" );
panel.add( new JLabel( "Jump:" ) );
panel.add( new JumpToField( mSource ) );
panel.add( new NextSampleButton( mSource, ">", 1 ) );
panel.add( new NextSampleButton( mSource, "> 10 >", 10 ) );
panel.add( new NextSampleButton( mSource, "> 100 >", 100 ) );
panel.add( new NextSampleButton( mSource, "> 1000 >", 1000 ) );
panel.add( new JLabel( "Posn:" ) );
panel.add( mCurrentPosition, "wrap" );
/* ComboBox: Decoders */
mComboDecoders = new JComboBox<DecoderType>();
DefaultComboBoxModel<DecoderType> model =
new DefaultComboBoxModel<DecoderType>();
for( DecoderType type: DecoderType.getInstrumentableDecoders() )
{
model.addElement( type );
}
mComboDecoders.setModel( model );
mComboDecoders.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
DecoderType selected = (DecoderType)mComboDecoders.getSelectedItem();
if( selected == DecoderType.P25_PHASE1 )
{
mComboModulations.setVisible( true );
mModulationLabel.setVisible( true );
}
else
{
mComboModulations.setVisible( false );
mModulationLabel.setVisible( false );
}
}
});
panel.add( new JLabel( "Decoders:" ) );
panel.add( mComboDecoders, "span 3,grow" );
panel.add( new AddDecoderButton(), "grow,wrap" );
mComboModulations = new JComboBox<Modulation>(
new DefaultComboBoxModel<Modulation>( Modulation.values() ) );
mComboModulations.setVisible( false );
mModulationLabel.setVisible( false );
panel.add( mModulationLabel );
panel.add( mComboModulations );
add( panel );
}
public class AddDecoderButton extends JButton
{
private static final long serialVersionUID = 1L;
public AddDecoderButton()
{
super( "Add" );
addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent arg0 )
{
DecoderType selected =
(DecoderType)mComboDecoders.getSelectedItem();
mLog.info( "Selected:" + selected.getDisplayString() );
Decoder decoder = null;
switch( selected )
{
case FLEETSYNC2:
decoder = new Fleetsync2Decoder( null );
break;
case LJ_1200:
decoder = new LJ1200Decoder( null );
break;
case LTR_NET:
// decoder = new LTRNetDecoder( new DecodeConfigLTRNet(),
// mSource.getSampleType(), null, MessageDirection.OSW );
break;
case MDC1200:
decoder = new MDCDecoder( null );
break;
case MPT1327:
// decoder = new MPT1327Decoder( new DecodeConfigMPT1327(),
// mSource.getSampleType(), null, Sync.NORMAL );
break;
case PASSPORT:
// decoder = new PassportDecoder( new DecodeConfigPassport(),
// mSource.getSampleType(), null );
break;
case P25_PHASE1:
ResourceManager rm = new ResourceManager();
// decoder = new P25Decoder( rm, mSource.getSampleType(),
// (Modulation)mComboModulations.getSelectedItem(), null );
break;
case TAIT_1200:
decoder = new Tait1200Decoder( null );
break;
default:
break;
}
if( decoder != null )
{
DecoderViewFrame decoderFrame =
new DecoderViewFrame( decoder, mSource );
decoderFrame.setVisible( true );
mDesktop.add( decoderFrame );
}
}
} );
}
}
public class NextSampleButton extends JButton
{
private static final long serialVersionUID = 1L;
private WaveSource mSource;
private int mCount;
public NextSampleButton( WaveSource source, String label, int count )
{
super( label );
mSource = source;
mCount = count;
addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent arg0 )
{
try
{
mSource.next( mCount );
}
catch ( IOException e )
{
mLog.error( "Viewer - error trying to fetch next [" +
mCount + "] samples", e );
JOptionPane.showMessageDialog( AudioSourceFrame.this,
"Cannot read " + mCount + " more samples [" +
e.getLocalizedMessage() + "]",
"Wave File Error",
JOptionPane.ERROR_MESSAGE );
}
}
} );
}
}
public class JumpToField extends JTextField
{
private static final long serialVersionUID = 1L;
private WaveSource mSource;
public JumpToField( WaveSource source )
{
super( "0" );
mSource = source;
setMinimumSize( new Dimension( 100, getHeight() ) );
addFocusListener( new FocusListener()
{
@Override
public void focusGained( FocusEvent arg0 ) {}
@Override
public void focusLost( FocusEvent arg0 )
{
try
{
long position = Long.parseLong( getText() );
mSource.jumpTo( position );
}
catch( Exception e )
{
mLog.error( "WaveSourceFrame - exception during jump "
+ "to", e );
JOptionPane.showMessageDialog( AudioSourceFrame.this,
"Can't jump to position [" + getText() + "]",
"Error",
JOptionPane.ERROR_MESSAGE );
}
}
} );
}
}
@Override
public void positionUpdated( long position, boolean reset )
{
mCurrentPosition.setText( String.valueOf( position ) );
if( reset )
{
}
}
}

View File

@@ -30,10 +30,10 @@ import org.slf4j.LoggerFactory;
import sample.Listener;
import sample.complex.Complex;
import source.wave.WaveSource.PositionListener;
import source.IFrameLocationListener;
public class ConstellationPanel extends JInternalFrame
implements PositionListener, Listener<Complex>
implements IFrameLocationListener, Listener<Complex>
{
private static final long serialVersionUID = 1L;
private final static Logger mLog =
@@ -63,10 +63,20 @@ public class ConstellationPanel extends JInternalFrame
add( mConstellation );
}
@Override
public void positionUpdated( long position, boolean reset )
{
}
public void frameLocationUpdated( int location )
{
// TODO Auto-generated method stub
}
@Override
public void frameLocationReset()
{
// TODO Auto-generated method stub
}
@Override
public void receive( Complex sample )

View File

@@ -18,7 +18,9 @@
package instrument.gui;
import instrument.Instrumentable;
import instrument.InstrumentableProcessingChain;
import instrument.tap.Tap;
import instrument.tap.TapGroup;
import instrument.tap.TapViewPanel;
import instrument.tap.stream.BinaryTap;
import instrument.tap.stream.BinaryTapViewPanel;
@@ -53,49 +55,67 @@ import javax.swing.JPopupMenu;
import javax.swing.JSeparator;
import message.Message;
import module.decode.Decoder;
import module.Module;
import module.decode.DecoderFactory;
import module.decode.config.AuxDecodeConfiguration;
import module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import record.config.RecordConfiguration;
import sample.Listener;
import sample.SampleType;
import source.wave.ComplexWaveSource;
import source.wave.FloatWaveSource;
import source.wave.WaveSource;
import source.wave.WaveSource.PositionListener;
import source.IControllableFileSource;
import source.Source;
import alias.AliasList;
import controller.ResourceManager;
import controller.channel.Channel.ChannelType;
import controller.site.Site;
import controller.system.System;
public class DecoderViewFrame extends JInternalFrame
implements PositionListener, Listener<Message>
implements Listener<Message>
{
private static final long serialVersionUID = 1L;
private final static Logger mLog =
LoggerFactory.getLogger( DecoderViewFrame.class );
private Decoder mDecoder;
private WaveSource mWaveSource;
private DecodeConfiguration mDecodeConfig;
private InstrumentableProcessingChain mProcessingChain;
private IControllableFileSource mSource;
private HashMap<Tap,TapViewPanel> mPanelMap =
new HashMap<Tap,TapViewPanel>();
public DecoderViewFrame( Decoder decoder, WaveSource source )
public DecoderViewFrame( ResourceManager resourceManager,
DecodeConfiguration decodeConfig,
RecordConfiguration recordConfig,
AuxDecodeConfiguration auxConfig,
AliasList aliasList,
IControllableFileSource source )
{
mDecoder = decoder;
mWaveSource = source;
mSource = source;
if( source.getSampleType() == SampleType.COMPLEX )
{
ComplexWaveSource cws = (ComplexWaveSource)mWaveSource;
// cws.addListener( mDecoder.getComplexReceiver() );
}
else if( source.getSampleType() == SampleType.REAL )
{
FloatWaveSource fws = (FloatWaveSource)mWaveSource;
// fws.setListener( mDecoder.getRealReceiver() );
}
mDecodeConfig = decodeConfig;
mDecoder.addMessageListener( this );
mProcessingChain = new InstrumentableProcessingChain();
List<Module> modules = DecoderFactory
.getModules( ChannelType.STANDARD,
resourceManager,
decodeConfig,
recordConfig,
auxConfig,
aliasList,
new System( "Instrumented" ),
new Site( "Instrumented" ) );
mProcessingChain.addModules( modules );
mProcessingChain.addMessageListener( this );
mProcessingChain.setSource( (Source)mSource );
initGui();
}
@@ -104,7 +124,7 @@ public class DecoderViewFrame extends JInternalFrame
{
setLayout( new MigLayout( "insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]" ) );
setTitle( "Decoder [" + mDecoder.getDecoderType().getDisplayString() + "]" );
setTitle( "Decoder [" + mDecodeConfig.getDecoderType().getDisplayString() + "]" );
setPreferredSize( new Dimension( 450, 250 ) );
setSize( 450, 250 );
@@ -121,23 +141,8 @@ public class DecoderViewFrame extends JInternalFrame
if( me.getButton() == MouseEvent.BUTTON3 )
{
JPopupMenu popup = new JPopupMenu();
if( mDecoder instanceof Instrumentable )
{
JMenu tapMenu = new JMenu( "Taps" );
popup.add( tapMenu );
Instrumentable i = (Instrumentable)mDecoder;
tapMenu.add( new AddAllTapsItem( i.getTaps() ) );
tapMenu.add( new JSeparator() );
for( Tap tap: i.getTaps() )
{
tapMenu.add( new TapSelectionItem( tap ) );
}
}
popup.add( getTapContextMenu() );
if( !mPanelMap.values().isEmpty() )
{
@@ -165,6 +170,41 @@ public class DecoderViewFrame extends JInternalFrame
} );
}
private JMenu getTapContextMenu()
{
JMenu menu = new JMenu( "Modules" );
if( mProcessingChain != null )
{
for( Module module: mProcessingChain.getModules() )
{
if( module instanceof Instrumentable )
{
List<TapGroup> groups = ((Instrumentable)module).getTapGroups();
for( TapGroup group: groups )
{
List<Tap> taps = group.getTaps();
if( !taps.isEmpty() )
{
JMenu groupMenu = new JMenu( group.getName() );
for( Tap tap: taps )
{
groupMenu.add( new TapSelectionItem( tap ) );
}
menu.add( groupMenu );
}
}
}
}
}
return menu;
}
public void add( Tap tap )
{
TapViewPanel panel = null;
@@ -207,7 +247,13 @@ public class DecoderViewFrame extends JInternalFrame
mPanelMap.put( tap, panel );
((Instrumentable)mDecoder).addTap( tap );
for( Module module: mProcessingChain.getModules() )
{
if( module instanceof Instrumentable )
{
((Instrumentable)module).registerTap( tap );
}
}
}
else
{
@@ -218,7 +264,13 @@ public class DecoderViewFrame extends JInternalFrame
public void remove( Tap tap )
{
((Instrumentable)mDecoder).removeTap( tap );
for( Module module: mProcessingChain.getModules() )
{
if( module instanceof Instrumentable )
{
((Instrumentable)module).unregisterTap( tap );
}
}
TapViewPanel panel = mPanelMap.get( tap );
@@ -289,18 +341,6 @@ public class DecoderViewFrame extends JInternalFrame
}
}
@Override
public void positionUpdated( long position, boolean reset )
{
if( reset )
{
for( TapViewPanel panel: mPanelMap.values() )
{
panel.reset();
}
}
}
@Override
public void receive( Message message )
{

View File

@@ -0,0 +1,225 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
******************************************************************************/
package instrument.gui;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.io.IOException;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import source.IControllableFileSource;
import source.IFrameLocationListener;
public class SourceControllerFrame extends JInternalFrame
implements IFrameLocationListener
{
private static final long serialVersionUID = 1L;
private final static Logger mLog =
LoggerFactory.getLogger( SourceControllerFrame.class );
private IControllableFileSource mSource;
private JDesktopPane mDesktop;
private JLabel mCurrentPosition = new JLabel( "0" );
public SourceControllerFrame( IControllableFileSource source,
JDesktopPane desktop )
{
mSource = source;
mSource.setListener( this );
mDesktop = desktop;
initGui();
}
private void initGui()
{
setTitle( "Source [" + mSource.getFile().getAbsolutePath() + "]" );
setPreferredSize( new Dimension( 670, 70 ) );
setSize( 670, 70 );
setResizable( true );
setClosable( true );
setIconifiable( true );
setMaximizable( false );
JPanel panel = new JPanel();
panel.setLayout( new MigLayout() );
JButton decoderButton = new JButton( "Decoders" );
decoderButton.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
EventQueue.invokeLater( new Runnable()
{
@Override
public void run()
{
DecoderSelectionFrame frame =
new DecoderSelectionFrame( mDesktop, mSource );
frame.setVisible( true );
mDesktop.add( frame );
}
} );
}
} );
panel.add( decoderButton );
panel.add( new JLabel( "Skip:" ) );
panel.add( new SkipFramesField( mSource ) );
panel.add( new NextFrameButton( mSource, "> 1", 1 ) );
panel.add( new NextFrameButton( mSource, "> 10", 10 ) );
panel.add( new NextFrameButton( mSource, "> 100", 100 ) );
panel.add( new NextFrameButton( mSource, "> 1000", 1000 ) );
panel.add( new JLabel( "Posn:" ) );
panel.add( mCurrentPosition, "wrap" );
add( panel );
}
public class NextFrameButton extends JButton
{
private static final long serialVersionUID = 1L;
private IControllableFileSource mSource;
private int mFrames;
public NextFrameButton( IControllableFileSource source,
String label, int frames )
{
super( label );
mSource = source;
mFrames = frames;
addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent arg0 )
{
EventQueue.invokeLater( new Runnable()
{
@Override
public void run()
{
try
{
mSource.next( mFrames );
}
catch ( IOException e )
{
mLog.error( "Viewer - reading frames [" + mFrames +
"] from source", e );
JOptionPane.showMessageDialog( SourceControllerFrame.this,
"Can't read " + mFrames + " more frames [" +
e.getLocalizedMessage() + "]",
"Wave File Error",
JOptionPane.ERROR_MESSAGE );
}
}
} );
}
} );
}
}
public class SkipFramesField extends JTextField
{
private static final long serialVersionUID = 1L;
private IControllableFileSource mSource;
public SkipFramesField( IControllableFileSource source )
{
super( "0" );
mSource = source;
setMinimumSize( new Dimension( 100, getHeight() ) );
addFocusListener( new FocusListener()
{
@Override
public void focusGained( FocusEvent arg0 ) {}
@Override
public void focusLost( FocusEvent arg0 )
{
try
{
int framesToSkip = Integer.parseInt( getText() );
mSource.next( framesToSkip, false );
}
catch( Exception e )
{
mLog.error( "WaveSourceFrame - error skipping frames", e );
JOptionPane.showMessageDialog( SourceControllerFrame.this,
"Can't skip [" + getText() + "] frames.",
"Error",
JOptionPane.ERROR_MESSAGE );
}
}
} );
}
}
@Override
public void frameLocationUpdated( final int location )
{
EventQueue.invokeLater( new Runnable()
{
@Override
public void run()
{
mCurrentPosition.setText( String.valueOf( location ) );
}
} );
}
@Override
public void frameLocationReset()
{
// TODO Auto-generated method stub
}
}

View File

@@ -42,10 +42,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import properties.SystemProperties;
import source.Source;
import source.IControllableFileSource;
import source.wave.ComplexWaveSource;
import source.wave.FloatWaveSource;
import source.wave.WaveSource;
import source.wave.RealWaveSource;
import util.TimeStamp;
public class Viewer
@@ -55,7 +54,7 @@ public class Viewer
private JFrame mFrame;
private JDesktopPane mDesktop;
private Source mSource;
private IControllableFileSource mSource;
public Viewer()
{
@@ -82,13 +81,6 @@ public class Viewer
mDesktop = new JDesktopPane();
mFrame.add( mDesktop );
// JInternalFrame frame =
// new JInternalFrame( "New", true, true, true, true );
// frame.add( new JLabel( "This is a test" ) );
// frame.pack();
// mDesktop.add( frame );
// frame.setVisible( true );
/* Menu items */
JMenuBar menuBar = new JMenuBar();
mFrame.setJMenuBar( menuBar );
@@ -110,79 +102,19 @@ public class Viewer
fileMenu.add( exitMenu );
JMenuItem screenCaptureItem = new JMenuItem( "Screen Capture" );
screenCaptureItem.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent arg0 )
{
try
{
Robot robot = new Robot();
final BufferedImage image =
robot.createScreenCapture( mFrame.getBounds() );
SystemProperties props = SystemProperties.getInstance();
Path capturePath = props.getApplicationFolder( "screen_captures" );
if( !Files.exists( capturePath ) )
{
try
{
Files.createDirectory( capturePath );
}
catch ( IOException e )
{
mLog.error( "Couldn't create 'screen_captures' "
+ "subdirectory in the " +
"SDRTrunk application directory", e );
}
}
String filename = TimeStamp.getTimeStamp( "_" ) +
"_screen_capture.png";
final Path captureFile = capturePath.resolve( filename );
EventQueue.invokeLater( new Runnable()
{
@Override
public void run()
{
try
{
ImageIO.write( image, "png",
captureFile.toFile() );
}
catch ( IOException e )
{
mLog.error( "Couldn't write screen capture to "
+ "file [" + captureFile.toString() + "]", e );
}
}} );
}
catch ( AWTException e )
{
mLog.error( "Exception while taking screen capture", e );
}
}
} );
menuBar.add( screenCaptureItem );
menuBar.add( new ScreenCaptureItem() );
}
private void setSourceFile( File file )
{
mLog.info( "File selected [" + file.getAbsolutePath() + "]");
WaveSource source = null;
IControllableFileSource source = null;
/* Attempt to open file as a 1-channel float source */
try
{
FloatWaveSource floatSource = new FloatWaveSource( file, false );
RealWaveSource floatSource = new RealWaveSource( file );
floatSource.open();
source = floatSource;
@@ -200,7 +132,7 @@ public class Viewer
/* Attempt to open file as a 2-channel complex source */
try
{
ComplexWaveSource complex = new ComplexWaveSource( file, false );
ComplexWaveSource complex = new ComplexWaveSource( file );
complex.open();
source = complex;
@@ -217,8 +149,8 @@ public class Viewer
{
mSource = source;
AudioSourceFrame sourcePanel =
new AudioSourceFrame( source, mDesktop );
SourceControllerFrame sourcePanel =
new SourceControllerFrame( source, mDesktop );
sourcePanel.setVisible( true );
mDesktop.add( sourcePanel );
}
@@ -294,4 +226,80 @@ public class Viewer
} );
}
}
public class ScreenCaptureItem extends JMenuItem
{
private static final long serialVersionUID = 1L;
public ScreenCaptureItem()
{
super( "Screen Capture" );
addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent arg0 )
{
EventQueue.invokeLater( new Runnable()
{
@Override
public void run()
{
try
{
Robot robot = new Robot();
final BufferedImage image =
robot.createScreenCapture( mFrame.getBounds() );
SystemProperties props = SystemProperties.getInstance();
Path capturePath = props.getApplicationFolder( "screen_captures" );
if( !Files.exists( capturePath ) )
{
try
{
Files.createDirectory( capturePath );
}
catch ( IOException e )
{
mLog.error( "Couldn't create 'screen_captures' "
+ "subdirectory in the " +
"SDRTrunk application directory", e );
}
}
String filename = TimeStamp.getTimeStamp( "_" ) +
"_screen_capture.png";
final Path captureFile = capturePath.resolve( filename );
EventQueue.invokeLater( new Runnable()
{
@Override
public void run()
{
try
{
ImageIO.write( image, "png",
captureFile.toFile() );
}
catch ( IOException e )
{
mLog.error( "Couldn't write screen capture to "
+ "file [" + captureFile.toString() + "]", e );
}
}} );
}
catch ( AWTException e )
{
mLog.error( "Exception while taking screen capture", e );
}
}
} );
}
} );
}
}
}