javax.swing.JProgressBar Java Examples
The following examples show how to use
javax.swing.JProgressBar.
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: DemoTheatreApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 6 votes |
/** * Creates a progress bar. * * @param parent progress bar's parent. The horizontal axis of the progress bar will be center-aligned to the parent. * @return a progress bar. */ private static JProgressBar createProgressBar(final JComponent parent) { final JProgressBar progressBar = new JProgressBar(); progressBar.setSize(260, 20); parent.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { progressBar.setLocation( parent.getWidth() / 2 - progressBar.getWidth() / 2, parent.getHeight() - progressBar.getHeight() - 20); } }); progressBar.setStringPainted(true); progressBar.setIndeterminate(true); progressBar.setVisible(false); return progressBar; }
Example #2
Source File: JProgressBarOrientationRobotTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void createUI(final String shortenedLookAndFeelString) throws Exception { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { progressBar = new JProgressBar(); progressBar.setValue(30); frame = new JFrame(shortenedLookAndFeelString); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(progressBar); frame.pack(); frame.setSize(500, frame.getSize().height); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.toFront(); } }); }
Example #3
Source File: LoginLogic.java From raccoon4 with Apache License 2.0 | 6 votes |
@Override protected JPanel assemble() { progress = new JProgressBar(); status = new HyperTextPane(" ") .withTransparency().withWidth(400); JPanel ret = new JPanel(); ret.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.gridx = 0; gbc.gridy = 0; gbc.insets.top = 20; ret.add(progress, gbc); gbc.weighty = 1; gbc.gridy++; gbc.fill = GridBagConstraints.BOTH; ret.add(status, gbc); return ret; }
Example #4
Source File: ProgressHandleFactoryTest.java From netbeans with Apache License 2.0 | 6 votes |
@RandomlyFails // NB-Core-Build #1176 public void testCustomComponentIsInitialized() { Controller.defaultInstance = new TestController(); ProgressHandle handle = ProgressHandleFactory.createHandle("task 1"); // Warning, this will make the handle to work with a new Controller, not TestController. JComponent component = ProgressHandleFactory.createProgressComponent(handle); handle.start(15); handle.progress(2); waitForTimerFinish(); assertEquals(15, ((JProgressBar) component).getMaximum()); assertEquals(2, ((JProgressBar) component).getValue()); handle = ProgressHandleFactory.createHandle("task 2"); component = ProgressHandleFactory.createProgressComponent(handle); handle.start(20); waitForTimerFinish(); assertEquals(20, ((JProgressBar) component).getMaximum()); assertEquals(0, ((JProgressBar) component).getValue()); }
Example #5
Source File: PCGenStatusBar.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
PCGenStatusBar(PCGenFrame frame) { this.frame = frame; this.messageLabel = new JLabel(); this.progressBar = new JProgressBar(); this.loadStatusButton = new Button(); setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); add(messageLabel); add(Box.createHorizontalGlue()); progressBar.setStringPainted(true); progressBar.setVisible(false); add(progressBar); add(Box.createHorizontalGlue()); JFXPanel wrappedButton = GuiUtility.wrapParentAsJFXPanel(loadStatusButton); //todo: calculate this rather than hard code wrappedButton.setMaximumSize(new Dimension(750, 20000000)); add(wrappedButton); loadStatusButton.setOnAction(this::loadStatusLabelAction); }
Example #6
Source File: Utils.java From netbeans with Apache License 2.0 | 6 votes |
private static void watchProgressBar(TestData data, JFrameOperator frame, String label) { new JLabelOperator(frame, label); //dirty hack JProgressBarOperator progressBar = new JProgressBarOperator(frame); long waitingTime; for (waitingTime = 0; waitingTime < Utils.MAX_INSTALATION_WAIT; waitingTime += Utils.DELAY) { int val = ((JProgressBar) progressBar.getSource()).getValue(); if (val >= 100) { break; } Utils.waitSecond(data, 5); } if (waitingTime >= Utils.MAX_INSTALATION_WAIT) { TestCase.fail("Installation timeout"); } }
Example #7
Source File: ProgressBarMemoryLeakTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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); }
Example #8
Source File: ProgressWindow.java From triplea with GNU General Public License v3.0 | 6 votes |
/** * Initializes a new instance of the {@code ProgressWindow} class. * * @param owner The frame from which the window is displayed; if {@code null} the shared owner * will be used and this window will not be focusable. * @param title The progress message; may be {@code null}. */ public ProgressWindow(final Frame owner, final String title) { super(owner); final JLabel label = new JLabel(title); label.setBorder(new EmptyBorder(10, 10, 10, 10)); final JProgressBar progressBar = new JProgressBar(); progressBar.setBorder(new EmptyBorder(10, 10, 10, 10)); progressBar.setIndeterminate(true); final JPanel panel = new JPanel(); panel.setBorder(new LineBorder(Color.BLACK)); panel.setLayout(new BorderLayout()); panel.add(BorderLayout.NORTH, label); panel.add(progressBar, BorderLayout.CENTER); setLayout(new BorderLayout()); setSize(200, 80); add(panel, BorderLayout.CENTER); pack(); setLocationRelativeTo(owner); }
Example #9
Source File: ProgressDialog.java From triplea with GNU General Public License v3.0 | 6 votes |
private static Component newContent(final String message) { final JPanel panel = new JPanel(); panel.setBorder(new LineBorder(Color.BLACK)); panel.setLayout(new BorderLayout()); final JLabel label = new JLabel(message); label.setBorder(new EmptyBorder(10, 10, 10, 10)); panel.add(BorderLayout.NORTH, label); final JProgressBar progressBar = new JProgressBar(); progressBar.setBorder(new EmptyBorder(10, 10, 10, 10)); progressBar.setIndeterminate(true); panel.add(progressBar, BorderLayout.CENTER); return panel; }
Example #10
Source File: ProgressBarMemoryLeakTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
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); }
Example #11
Source File: StatusBar.java From Gaalop with GNU Lesser General Public License v3.0 | 6 votes |
public StatusBar() { Font font = new Font("Arial", Font.PLAIN, FontSize.getGuiFontSize()); setLayout(new BorderLayout(10, 0)); progressBar = new JProgressBar(); statusLabel = new JLabel(); statusLabel.setFont(font); statusLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (ex != null) { ErrorDialog.show(ex); } if (warnings != null) { displayWarnings(); } } }); setStatus("Ready"); add(statusLabel, BorderLayout.WEST); add(progressBar, BorderLayout.CENTER); add(new JLabel(spacer), BorderLayout.EAST); }
Example #12
Source File: ProgressBarMemoryLeakTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void executeTestCase(String lookAndFeelString) throws Exception{ if (tryLookAndFeel(lookAndFeelString)) { EventQueue.invokeAndWait( new Runnable() { @Override public void run() { showUI(); } } ); EventQueue.invokeAndWait( new Runnable() { @Override public void run() { disposeUI(); } } ); Util.generateOOME(); JProgressBar progressBar = sProgressBar.get(); if ( progressBar != null ) { throw new RuntimeException( "Progress bar (using L&F: " + lookAndFeelString + ") should have been GC-ed" ); } } }
Example #13
Source File: ProgressPanel.java From jadx with Apache License 2.0 | 6 votes |
public ProgressPanel(final MainWindow mainWindow, boolean showCancelButton) { this.showCancelButton = showCancelButton; progressLabel = new JLabel(); progressBar = new JProgressBar(0, 100); progressBar.setIndeterminate(true); progressBar.setStringPainted(false); progressLabel.setLabelFor(progressBar); setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); setVisible(false); add(progressLabel); add(progressBar); cancelButton = new JButton(ICON_CANCEL); cancelButton.setPreferredSize(new Dimension(ICON_CANCEL.getIconWidth(), ICON_CANCEL.getIconHeight())); cancelButton.setToolTipText("Cancel background jobs"); cancelButton.setBorderPainted(false); cancelButton.setFocusPainted(false); cancelButton.setContentAreaFilled(false); cancelButton.addActionListener(e -> mainWindow.cancelBackgroundJobs()); cancelButton.setVisible(showCancelButton); add(cancelButton); }
Example #14
Source File: ProgressBarMemoryLeakTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
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); }
Example #15
Source File: ProgressBarMemoryLeakTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static void executeTestCase(String lookAndFeelString) throws Exception{ if (tryLookAndFeel(lookAndFeelString)) { EventQueue.invokeAndWait( new Runnable() { @Override public void run() { showUI(); } } ); EventQueue.invokeAndWait( new Runnable() { @Override public void run() { disposeUI(); } } ); Util.generateOOME(); JProgressBar progressBar = sProgressBar.get(); if ( progressBar != null ) { throw new RuntimeException( "Progress bar (using L&F: " + lookAndFeelString + ") should have been GC-ed" ); } } }
Example #16
Source File: StartupPanel.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
/** * Create a new instance of StartupPanel * @param gameModeFileLoader * @param campaignFileLoader */ public StartupPanel(GameModeFileLoader gameModeFileLoader, CampaignFileLoader campaignFileLoader) { this.gameModeFileLoader = gameModeFileLoader; this.campaignFileLoader = campaignFileLoader; message = new JPanel(); message.setLayout(new UnstretchingGridLayout(0, 1)); message .add(new JLabel("Welcome to the PCGen " + PCGenPropBundle.getProdVersionSeries() + " Data Converter...")); message.add(new JLabel(" ")); message.add(new JLabel("Loading Game Modes and Campaign Information.")); message.add(new JLabel(" ")); progressBar = new JProgressBar(0, 3); progressBar.setValue(0); progressBar.setStringPainted(true); message.add(progressBar); message.add(new JLabel(" ")); }
Example #17
Source File: SendFileFrame.java From myqq with MIT License | 6 votes |
/** * Create the frame. */ public SendFileFrame() { //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 510, 196); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); lbl = new JLabel("进度条"); lbl.setBounds(42, 35, 74, 33); contentPane.add(lbl); progressBar = new JProgressBar(); progressBar.setForeground(Color.BLUE); progressBar.setBounds(96, 35, 332, 33); contentPane.add(progressBar); lblProgress = new JLabel(""); lblProgress.setBounds(64, 82, 386, 58); contentPane.add(lblProgress); }
Example #18
Source File: PrintPreviewDialog.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
private PrintPreviewDialog(PCGenFrame frame) { super(frame, true); this.frame = frame; this.character = frame.getSelectedCharacterRef().get(); this.previewPanelParent = new JPanel(new GridLayout(1, 1)); this.sheetBox = new JComboBox<>(); this.progressBar = new JProgressBar(); this.pageBox = new JComboBox<>(); this.zoomBox = new JComboBox<>(); this.zoomInButton = new JButton(); this.zoomOutButton = new JButton(); this.printButton = new JButton(); this.cancelButton = new JButton(); initComponents(); initLayout(); pack(); new SheetLoader().execute(); }
Example #19
Source File: ProgressBarMemoryLeakTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void executeTestCase(String lookAndFeelString) throws Exception{ if (tryLookAndFeel(lookAndFeelString)) { EventQueue.invokeAndWait( new Runnable() { @Override public void run() { showUI(); } } ); EventQueue.invokeAndWait( new Runnable() { @Override public void run() { disposeUI(); } } ); Util.generateOOME(); JProgressBar progressBar = sProgressBar.get(); if ( progressBar != null ) { throw new RuntimeException( "Progress bar (using L&F: " + lookAndFeelString + ") should have been GC-ed" ); } } }
Example #20
Source File: CollapseSimulatorGUI.java From rcrs-server with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** Construct a collapse simulator GUI. */ public CollapseSimulatorGUI() { super(new GridLayout(0, 2)); timeLabel = new JLabel("Not started"); statusLabel = new JLabel("Not started"); collapseProgress = new JProgressBar(0, 1); fireProgress = new JProgressBar(0, 1); blockadeProgress = new JProgressBar(0, 1); collapseProgress.setStringPainted(true); fireProgress.setStringPainted(true); blockadeProgress.setStringPainted(true); add(new JLabel("Timestep")); add(timeLabel); add(new JLabel("Status")); add(statusLabel); add(new JLabel("Collapsing buildings")); add(collapseProgress); add(new JLabel("Fire damage")); add(fireProgress); add(new JLabel("Creating blockades")); add(blockadeProgress); }
Example #21
Source File: StartupPanel.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
/** * Create a new instance of StartupPanel * @param gameModeFileLoader * @param campaignFileLoader */ public StartupPanel(GameModeFileLoader gameModeFileLoader, CampaignFileLoader campaignFileLoader) { this.gameModeFileLoader = gameModeFileLoader; this.campaignFileLoader = campaignFileLoader; message = new JPanel(); message.setLayout(new UnstretchingGridLayout(0, 1)); message .add(new JLabel("Welcome to the PCGen " + PCGenPropBundle.getProdVersionSeries() + " Data Converter...")); message.add(new JLabel(" ")); message.add(new JLabel("Loading Game Modes and Campaign Information.")); message.add(new JLabel(" ")); progressBar = new JProgressBar(0, 3); progressBar.setValue(0); progressBar.setStringPainted(true); message.add(progressBar); message.add(new JLabel(" ")); }
Example #22
Source File: Util.java From netbeans with Apache License 2.0 | 5 votes |
public static JDialog createJOptionProgressDialog(JOptionPane p, String title, File source, JProgressBar bar) { progressBar = bar; sourceFolder = source; Object[] options = p.getOptions(); JButton bYES = ((JButton) options[0]); JButton bNO = ((JButton) options[1]); OptionsListener listener = new OptionsListener(p, bYES, bNO); bYES.addActionListener(listener); bNO.addActionListener(listener); return createJOptionDialog(p, title); }
Example #23
Source File: ProgressBarBorder.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public Insets getBorderInsets(Component c) { boolean compressed = Boolean.parseBoolean(String.valueOf(((JProgressBar) c) .getClientProperty(RapidLookTools.PROPERTY_PROGRESSBAR_COMPRESSED))); if (compressed) { return new Insets(3, 3, 3, 3); } else { return new Insets(0, 3, 10, 3); } }
Example #24
Source File: JProgressBarOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JProgressBar.setModel(BoundedRangeModel)} through queue */ public void setModel(final BoundedRangeModel boundedRangeModel) { runMapping(new MapVoidAction("setModel") { @Override public void map() { ((JProgressBar) getSource()).setModel(boundedRangeModel); } }); }
Example #25
Source File: Launcher.java From rscplus with GNU General Public License v3.0 | 5 votes |
/** Renders the launcher progress bar window, then calls {@link #run()}. */ public void init() { Logger.start(); Logger.Info("Starting rscplus"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setBackground(Color.BLACK); // Set window icon URL iconURL = Settings.getResource("/assets/icon.png"); if (iconURL != null) { icon = new ImageIcon(iconURL); setIconImage(icon.getImage()); } iconURL = Settings.getResource("/assets/icon_warn.png"); if (iconURL != null) { icon_warn = new ImageIcon(iconURL); } // Set size getContentPane().setPreferredSize(new Dimension(280, 32)); setTitle("rscplus Launcher"); setResizable(false); pack(); setLocationRelativeTo(null); // Add progress bar m_progressBar = new JProgressBar(); m_progressBar.setStringPainted(true); m_progressBar.setBorderPainted(true); m_progressBar.setForeground(Color.GRAY.brighter()); m_progressBar.setBackground(Color.BLACK); m_progressBar.setString("Initializing"); getContentPane().add(m_progressBar); setVisible(true); new Thread(this).start(); }
Example #26
Source File: CAccessible.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void addNotificationListeners(Component c) { if (c instanceof JTextComponent) { JTextComponent tc = (JTextComponent) c; AXTextChangeNotifier listener = new AXTextChangeNotifier(); tc.getDocument().addDocumentListener(listener); tc.addCaretListener(listener); } if (c instanceof JProgressBar) { JProgressBar pb = (JProgressBar) c; pb.addChangeListener(new AXProgressChangeNotifier()); } else if (c instanceof JSlider) { JSlider slider = (JSlider) c; slider.addChangeListener(new AXProgressChangeNotifier()); } }
Example #27
Source File: GenericProgressDialog.java From GpsPrune with GNU General Public License v2.0 | 5 votes |
/** * Create the dialog to show the progress */ private void createProgressDialog() { _progressDialog = new JDialog(_parentFrame, I18nManager.getText(_dialogTitleKey)); _progressDialog.setLocationRelativeTo(_parentFrame); _progressBar = new JProgressBar(0, 100); _progressBar.setValue(0); _progressBar.setStringPainted(true); _progressBar.setString(""); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); panel.add(new JLabel(I18nManager.getText(_labelKey))); panel.add(_progressBar); panel.add(Box.createVerticalStrut(6)); // spacer JButton cancelButton = new JButton(I18nManager.getText("button.cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { _function.cancel(); } }); panel.add(cancelButton); _progressDialog.getContentPane().add(panel); _progressDialog.pack(); _progressDialog.setVisible(true); }
Example #28
Source File: ProgressBar.java From stendhal with GNU General Public License v2.0 | 5 votes |
private void initializeComponents() { JPanel contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); contentPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); contentPane.add(new JLabel("Connecting...")); contentPane.add(Box.createVerticalStrut(5)); progressBar = new JProgressBar(0, MAX_VALUE); progressBar.setStringPainted(false); contentPane.add(progressBar); }
Example #29
Source File: PageEndPanel.java From JByteMod-Beta with GNU General Public License v2.0 | 5 votes |
public PageEndPanel() { this.pb = new JProgressBar() { @Override public void setValue(int n) { if (n == 100) { super.setValue(0); percent.setText(""); } else { super.setValue(n); percent.setText(n + "%"); } } }; this.setLayout(new GridLayout(1, 4, 10, 10)); this.setBorder(new EmptyBorder(3, 0, 0, 0)); this.add(pb); this.add(percent = new JLabel()); percent.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 13)); label = new JLabel(copyright); label.setHorizontalAlignment(SwingConstants.RIGHT); label.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 13)); this.add(label); memoryBar = new WebMemoryBar(); memoryBar.setShowMaximumMemory(false); this.add(memoryBar); }
Example #30
Source File: JProgressBarOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JProgressBar.removeChangeListener(ChangeListener)} * through queue */ public void removeChangeListener(final ChangeListener changeListener) { runMapping(new MapVoidAction("removeChangeListener") { @Override public void map() { ((JProgressBar) getSource()).removeChangeListener(changeListener); } }); }