本文整理汇总了Java中javax.swing.JProgressBar.setIndeterminate方法的典型用法代码示例。如果您正苦于以下问题:Java JProgressBar.setIndeterminate方法的具体用法?Java JProgressBar.setIndeterminate怎么用?Java JProgressBar.setIndeterminate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JProgressBar
的用法示例。
在下文中一共展示了JProgressBar.setIndeterminate方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showUpgradeDialog
import javax.swing.JProgressBar; //导入方法依赖的package包/类
private static boolean showUpgradeDialog (final File source, String note) {
Util.setDefaultLookAndFeel();
JPanel panel = new JPanel(new BorderLayout());
panel.add(new AutoUpgradePanel (source.getAbsolutePath (), note), BorderLayout.CENTER);
JProgressBar progressBar = new JProgressBar(0, 100);
progressBar.setValue(0);
progressBar.setStringPainted(true);
progressBar.setIndeterminate(true);
panel.add(progressBar, BorderLayout.SOUTH);
progressBar.setVisible(false);
JButton bYES = new JButton("Yes");
bYES.setMnemonic(KeyEvent.VK_Y);
JButton bNO = new JButton("No");
bNO.setMnemonic(KeyEvent.VK_N);
JButton[] options = new JButton[] {bYES, bNO};
JOptionPane p = new JOptionPane (panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null, options, bYES);
JDialog d = Util.createJOptionProgressDialog(p, NbBundle.getMessage (AutoUpgrade.class, "MSG_Confirmation_Title"), source, progressBar);
d.setVisible (true);
return new Integer (JOptionPane.YES_OPTION).equals (p.getValue ());
}
示例2: createProgressPanel
import javax.swing.JProgressBar; //导入方法依赖的package包/类
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;
}
示例3: showUI
import javax.swing.JProgressBar; //导入方法依赖的package包/类
private static void showUI(){
sFrame = new JFrame();
JProgressBar progressBar = new JProgressBar();
progressBar.setVisible(false);
progressBar.setIndeterminate(false);
progressBar.setIndeterminate(true);
progressBar.setIndeterminate(false);
progressBar.setValue(10);
progressBar.setString("Progress");
sFrame.add(progressBar);
sProgressBar = new WeakReference<>(progressBar);
sFrame.setSize(200,200);
sFrame.setVisible(true);
}
示例4: SplashScreen
import javax.swing.JProgressBar; //导入方法依赖的package包/类
/**
* Constructor
*
* @throws HeadlessException
*/
public SplashScreen(final JFrame parent, final boolean showImage, final int startupStepsCount) throws HeadlessException {
super(parent, ModalityType.APPLICATION_MODAL);
final String version = Resources.getVersion();
if (showImage) {
final Image image = Resources.getImageIcon("splashscreen.jpg").getImage();
getContentPane().add(new ImageComponent(image, new String[] { "Open Visual Traceroute", version + " Leo Lewis" }), BorderLayout.CENTER);
}
_progress = new JProgressBar(1, startupStepsCount);
_progress.setIndeterminate(false);
_progress.setStringPainted(true);
_progress.setPreferredSize(new Dimension(500, _progress.getPreferredSize().height));
getContentPane().add(_progress, BorderLayout.SOUTH);
setFocusable(false);
setUndecorated(true);
pack();
setLocationRelativeTo(null);
}
示例5: init
import javax.swing.JProgressBar; //导入方法依赖的package包/类
private void init() {
lblInfo = new JLabel("Extracting...");
lblInfo.setBounds(5, 5, 100, 15);
frame.getContentPane().add(lblInfo);
bar = new JProgressBar();
bar.setIndeterminate(true);
bar.setBounds(5, 20, 280, 30);
frame.getContentPane().add(bar);
frame.setVisible(true);
new Thread(new Runnable() {
public void run() {
extract();
}
}).start();
}
示例6: setupInstance
import javax.swing.JProgressBar; //导入方法依赖的package包/类
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);
}
示例7: ProgressDialog
import javax.swing.JProgressBar; //导入方法依赖的package包/类
@SuppressWarnings("nls")
private ProgressDialog(JDialog dialog)
{
this.dialog = dialog;
progress = new JProgressBar();
progress.setIndeterminate(true);
setLayout(new MigLayout("wrap 1, fill", "[200px,grow,fill]"));
add(progress);
}
示例8: DBInstallerGUI
import javax.swing.JProgressBar; //导入方法依赖的package包/类
public DBInstallerGUI(Connection con)
{
super("Database Installer");
setLayout(new BorderLayout());
setDefaultLookAndFeelDecorated(true);
setIconImage(ImagesTable.getImage("l2j.png").getImage());
_con = con;
final int width = 480;
final int height = 360;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false);
_progBar = new JProgressBar();
_progBar.setIndeterminate(true);
add(_progBar, BorderLayout.PAGE_START);
_progArea = new JTextArea();
final JScrollPane scrollPane = new JScrollPane(_progArea);
_progArea.setEditable(false);
appendToProgressArea("Connected");
add(scrollPane, BorderLayout.CENTER);
}
示例9: createComponent
import javax.swing.JProgressBar; //导入方法依赖的package包/类
public static JComponent createComponent() {
JPanel panel = new JPanel(new BorderLayout());
panel.setDoubleBuffered(false);
panel.add(new JButton("Press me!"), BorderLayout.NORTH);
JProgressBar bar = new JProgressBar() {
protected void paintComponent(java.awt.Graphics g) {
if (g instanceof GLGraphics2D
) {
super.paintComponent(g);
} else {
System.out.println(g.getClass());
}
}
};
bar.setIndeterminate(true);
panel.add(bar, BorderLayout.SOUTH);
panel.add(new JSlider(SwingConstants.VERTICAL, 0, 10, 3), BorderLayout.EAST);
ButtonGroup grp = new ButtonGroup();
JRadioButton radio1 = new JRadioButton("FM");
JRadioButton radio2 = new JRadioButton("AM");
grp.add(radio1);
grp.add(radio2);
JPanel panel2 = new JPanel(new GridLayout(0, 1));
panel2.add(radio1);
panel2.add(radio2);
JComboBox b = new JComboBox(new String[] {"3", "4"});
panel.add(b, BorderLayout.WEST);
panel.setBorder(BorderFactory.createTitledBorder("Border"));
return panel;
}
示例10: TaskPanel
import javax.swing.JProgressBar; //导入方法依赖的package包/类
public TaskPanel(String name, Thread task) {
super( new BorderLayout() );
this.name = name;
this.task = task;
JLabel nameL = new JLabel(name);
nameL.setBorder(BorderFactory.createEmptyBorder(1, 2, 1, 1));
add(nameL, BorderLayout.NORTH);
if (task instanceof StartStopThread) {
JButton stopB = new JButton("X");
stopB.setMargin( new Insets(0,1,0,1));
stopB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
TaskPanel.this.task.interrupt();
((StartStopThread) TaskPanel.this.task).stopTask();
}
});
add(stopB, BorderLayout.EAST);
}
JProgressBar pb = new JProgressBar();
pb.setIndeterminate(true);
add(pb);
setBorder( BorderFactory.createLineBorder(Color.black));
int minWidth = getMinimumSize().width;
int minHeight = getMinimumSize().height;
int maxWidth = getMaximumSize().width;
setPreferredSize(new Dimension(minWidth, minHeight));
setMaximumSize(new Dimension(maxWidth, minHeight));
}
示例11: SearchingProgressDialog
import javax.swing.JProgressBar; //导入方法依赖的package包/类
/**
* Create the dialog.
*/
public SearchingProgressDialog() {
setTitle("Doing web search");
setBounds(100, 100, 394, 124);
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
handler = new SearchingProgressHandler() {
@Override
public boolean onStart() {
lblStatus.setText("Status: Search started. Waiting request to response...");
pb.setIndeterminate(false);
return true;
}
@Override
public boolean onPause() {
return true;
}
@Override
public boolean onLoopStart() {
return true;
}
@Override
public boolean onLoopEnd() {
lblStatus.setText("Status: Relieving result. Completed: " + this.getCompletedPages() + "/" + this.getTotalPages() + " Total result: " + this.getBeatmapIndexed());
pb.setValue((int) ((float) this.getCompletedPages() / this.getTotalPages() * 100));
return true;
}
@Override
public boolean onError() {
lblStatus.setText("Status: Errored!");
lblStatus.setForeground(Color.RED);
JOptionPane.showMessageDialog(SearchingProgressDialog.this, "Error occurred! Please check error dumps under \"osumer2 -> View Dumps\"", "Error", JOptionPane.ERROR_MESSAGE);
dispose();
return false;
}
@Override
public boolean onComplete() {
lblStatus.setText("Status: Completed. Total result: " + this.getBeatmapIndexed());
return true;
}
};
lblStatus = new JLabel("Status: Waiting to start...");
lblStatus.setFont(new Font("Tahoma", Font.PLAIN, 12));
pb = new JProgressBar();
pb.setIndeterminate(true);
GroupLayout groupLayout = new GroupLayout(getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addComponent(pb, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 358, Short.MAX_VALUE)
.addComponent(lblStatus, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE))
.addContainerGap())
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(lblStatus)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(pb, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE)
.addContainerGap(43, Short.MAX_VALUE))
);
getContentPane().setLayout(groupLayout);
}
示例12: ProgressDialog
import javax.swing.JProgressBar; //导入方法依赖的package包/类
public ProgressDialog(JFrame parentFrame) {
super(parentFrame, "", true);
translator = Translator.getInstance();
setTitle(translator.getTranslation(Tags.CLONE_PROGRESS_DIALOG_TITLE));
noteLabel = new JLabel();
progressBar = new JProgressBar();
progressBar.setStringPainted(false);
progressBar.setIndeterminate(true);
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.insets = new Insets(0, 15, 5, 15);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.NORTHWEST;
panel.add(new JLabel(), gbc);
gbc.gridy++;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.insets = new Insets(0, 5, 0, 5);
panel.add(progressBar, gbc);
gbc.gridy++;
gbc.weightx = 0;
gbc.insets = new Insets(0, 5, 10, 5);
panel.add(noteLabel, gbc);
add(panel);
getOkButton().setVisible(false);
pack();
setLocationRelativeTo(parentFrame);
setMinimumSize(new Dimension(370, 150));
setResizable(false);
}