ludc
2024-09-14 36c2449aec5b51e5ed4e5c6841154b746060e09a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.vci.client.ui.process;
 
import java.awt.Color;
import java.awt.Dimension;
 
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
 
public class TestProcessBar {
 
    /**
     * @param args
     */
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setSize(new Dimension(600, 500));
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        JLabel label = new JLabel("进度:");
        
        JProgressBar progressBar = new JProgressBar(JProgressBar.HORIZONTAL,0,100);
        progressBar.setForeground(Color.green);
        progressBar.setIndeterminate(true);
        JPanel topPanel = new JPanel();
        topPanel.setPreferredSize(new Dimension(550, 25));
        topPanel.setLayout(new BoxLayout(topPanel,BoxLayout.Y_AXIS));
        topPanel.add(label);
        topPanel.add(progressBar);
        frame.add(topPanel);
        
        frame.setVisible(true);
    }
 
}