Skip to content

Instantly share code, notes, and snippets.

@ulmangt
Created April 4, 2012 18:31
Show Gist options
  • Save ulmangt/2304547 to your computer and use it in GitHub Desktop.
Save ulmangt/2304547 to your computer and use it in GitHub Desktop.
package com.metsci.glimpse.examples.stacked;
import static com.metsci.glimpse.util.logging.LoggerUtils.logWarning;
import java.util.logging.Logger;
import com.metsci.glimpse.examples.Example;
import com.metsci.glimpse.plot.StackedPlot2D.PlotInfo;
import com.metsci.glimpse.plot.timeline.StackedTimePlot2D;
public class LayoutUpdateBugTest extends HorizontalTimelinePlotExample
{
private static final Logger logger = Logger.getLogger( LayoutUpdateBugTest.class.getSimpleName( ) );
public static void main( String[] args ) throws Exception
{
Example.showWithSwing( new LayoutUpdateBugTest( ) );
}
@Override
public StackedTimePlot2D getLayout( )
{
final StackedTimePlot2D plot = ( StackedTimePlot2D ) super.getLayout( );
final PlotInfo speed = plot.getPlot( "speed-plot-1-id" );
final PlotInfo viscosity = plot.getPlot( "viscosity-plot-2-id" );
( new Thread( )
{
int size = 100;
int direction = 1;
public void run( )
{
while ( true )
{
if ( size > 300 || size < 100 ) direction *= -1;
size += direction;
viscosity.setSize( size );
speed.setSize( -1 );
try
{
Thread.sleep( 20 );
}
catch ( InterruptedException e )
{
logWarning( logger, "Trouble in Resize Thread", e );
}
}
}
} ).start( );
return plot;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment