package com.connor.ml.tcm.outfile.ML_010;

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

import java.awt.Dimension;
import java.util.TimerTask;
import java.util.Timer;
import javax.swing.*;

public class ProcessBarDialog extends JFrame {

	private JProgressBar progressBar = new JProgressBar();

	private Box box = Box.createVerticalBox();

	private Box box2 = Box.createHorizontalBox();
	private String name;

	public ProcessBarDialog(String name) {
		this.name = name;
	}

	public void open() {
		this.setTitle("加载中...");

		//需要用进程调用
		
		setBounds(200, 200, 300, 100);

		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setLocationRelativeTo(null);
		progressBar.setIndeterminate(true);// 设置进度条的样式为不确定的进度条样式(进度条来回滚动)，false为确定的进度条样式(即进度条从头到尾显示)

		progressBar.setStringPainted(true);// 设置进度条显示提示信息

		progressBar.setString(name);// 设置提示信息
		progressBar.setPreferredSize(new Dimension(300, 100));

		box2.add(progressBar);
		box.add(box2);
		add(box);
		this.setAlwaysOnTop(true);
		setVisible(true);
	}

	public void close() {
		this.dispose();
	}

}
