|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.tasklist.compiler; import java.awt.GridBagConstraints; import java.text.MessageFormat; import java.util.ResourceBundle; import org.openide.util.NbBundle; /** * Panel with progress bar and error messages * * @author Tim Lebedkov */ public class ProgressPanel extends javax.swing.JPanel { private static final long serialVersionUID = 1; private ResourceBundle bundle; private MessageFormat errors, filt; /** * Creates new form ProgressPanel */ public ProgressPanel() { bundle = NbBundle.getBundle(ProgressPanel.class); errors = new MessageFormat(bundle.getString("MSG_Errors")); // NOI18N filt = new MessageFormat(bundle.getString("MSG_Filtered")); // NOI18N initComponents(); setProgressBarVisible(false); setErrors(0, 0, 0, 0); } /** * Sets new Message * * @param text new message */ public void setLabel(String text) { jLabel.setText(text); } /** * Changes number of found errors, warnings and infos * * @param err number of errors * @param warn number of warnings * @param info number of infos * @param filtered number of the messages that were filtered out */ public void setErrors(int err, int warn, int info, int filtered) { String s = errors.format(new Object[] { new Integer(err), new Integer(warn), new Integer(info) }).trim(); if (filtered != 0) { s += " | " + filt.format(new Object[] {new Integer(filtered)}); // NOI18N } jLabelErrors.setText(s); } /** * Sets new progress * * @param p progress in percents */ public void setProgress(int p) { jProgressBar.setValue(p); } /** * Shows/hides the progress bar * * @param v true = show, false = hide */ public void setProgressBarVisible(boolean v) { if (v == (jProgressBar.getParent() != null)) return; if (v) { GridBagConstraints gbc = new java.awt.GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.insets = new java.awt.Insets(0, 0, 0, 12); add(jProgressBar, gbc); } else { remove(jProgressBar); } } /** * This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; jLabel = new javax.swing.JLabel(); jProgressBar = new javax.swing.JProgressBar(); jLabelErrors = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(2, 2, 2, 2))); jLabel.setText(org.openide.util.NbBundle.getMessage(ProgressPanel.class, "NothingToCompile")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12); add(jLabel, gridBagConstraints); jProgressBar.setPreferredSize(new java.awt.Dimension(148, 10)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12); add(jProgressBar, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; add(jLabelErrors, gridBagConstraints); }//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel; private javax.swing.JLabel jLabelErrors; private javax.swing.JProgressBar jProgressBar; // End of variables declaration//GEN-END:variables } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.