jprogressbar

Why the JProgressBar doesn't respect the setSize()?

心不动则不痛 提交于 2021-02-08 11:52:12
问题 I'm having an issue with the JProgressBar, when it is printed in the GridBagLayout it is too little and the setSize method doesn't have effect, just to test I wrote 100 and 20 but the size remains something about 10x10 and I don't understand why, where is wrong? Thank you! import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event

Why the JProgressBar doesn't respect the setSize()?

*爱你&永不变心* 提交于 2021-02-08 11:52:07
问题 I'm having an issue with the JProgressBar, when it is printed in the GridBagLayout it is too little and the setSize method doesn't have effect, just to test I wrote 100 and 20 but the size remains something about 10x10 and I don't understand why, where is wrong? Thank you! import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event

Update JProgressBar from a SwingWorker [closed]

℡╲_俬逩灬. 提交于 2021-01-29 07:00:52
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 months ago . Improve this question I am new to Java and trying to build an application that receives 6 inputs from JSwing TextFields. I have around 5 checkboxes. Based on the selection, some of the details are fetched from database. All other things are working now, but I want to place a

Progress bar not updating during a loop

痴心易碎 提交于 2020-03-06 09:29:10
问题 My progress bar doesn't update until the loop has finished? Why is this? for (String theURL : IPArray) { URL url = new URL(theURL); InetAddress address = InetAddress.getByName(url.getHost()); String temp = address.toString(); String IP = temp.substring(temp.indexOf("/") + 1, temp.length()); URLArray.add(IP); Progress.percentage = (URLArray.size() * 100) / Progress.totalToDo; Progress.ipProgress.setString(Progress.percentage + "%"); Progress.ipProgress.setValue(Progress.percentage); Progress

Progress bar not updating during a loop

一世执手 提交于 2020-03-06 09:28:28
问题 My progress bar doesn't update until the loop has finished? Why is this? for (String theURL : IPArray) { URL url = new URL(theURL); InetAddress address = InetAddress.getByName(url.getHost()); String temp = address.toString(); String IP = temp.substring(temp.indexOf("/") + 1, temp.length()); URLArray.add(IP); Progress.percentage = (URLArray.size() * 100) / Progress.totalToDo; Progress.ipProgress.setString(Progress.percentage + "%"); Progress.ipProgress.setValue(Progress.percentage); Progress

JTabbedPane: show task progress in a tab

旧时模样 提交于 2020-01-26 17:20:19
问题 I have a simple Swing Java application that performs searches, and the results are shown in a new tab. While the search is running, I want to show a progress icon or animation in the title of the tab. I tried adding a gif icon, but it doesn't animate. Is there a reason why this isn't working? 回答1: The Swing tutorial about progress bars (and showing progress in general) is a very good place to start. It shows you how to perform long-lasting operations on a worker thread by using a SwingWorker

Tracking progress of multiple image downloads with SwingWorker and JProgressBar

假装没事ソ 提交于 2020-01-16 04:28:11
问题 I'm having a hard time figuring out the right way to use SwingWorker to track multiple image downloads. I'm writing a GUI program that takes a list of image URLs as input, reads each image, and uses PDFBox to save all the images as a single PDF file. I have a downloader class with the following method: public void downloadImagesAsPDF(URL[] urlList, String filename){ if(urlList.length == 0) return; //build pdf try { PDDocument doc = new PDDocument(); for(URL imgLink : urllist){ try{

Progress bar freezing while downloading file in java [duplicate]

别来无恙 提交于 2020-01-15 06:08:11
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: JProgressBar wont update So I am trying to show the download progress of a file being downloaded in Java. I can output the current percentage as a String to the console, but when I try to update the UI, it freezes until the download is complete. public void downloadFile(String fileName) { try { long startTime = System.currentTimeMillis(); System.out.println("Connecting to site...\n"); URL url = new URL("http:/