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;
}
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();
}
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);
}
}
}
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);
}
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);
}
Aggregations