List of usage examples for javax.swing JProgressBar JProgressBar
public JProgressBar()
From source file:org.pmedv.core.gui.ApplicationWindow.java
@Override protected void initializeComponents() { ApplicationContext ctx = AppContext.getApplicationContext(); layoutPane = new JPanel(new BorderLayout()); menuBar = createMenuBar();// ww w. ja v a 2 s . c om this.setJMenuBar(menuBar); this.add(layoutPane, java.awt.BorderLayout.CENTER); toolBar = createToolBar(); JPanel toolbarPanel = new JPanel(new BorderLayout()); this.add(toolBar, java.awt.BorderLayout.NORTH); statusBar = new JXStatusBar(); ImageIcon offlineIcon = resources.getIcon("icon.status.offline"); statusLabel = new JLabel(); statusBar.add(statusLabel); statusLabel = new JLabel("Ready"); JXStatusBar.Constraint c1 = new Constraint(); c1.setFixedWidth(200); statusBar.add(statusLabel, c1); // Fixed width of 100 with no inserts statusLabel.setIcon(offlineIcon); hostLabel = new JLabel("Not connected."); JXStatusBar.Constraint c3 = new Constraint(); c3.setFixedWidth(300); statusBar.add(hostLabel, c3); JXStatusBar.Constraint c2 = new Constraint(JXStatusBar.Constraint.ResizeBehavior.FILL); progressBar = new JProgressBar(); statusBar.add(progressBar, c2); this.add(statusBar, java.awt.BorderLayout.SOUTH); layoutPane.setBackground(Color.WHITE); }
From source file:Main.java
private JProgressBar makeProgressBar(int min, int max) { JProgressBar progressBar1 = new JProgressBar(); progressBar1.setMinimum(min);/* www. ja v a 2 s. co m*/ progressBar1.setMaximum(max); progressBar1.setStringPainted(true); progressBar1.setBorderPainted(true); getContentPane().add(progressBar1); return progressBar1; }
From source file:net.sf.profiler4j.console.util.task.LongTaskExecutorDialog.java
/** * This method initializes progressBar/*from w w w .j a v a2s . com*/ * * @return javax.swing.JProgressBar */ public JProgressBar getProgressBar() { if (progressBar == null) { progressBar = new JProgressBar(); progressBar.setBounds(new java.awt.Rectangle(15, 45, 451, 18)); progressBar.setIndeterminate(true); } return progressBar; }
From source file:com.awesomecoding.minetestlauncher.Main.java
private void initialize() { fileGetter = new FileGetter(userhome + "\\minetest\\temp\\"); latest = fileGetter.getContents("http://socialmelder.com/minetest/latest.txt", true); currentVersion = latest.split("\n")[0]; changelog = fileGetter.getContents("http://socialmelder.com/minetest/changelog.html", false); try {//from www . j av a 2 s . c o m UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } frmMinetestLauncherV = new JFrame(); frmMinetestLauncherV.setResizable(false); frmMinetestLauncherV.setIconImage(Toolkit.getDefaultToolkit() .getImage(Main.class.getResource("/com/awesomecoding/minetestlauncher/icon.png"))); frmMinetestLauncherV.setTitle("Minetest Launcher (Version 0.1)"); frmMinetestLauncherV.setBounds(100, 100, 720, 480); frmMinetestLauncherV.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SpringLayout springLayout = new SpringLayout(); frmMinetestLauncherV.getContentPane().setLayout(springLayout); final JProgressBar progressBar = new JProgressBar(); springLayout.putConstraint(SpringLayout.WEST, progressBar, 10, SpringLayout.WEST, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.SOUTH, progressBar, -10, SpringLayout.SOUTH, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.EAST, progressBar, -130, SpringLayout.EAST, frmMinetestLauncherV.getContentPane()); frmMinetestLauncherV.getContentPane().add(progressBar); final JButton btnDownloadPlay = new JButton("Play!"); springLayout.putConstraint(SpringLayout.WEST, btnDownloadPlay, 6, SpringLayout.EAST, progressBar); springLayout.putConstraint(SpringLayout.SOUTH, btnDownloadPlay, 0, SpringLayout.SOUTH, progressBar); springLayout.putConstraint(SpringLayout.EAST, btnDownloadPlay, -10, SpringLayout.EAST, frmMinetestLauncherV.getContentPane()); frmMinetestLauncherV.getContentPane().add(btnDownloadPlay); final JLabel label = new JLabel("Ready to play!"); springLayout.putConstraint(SpringLayout.WEST, label, 10, SpringLayout.WEST, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.NORTH, btnDownloadPlay, 0, SpringLayout.NORTH, label); springLayout.putConstraint(SpringLayout.SOUTH, label, -37, SpringLayout.SOUTH, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.NORTH, progressBar, 6, SpringLayout.SOUTH, label); frmMinetestLauncherV.getContentPane().add(label); JTextPane txtpnNewFeatures = new JTextPane(); txtpnNewFeatures.setBackground(SystemColor.window); springLayout.putConstraint(SpringLayout.NORTH, txtpnNewFeatures, 10, SpringLayout.NORTH, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.WEST, txtpnNewFeatures, 10, SpringLayout.WEST, frmMinetestLauncherV.getContentPane()); springLayout.putConstraint(SpringLayout.SOUTH, txtpnNewFeatures, -10, SpringLayout.NORTH, btnDownloadPlay); springLayout.putConstraint(SpringLayout.EAST, txtpnNewFeatures, 0, SpringLayout.EAST, btnDownloadPlay); txtpnNewFeatures.setEditable(false); txtpnNewFeatures.setContentType("text/html"); txtpnNewFeatures.setText(changelog); txtpnNewFeatures.setFont(new Font("Tahoma", Font.PLAIN, 12)); frmMinetestLauncherV.getContentPane().add(txtpnNewFeatures); File file = new File(userhome + "\\minetest\\version.txt"); if (!file.exists()) newVersion = true; else { String version = fileGetter.getLocalContents(file, false); if (!version.equals(currentVersion)) newVersion = true; } if (newVersion) { label.setText("New Version Available! (" + currentVersion + ")"); btnDownloadPlay.setText("Download & Play"); btnDownloadPlay.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { Thread t = new Thread() { public void run() { File file = new File(userhome + "\\minetest\\version.txt"); String version = fileGetter.getLocalContents(file, false); try { FileUtils.deleteDirectory(new File(userhome + "\\minetest\\minetest-" + version)); } catch (Exception e) { e.printStackTrace(); } fileGetter.download(latest.split("\n")[1], userhome + "\\minetest\\temp\\", "minetest.zip", label, progressBar, btnDownloadPlay, currentVersion); try { label.setText("Cleaning up..."); btnDownloadPlay.setText("Cleaning up..."); FileUtils.deleteDirectory(new File(userhome + "\\minetest\\temp")); } catch (IOException e) { e.printStackTrace(); } System.exit(0); } }; t.start(); } }); } else { btnDownloadPlay.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { label.setText("Launching..."); btnDownloadPlay.setEnabled(false); btnDownloadPlay.setText("Launching..."); File file = new File(userhome + "\\minetest\\version.txt"); String version = fileGetter.getLocalContents(file, false); Runtime.getRuntime() .exec(userhome + "\\minetest\\minetest-" + version + "\\bin\\minetest.exe"); System.exit(0); } catch (IOException e) { e.printStackTrace(); } } }); progressBar.setValue(100); } }
From source file:net.sf.keystore_explorer.gui.dialogs.DCheckUpdate.java
private void initComponents() { jlCheckUpdate = new JLabel(res.getString("DCheckUpdate.jlCheckUpdate.text")); ImageIcon icon = new ImageIcon(getClass().getResource(res.getString("DCheckUpdate.jlCheckUpdate.image"))); jlCheckUpdate.setIcon(icon);// ww w . j a v a 2 s.co m jlCheckUpdate.setHorizontalTextPosition(SwingConstants.LEADING); jlCheckUpdate.setIconTextGap(15); jpCheckUpdate = new JPanel(new FlowLayout(FlowLayout.CENTER)); jpCheckUpdate.add(jlCheckUpdate); jpCheckUpdate.setBorder(new EmptyBorder(5, 5, 5, 5)); jpbCheckUpdate = new JProgressBar(); jpbCheckUpdate.setIndeterminate(true); jpbCheckUpdate.setString("DCheckUpdate.jlCheckUpdate.text"); jpProgress = new JPanel(new FlowLayout(FlowLayout.CENTER)); jpProgress.add(jpbCheckUpdate); jpProgress.setBorder(new EmptyBorder(5, 5, 5, 5)); jbCancel = new JButton(res.getString("DCheckUpdate.jbCancel.text")); jbCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { cancelPressed(); } }); jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY); jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() { @Override public void actionPerformed(ActionEvent evt) { cancelPressed(); } }); jpCancel = PlatformUtil.createDialogButtonPanel(jbCancel, false); getContentPane().add(jpCheckUpdate, BorderLayout.NORTH); getContentPane().add(jpProgress, BorderLayout.CENTER); getContentPane().add(jpCancel, BorderLayout.SOUTH); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent evt) { if ((checker != null) && (checker.isAlive())) { checker.interrupt(); } closeDialog(); } }); setTitle(res.getString("DCheckUpdate.Title")); setResizable(false); pack(); }
From source file:medsavant.enrichment.app.RegionListAggregatePanel.java
public RegionListAggregatePanel(String page) { super(page);/*from w w w .ja va2s . com*/ setLayout(new BorderLayout()); variantCounts = new TreeMap<GenomicRegion, Integer>(); patientCounts = new TreeMap<GenomicRegion, Integer>(); regionSetCombo = new JComboBox(); mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); progress = new JProgressBar(); progress.setStringPainted(true); JPanel banner = new JPanel(); banner.setLayout(new BoxLayout(banner, BoxLayout.X_AXIS)); banner.setBackground(new Color(245, 245, 245)); banner.setBorder(BorderFactory.createTitledBorder("Region List")); banner.add(regionSetCombo); banner.add(ViewUtil.getMediumSeparator()); banner.add(Box.createHorizontalGlue()); banner.add(progress); add(banner, BorderLayout.NORTH); add(mainPanel, BorderLayout.CENTER); createSearchableTable(); regionSetCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fetchRegions((RegionSet) regionSetCombo.getSelectedItem()); } }); new MedSavantWorker<List<RegionSet>>(pageName) { @Override protected List<RegionSet> doInBackground() throws Exception { return RegionController.getInstance().getRegionSets(); } @Override protected void showProgress(double fraction) { } @Override protected void showSuccess(List<RegionSet> result) { if (!result.isEmpty()) { updateRegionSetCombo(result); } } }.execute(); }
From source file:medsavant.enrichment.app.OntologyAggregatePanel.java
public OntologyAggregatePanel(String page) { super(page);//from www. java 2s. c o m setLayout(new GridBagLayout()); chooser = new JComboBox(OntologyListItem.DEFAULT_ITEMS); chooser.setMaximumSize(new Dimension(400, chooser.getMaximumSize().height)); progress = new JProgressBar(); progress.setPreferredSize(new Dimension(600, progress.getMaximumSize().height)); progress.setStringPainted(true); JPanel banner = new JPanel(); banner.setLayout(new GridBagLayout()); banner.setBackground(new Color(245, 245, 245)); banner.setBorder(BorderFactory.createTitledBorder("Ontology")); tree = new TreeTable(); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1.0; gbc.anchor = GridBagConstraints.WEST; banner.add(chooser, gbc); gbc.anchor = GridBagConstraints.EAST; banner.add(progress, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; add(banner, gbc); gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; add(new JScrollPane(tree), gbc); chooser.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (termFetcher != null) { termFetcher.cancel(true); termFetcher = null; } recalculate(); } }); tree.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { createPopup().show(e.getComponent(), e.getX(), e.getY()); } } }); }
From source file:net.redstonelamp.gui.RedstoneLampGUI.java
private static void installCallback(JFrame frame, File selected) { JDialog dialog = new JDialog(frame); JLabel status = new JLabel("Downloading build..."); JProgressBar progress = new JProgressBar(); dialog.pack();/*from w w w. ja v a 2 s. com*/ dialog.setVisible(true); try { URL url = new URL("http://download.redstonelamp.net/?file=LatestBuild"); InputStream is = url.openStream(); int size = is.available(); progress.setMinimum(0); progress.setMaximum(size); int size2 = size; OutputStream os = new FileOutputStream(new File(selected, "RedstoneLamp.jar")); while (size2 > 0) { int length = Math.min(4096, size2); byte[] buffer = new byte[length]; size2 -= length; is.read(buffer); progress.setValue(size2); os.write(buffer); } is.close(); os.close(); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.enderville.enderinstaller.ui.Installer.java
private JProgressBar getProgressBar() { if (progressBar == null) { progressBar = new JProgressBar(); } return progressBar; }
From source file:it.isislab.dmason.util.SystemManagement.Worker.WorkerUpdater.java
private void initGUI() { try {// w w w. j av a 2 s . c o m setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jPanelMain = new JPanel(); GroupLayout jPanelMainLayout = new GroupLayout(jPanelMain); jPanelMain.setLayout(jPanelMainLayout); getContentPane().add(jPanelMain, BorderLayout.CENTER); jPanelMain.setPreferredSize(new java.awt.Dimension(503, 190)); { jLabelUpdateProgress = new JLabel(); jLabelUpdateProgress.setText("Update Progress"); } { jProgressBarUpdate = new JProgressBar(); jProgressBarUpdate.setValue(0); } { jLabelTotalWorker = new JLabel(); jLabelTotalWorker.setText("0"); jLabelTotalWorker.setText(Integer.toString(total)); System.out.println("Total: " + total); } { jLabelUpdated = new JLabel(); jLabelUpdated.setText("Updated:"); } { jLabelSeparator = new JLabel(); jLabelSeparator.setText("of"); } { jLabelUpdatedWorker = new JLabel(); jLabelUpdatedWorker.setText("" + workerUpdated); } { jButtonUpdateWorker = new JButton(); jButtonUpdateWorker.setText("Update Worker"); jButtonUpdateWorker.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { startUpdate(); } }); } { jButtonChoseUpJar = new JButton(); jButtonChoseUpJar.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("it.isislab.dmason/resource/image/openFolder.png"))); jButtonChoseUpJar.setPreferredSize(new java.awt.Dimension(14, 7)); jButtonChoseUpJar.setSize(16, 16); jButtonChoseUpJar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { updateFile = showFileChooser(); if (updateFile != null) jTextFieldPathUpJar.setText(updateFile.getAbsolutePath()); } }); } { jTextFieldPathUpJar = new JTextField(); jTextFieldPathUpJar.setText("PathUpdateJar"); } jPanelMainLayout.setHorizontalGroup(jPanelMainLayout.createSequentialGroup() .addGroup(jPanelMainLayout.createParallelGroup() .addGroup(GroupLayout.Alignment.LEADING, jPanelMainLayout.createSequentialGroup() .addComponent(jTextFieldPathUpJar, GroupLayout.PREFERRED_SIZE, 202, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButtonChoseUpJar, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE)) .addGroup(GroupLayout.Alignment.LEADING, jPanelMainLayout.createSequentialGroup() .addComponent(jButtonUpdateWorker, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addGap(25) .addComponent(jLabelUpdated, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE) .addGap(6))) .addComponent(jLabelUpdatedWorker, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelSeparator, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelTotalWorker, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addGroup(jPanelMainLayout.createParallelGroup() .addGroup(jPanelMainLayout.createSequentialGroup() .addComponent(jProgressBarUpdate, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(GroupLayout.Alignment.LEADING, jPanelMainLayout.createSequentialGroup() .addComponent(jLabelUpdateProgress, GroupLayout.PREFERRED_SIZE, 102, GroupLayout.PREFERRED_SIZE) .addGap(0, 46, Short.MAX_VALUE))) .addContainerGap(144, 144)); jPanelMainLayout .setVerticalGroup(jPanelMainLayout.createSequentialGroup().addContainerGap(25, 25) .addGroup(jPanelMainLayout.createParallelGroup() .addComponent(jTextFieldPathUpJar, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jButtonChoseUpJar, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)) .addGap(25) .addGroup(jPanelMainLayout.createParallelGroup().addGroup( GroupLayout.Alignment.LEADING, jPanelMainLayout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addComponent(jLabelUpdateProgress, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jProgressBarUpdate, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(0, 6, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanelMainLayout.createSequentialGroup().addGap(13) .addGroup(jPanelMainLayout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jButtonUpdateWorker, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabelUpdatedWorker, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent( jLabelSeparator, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent( jLabelTotalWorker, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabelUpdated, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)))) .addContainerGap(249, 249)); } pack(); this.setSize(508, 218); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }