Java Code Examples for javax.swing.JProgressBar#setModel()

The following examples show how to use javax.swing.JProgressBar#setModel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReferencesBrowserController.java    From netbeans with Apache License 2.0 6 votes vote down vote up
Dialog createProgressPanel(final String message, BoundedRangeModel model) {
    Dialog dialog;
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout(10, 10));
    panel.setBorder(new EmptyBorder(15, 15, 15, 15));
    panel.add(new JLabel(message), BorderLayout.NORTH);

    final Dimension ps = panel.getPreferredSize();
    ps.setSize(Math.max(ps.getWidth(), DEFAULT_WIDTH), Math.max(ps.getHeight(), DEFAULT_HEIGHT));
    panel.setPreferredSize(ps);

    final JProgressBar progress = new JProgressBar();
    if (model == null) {
        progress.setIndeterminate(true);
    } else {
        progress.setStringPainted(true);
        progress.setModel(model);
    }
    panel.add(progress, BorderLayout.SOUTH);
    dialog = DialogDisplayer.getDefault().createDialog(new DialogDescriptor(panel, Bundle.ReferencesBrowserController_ProgressDialogCaption(), true, new Object[] {  },
                                                       DialogDescriptor.CANCEL_OPTION, DialogDescriptor.RIGHT_ALIGN,
                                                       null, null));

    return dialog;
}
 
Example 2
Source File: ReferencesBrowserController.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
Dialog createProgressPanel(final String message, BoundedRangeModel model) {
    Dialog dialog;
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout(10, 10));
    panel.setBorder(new EmptyBorder(15, 15, 15, 15));
    panel.add(new JLabel(message), BorderLayout.NORTH);

    final Dimension ps = panel.getPreferredSize();
    ps.setSize(Math.max(ps.getWidth(), DEFAULT_WIDTH), Math.max(ps.getHeight(), DEFAULT_HEIGHT));
    panel.setPreferredSize(ps);

    final JProgressBar progress = new JProgressBar();
    if (model == null) {
        progress.setIndeterminate(true);
    } else {
        progress.setStringPainted(true);
        progress.setModel(model);
    }
    panel.add(progress, BorderLayout.SOUTH);
    dialog = DialogDisplayer.getDefault().createDialog(new DialogDescriptor(panel, Bundle.ReferencesBrowserController_ProgressDialogCaption(), true, new Object[] {  },
                                                       DialogDescriptor.CANCEL_OPTION, DialogDescriptor.RIGHT_ALIGN,
                                                       null, null));

    return dialog;
}
 
Example 3
Source File: JComponentBuilders.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void setupInstance(JProgressBar instance) {
    super.setupInstance(instance);
    
    instance.setBorderPainted(paintBorder);
    if (model != null) instance.setModel(model.createInstance());
    if (progressString != null) instance.setString(progressString);
    instance.setStringPainted(paintString);
    instance.setIndeterminate(indeterminate);
}
 
Example 4
Source File: JComponentBuilders.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
protected void setupInstance(JProgressBar instance) {
    super.setupInstance(instance);
    
    instance.setBorderPainted(paintBorder);
    if (model != null) instance.setModel(model.createInstance());
    if (progressString != null) instance.setString(progressString);
    instance.setStringPainted(paintString);
    instance.setIndeterminate(indeterminate);
}