当前位置: 首页>>代码示例>>Java>>正文


Java JProgressBar类代码示例

本文整理汇总了Java中charvax.swing.JProgressBar的典型用法代码示例。如果您正苦于以下问题:Java JProgressBar类的具体用法?Java JProgressBar怎么用?Java JProgressBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JProgressBar类属于charvax.swing包,在下文中一共展示了JProgressBar类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LogWindow

import charvax.swing.JProgressBar; //导入依赖的package包/类
public LogWindow(PipedInputStream logInput, InstallerConfig config, int pluginCount, boolean cleanOnly) {
	super("Build Log");
	_fileLogEnabled = config.getFileLogging();
	_suppressLog = config.getSuppressLog();
	_logInput = logInput;
	_pluginCount = pluginCount;
	_cleanOnly = cleanOnly;
	Container contentPane = getContentPane();
	contentPane.setLayout(new BorderLayout());
	JPanel centerPanel = new JPanel();
	BorderLayout centerLayout = new BorderLayout();
	centerPanel.setLayout(centerLayout);
	_logArea = new JTextArea();
	_logArea.setLineWrap(true);
	_logArea.setEditable(false);
	if (_suppressLog) {
		_logArea.setText("LOGGING SUPPRESSED");
	} else {
		_logArea.setText("");
	}
	JScrollPane logPane = new JScrollPane(_logArea);
	TitledBorder pluginBorder = new TitledBorder(new LineBorder(Color.white));
	pluginBorder.setTitle("Plugin Build Log");
	logPane.setViewportBorder(pluginBorder);
	_logArea.setColumns(toolkit.getScreenColumns() - 4);
	_logArea.setRows(toolkit.getScreenRows() - 12);
	centerPanel.add(logPane, BorderLayout.CENTER);
	contentPane.add(centerPanel, BorderLayout.CENTER);
	JPanel southPanel = new JPanel();
	GridBagLayout southLayout = new GridBagLayout();
	southPanel.setLayout(southLayout);
	_progressBar = new JProgressBar(0, _pluginCount);
	_progressBar.setValue(0);
	if (_cleanOnly) {
		_progressBar.setString("Cleaned 0/"+_pluginCount+" plugins");
	} else {
		_progressBar.setString("Built 0/"+_pluginCount+" plugins");
	}
	_progressBar.setStringPainted(true);
	_progressBar.setSize(new Dimension(toolkit.getScreenColumns() - 4, 1));
	southPanel.add(_progressBar, new GridBagConstraints(0,0,1,1,100.0,0.0
			,GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 1, 0, 1), 0, 0));
	_okButton = new JButton();
	_okButton.setText("OK");
	_okButton.setEnabled(false);
	_okButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			setVisible(false);
		}
	});
	southPanel.add(_okButton, new GridBagConstraints(0,1,1,1,100.0,0.0
			,GridBagConstraints.SOUTH, GridBagConstraints.NONE, new Insets(0, 1, 0, 1), 0, 0));
	contentPane.add(southPanel, BorderLayout.SOUTH);
	setSize(toolkit.getScreenColumns(),toolkit.getScreenRows() - 6);
	setLocation(0,2);
	validate();
}
 
开发者ID:drftpd-ng,项目名称:drftpd3,代码行数:58,代码来源:LogWindow.java


注:本文中的charvax.swing.JProgressBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。