[Jarspy-commits] CVS: JarSpy/src/com/ociweb/jarspy/gui StatusScreen.java,NONE,1.1
Status: Beta
Brought to you by:
brown_j
|
From: Jeff B. <br...@us...> - 2002-07-19 00:24:42
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui
In directory usw-pr-cvs1:/tmp/cvs-serv14043/com/ociweb/jarspy/gui
Added Files:
StatusScreen.java
Log Message:
added progress feedback screen
--- NEW FILE: StatusScreen.java ---
// JarSpy
// Copyright (c) 2001, 2002 Jeff S. Brown
// This file is part of JarSpy.
//
// JarSpy is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// JarSpy is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with JarSpy; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.ociweb.jarspy.gui;
import com.ociweb.jarspy.JarProcessingListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.border.BevelBorder;
import javax.swing.border.Border;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Window;
/**
* A screen for displaying status information as archives are being processed
*
* @version $Id: StatusScreen.java,v 1.1 2002/07/19 00:24:37 brown_j Exp $
*/
public class StatusScreen extends Window implements JarProcessingListener {
JLabel statusLabel = new JLabel("Status...");
private JProgressBar progressBar = new JProgressBar(0, 100);
public StatusScreen(JarSpyGUI parent) {
super(parent);
try {
setLayout(new BorderLayout());
JPanel p = new JPanel(new GridBagLayout());
ImageIcon icon =
new ImageIcon(getClass().getResource("images/jar.gif"));
Border titleBorder = BorderFactory.createTitledBorder("JarSpy - Processing Jar:");
Border bevelBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED,
Color.gray, Color.gray.darker());
p.setBorder(BorderFactory.createCompoundBorder(bevelBorder, titleBorder));
JLabel iconLabel = new JLabel(icon);
iconLabel.setBorder(BorderFactory.createRaisedBevelBorder());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridwidth = gbc.gridheight = 1;
gbc.gridy = gbc.RELATIVE;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.anchor = gbc.CENTER;
gbc.fill = gbc.NONE;
gbc.insets = new Insets(10, 10, 10, 10);
p.add(iconLabel, gbc);
gbc.weighty = 0;
gbc.fill = gbc.HORIZONTAL;
p.add(statusLabel, gbc);
p.add(progressBar, gbc);
add(BorderLayout.CENTER, p);
pack();
Dimension windowSize = getSize();
windowSize.width = 375;
setSize(windowSize);
Point parentLocation = parent.getLocation();
Dimension parentSize = parent.getSize();
windowSize = getSize();
int windowX = (parentSize.width / 2) +
parentLocation.x -
(windowSize.width / 2);
int windowY = (parentSize.height / 2) +
parentLocation.y -
(windowSize.height / 2);
setLocation(windowX, windowY);
} catch (Exception exc) {
exc.printStackTrace();
}
}
public void updateJarProcessingProgress(String entry, int pct) {
statusLabel.setText("Processing: " + entry);
progressBar.setValue(pct);
}
public void finishedProcessingJar() {
}
}
|