Search in sources :

Example 36 with JProgressBar

use of javax.swing.JProgressBar in project zaproxy by zaproxy.

the class AbstractScanToolbarStatusPanel method getProgressBar.

private JProgressBar getProgressBar() {
    if (progressBar == null) {
        progressBar = new JProgressBar(0, 100);
        progressBar.setValue(0);
        progressBar.setSize(new Dimension(80, 20));
        progressBar.setStringPainted(true);
        progressBar.setEnabled(false);
    }
    return progressBar;
}
Also used : JProgressBar(javax.swing.JProgressBar) Dimension(java.awt.Dimension)

Example 37 with JProgressBar

use of javax.swing.JProgressBar in project SKMCLauncher by SKCraft.

the class ProgressDialog method buildUI.

private void buildUI() {
    JPanel container = new JPanel();
    container.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS));
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
    progressBar = new JProgressBar();
    progressBar.setMinimum(0);
    progressBar.setMaximum(1000);
    buttonPanel.add(progressBar);
    buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
    cancelButton = new JButton("Cancel");
    buttonPanel.add(cancelButton);
    container.add(buttonPanel);
    JPanel statusPanel = new JPanel();
    statusPanel.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
    statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.LINE_AXIS));
    statusLabel = new JLabel("Initializing...", SwingConstants.LEADING);
    statusPanel.add(statusLabel);
    statusPanel.add(Box.createHorizontalGlue());
    container.add(statusPanel);
    add(container);
    cancelButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            tryCancelling();
        }
    });
    pack();
}
Also used : JPanel(javax.swing.JPanel) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JProgressBar(javax.swing.JProgressBar) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 38 with JProgressBar

use of javax.swing.JProgressBar in project SKMCLauncher by SKCraft.

the class WebpageLayoutManager method layoutContainer.

@Override
public void layoutContainer(Container parent) {
    Insets insets = parent.getInsets();
    int maxWidth = parent.getWidth() - (insets.left + insets.right);
    int maxHeight = parent.getHeight() - (insets.top + insets.bottom);
    int numComps = parent.getComponentCount();
    for (int i = 0; i < numComps; i++) {
        Component comp = parent.getComponent(i);
        if (comp instanceof JProgressBar) {
            Dimension size = comp.getPreferredSize();
            comp.setLocation((parent.getWidth() - PROGRESS_WIDTH) / 2, (int) (parent.getHeight() / 2.0 - size.height / 2.0));
            comp.setSize(PROGRESS_WIDTH, (int) comp.getPreferredSize().height);
        } else {
            comp.setLocation(insets.left, insets.top);
            comp.setSize(maxWidth, maxHeight);
        }
    }
}
Also used : Insets(java.awt.Insets) JProgressBar(javax.swing.JProgressBar) Dimension(java.awt.Dimension) Component(java.awt.Component)

Example 39 with JProgressBar

use of javax.swing.JProgressBar in project jgnash by ccavanaugh.

the class BootLoaderDialog method initComponents.

private void initComponents() {
    GridBagConstraints gridBagConstraints;
    JScrollPane jScrollPane = new JScrollPane();
    JTextArea messageArea = new JTextArea();
    progressBar = new JProgressBar();
    progressBar.setMinimum(0);
    progressBar.setMaximum(100);
    progressBar.setStringPainted(true);
    JButton cancelButton = new JButton(ResourceUtils.getString("Button.Cancel"));
    cancelButton.addActionListener(evt -> cancelButtonActionPerformed());
    activeDownloadLabel = new JLabel();
    activeDownloadLabel.setFocusable(false);
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Please Wait");
    setAlwaysOnTop(true);
    setMinimumSize(new java.awt.Dimension(430, 220));
    getContentPane().setLayout(new GridBagLayout());
    jScrollPane.setBorder(null);
    messageArea.setEditable(false);
    messageArea.setColumns(20);
    messageArea.setRows(3);
    messageArea.setText(ResourceUtils.getString("Message.OpenJfxDownload"));
    messageArea.setWrapStyleWord(true);
    messageArea.setFocusable(false);
    messageArea.setOpaque(false);
    messageArea.setRequestFocusEnabled(false);
    jScrollPane.setViewportView(messageArea);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(12, 12, 12, 12);
    getContentPane().add(jScrollPane, gridBagConstraints);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipadx = 677;
    gridBagConstraints.insets = new Insets(6, 12, 12, 12);
    getContentPane().add(progressBar, gridBagConstraints);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 12);
    getContentPane().add(cancelButton, gridBagConstraints);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new Insets(12, 12, 6, 12);
    getContentPane().add(activeDownloadLabel, gridBagConstraints);
    pack();
    setLocationRelativeTo(null);
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JTextArea(javax.swing.JTextArea) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JProgressBar(javax.swing.JProgressBar) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel)

Example 40 with JProgressBar

use of javax.swing.JProgressBar in project cayenne by apache.

the class ProgressDialog method init.

private void init(String message) {
    progressBar = new JProgressBar();
    statusLabel = new JLabel(message, SwingConstants.LEFT);
    JLabel messageLabel = new JLabel(message, SwingConstants.LEFT);
    cancelButton = new JButton("Cancel");
    // assemble
    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("fill:max(250dlu;pref)", "p, 3dlu, p, 3dlu, p");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.add(messageLabel, cc.xy(1, 1));
    builder.add(progressBar, cc.xy(1, 3));
    builder.add(statusLabel, cc.xy(1, 5));
    getRootPane().setDefaultButton(cancelButton);
    JPanel buttons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttons.add(cancelButton);
    Container root = getContentPane();
    root.setLayout(new BorderLayout(5, 5));
    root.add(builder.getPanel(), BorderLayout.CENTER);
    root.add(buttons, BorderLayout.SOUTH);
    setResizable(false);
    pack();
    ModelerUtil.centerWindow(getOwner(), this);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) JPanel(javax.swing.JPanel) PanelBuilder(com.jgoodies.forms.builder.PanelBuilder) Container(java.awt.Container) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) JProgressBar(javax.swing.JProgressBar) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Aggregations

JProgressBar (javax.swing.JProgressBar)87 JLabel (javax.swing.JLabel)53 JPanel (javax.swing.JPanel)40 JButton (javax.swing.JButton)32 Dimension (java.awt.Dimension)30 BorderLayout (java.awt.BorderLayout)28 ActionEvent (java.awt.event.ActionEvent)20 JScrollPane (javax.swing.JScrollPane)20 ActionListener (java.awt.event.ActionListener)16 Insets (java.awt.Insets)14 IOException (java.io.IOException)14 GridBagConstraints (java.awt.GridBagConstraints)13 GridBagLayout (java.awt.GridBagLayout)13 FlowLayout (java.awt.FlowLayout)12 JCheckBox (javax.swing.JCheckBox)12 ArrayList (java.util.ArrayList)11 JDialog (javax.swing.JDialog)11 File (java.io.File)10 ImageIcon (javax.swing.ImageIcon)10 JComboBox (javax.swing.JComboBox)9