Fireworks Graphics,为什么画布不显示?

时间:2019-11-18 22:26:52

标签: java graphics coordinates fireworks

该程序假定绘制烟花的轨迹,但不打印任何内容(也不显示错误)。但是paintComponent绘制矩形和圆形,并且在特定的t秒内x1,y1,x2和y2内有值。任何建议都是有帮助的。谢谢。

#To print all filenames in a bucket
import boto3

s3 = boto3.client('s3')

def get_s3_keys(bucket):

    """Get a list of keys in an S3 bucket."""
    resp = s3.list_objects_v2(Bucket=bucket)
    for obj in resp['Contents']:
      files = obj['Key']
    return files


filename = get_s3_keys('your_bucket_name')

print(filename)

#To print all filenames in a certain directory in a bucket
import boto3

s3 = boto3.client('s3')

def get_s3_keys(bucket, prefix):

    """Get a list of keys in an S3 bucket."""
    resp = s3.list_objects_v2(Bucket=bucket, Prefix=prefix)
    for obj in resp['Contents']:
      files = obj['Key']
      print(files)
    return files


filename = get_s3_keys('your_bucket_name', 'folder_name/sub_folder_name/')

print(filename)

1 个答案:

答案 0 :(得分:0)

您已经覆盖了paintComponent(),但没有任何内容可以不断刷新以显示动画。

您需要一个游戏循环。没有一种方法可以做到,但这是一个选择。

在您的JComponent中实现可运行。通过更改animationState单击开始按钮时,启动动画。完成后将其更改回去。

@Override
public void run() {
    while( true ) {

        if( getAnimationState() == AnimationState.RUNNING ) {

            // do an animation
            repaint();

            // turn it off if we're done
            if( animationIsDone() ) {
                transitionState( animationIsDone );
            }
        }

        // pause a tad
        try {
            Thread.sleep( 250 );
        } catch (Exception e) {
            System.out.println( "Sorry, don't know what happened: " + e.toString() );
            e.printStackTrace();
        }
    }
}

还可以在JComponent中进行一些错误检查。通过不为字段输入任何值,我能够轻松使其崩溃。