How to change background color?? U have green progress color, but how can i change the color of progress form behind? U have now white color, how to change it?
NOTE: If you're trying to attach a background thread to the progress bar, you can do the following in order to update the progress as the thread is running. in controller class --> "[progressBar fxID].progressProperty().bind([Task name].progressProperty());" // This will "bind" your progress bar to a task object. Then, in your task class --> "this.updateProgress(objectivesCompleted, targetCompletions);" // The "updateProgress()" method will then update ant progress bars "binded" to the task object.
WARNING GUYSS!! If you are having "Character , is neither a decimal digit number, decimal point, nor "e" notation exponential mark." problem, do not panic. normally double or int variables uses "." to seperate decimals. When we convert it to String to format it, it turns out to be a "," and this problem annoyed me so much because i couldn't find a solution till now. After 4 fecking hours i come up with this easy solution. USE this ------> BigDecimal progress = new BigDecimal(String.format("%.2f", 0.0).replace(",", ".")); Simply we replace "," s with "." this.
you don't need to use BigDecimal, you only need to change the if statement to progress < 0.99 : if(progress < 0.99){ progress += 0.1; progressBar.setProgress(progress); myLabel.setText(Math.round(progress * 100) + "%"); }
Your video are Amazing bro thanks! It will be possible to do an management application with good practice methods (SGBD / DAO / View / Presenter / Ihm ) in the futur pls? You are the best thank's for your job bro!
it worked, but as far as the last number is 0.99999999999999999 is has to be rounded to 1, it does not work at the end, so better do it this way...at least for me. if(progress > 0.99) { progress = 1; myProgressBar.setProgress(progress); myLabel.setText(Integer.toString((int)Math.round(progress *100))+" %"); } if(progress < 1) { progress += 0.1; System.out.println(progress); myProgressBar.setProgress(progress); myLabel.setText(Integer.toString((int)Math.round(progress *100))+" %"); }
Hm... I have the very same code in all classes and the fxml file and im getting this error: Caused by: java.lang.NumberFormatException: Character , is neither a decimal digit number, decimal point, nor "e" notation exponential mark. Can anyone help?
I have the same problem. I get a number of exceptions including this one when I include BigDecimal Exception in Application start method Caused by: java.lang.reflect.InvocationTargetException Caused by: java.lang.RuntimeException Caused by: javafx.fxml.LoadException ...at sample.Main.start(Main.java:13) Caused by: java.lang.NumberFormatException ...at sample.Controller.(Controller.java:25) ...Exception running application sample.Main
package application;
import java.math.BigDecimal;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.Slider;
public class Controller implements Initializable{
@FXML
private ProgressBar myProgressBar;
@FXML
private Button myButton;
@FXML
private Label myLabel;
//The BigDecimal class gives its user complete control over rounding behavior
BigDecimal progress = new BigDecimal(String.format("%.2f", 0.0));
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
myProgressBar.setStyle("-fx-accent: #00FF00;");
}
public void increaseProgress() {
if(progress.doubleValue() < 1) {
progress = new BigDecimal(String.format("%.2f", progress.doubleValue() + 0.1));
//System.out.println(progress.doubleValue());
myProgressBar.setProgress(progress.doubleValue());
myLabel.setText(Integer.toString((int)Math.round(progress.doubleValue() * 100)) + "%");
}
}
}
How to change background color?? U have green progress color, but how can i change the color of progress form behind? U have now white color, how to change it?
NOTE: If you're trying to attach a background thread to the progress bar, you can do the following in order to update the progress as the thread is running.
in controller class --> "[progressBar fxID].progressProperty().bind([Task name].progressProperty());"
// This will "bind" your progress bar to a task object.
Then, in your task class --> "this.updateProgress(objectivesCompleted, targetCompletions);"
// The "updateProgress()" method will then update ant progress bars "binded" to the task object.
WARNING GUYSS!! If you are having "Character , is neither a decimal digit number, decimal point, nor "e" notation exponential mark." problem, do not panic.
normally double or int variables uses "." to seperate decimals. When we convert it to String to format it, it turns out to be a "," and this problem annoyed me so much because i couldn't find a solution till now. After 4 fecking hours i come up with this easy solution.
USE this ------> BigDecimal progress = new BigDecimal(String.format("%.2f", 0.0).replace(",", "."));
Simply we replace "," s with "." this.
thank you so much, ran into the same problem, searched for other ways to work with the progress bar, but found your solution now :,)
thanks buddie, but it did not work for me 100%
I coded the hole thing & it works, thank you !
you don't need to use BigDecimal, you only need to change the if statement to progress < 0.99 :
if(progress < 0.99){
progress += 0.1;
progressBar.setProgress(progress);
myLabel.setText(Math.round(progress * 100) + "%");
}
Yo bro , nice video, you finishing C++ and C# ?
yes, in the future. Not sure when exactly tho
Your video are Amazing bro thanks!
It will be possible to do an management application with good practice methods (SGBD / DAO / View / Presenter / Ihm ) in the futur pls?
You are the best thank's for your job bro!
What are you using in the start of the video to mess around with the progress bar? Is it an app?
It is a scene builder for javafx(gluon)
So its called javafx and if that is the case then whats gluon?
@@Cadabzy have you heard of oracle?
@@kshitijanand3045 okay man i got the whole picture of what it is and how to use it thanks for the constant replies tho
@@Cadabzy welcome
Peace be upon you brother, can you equate a java project with a full professional postgresql
Peace be upon you, brother. Can I download javafx because I have nothing to do with it
instead of BigDecimal, why just not to use - if (progress>1) {progress = 1;} within your IF block (put in line 40) ?
it worked, but as far as the last number is 0.99999999999999999 is has to be rounded to 1, it does not work at the end, so better do it this way...at least for me.
if(progress > 0.99) {
progress = 1;
myProgressBar.setProgress(progress);
myLabel.setText(Integer.toString((int)Math.round(progress *100))+" %");
}
if(progress < 1) {
progress += 0.1;
System.out.println(progress);
myProgressBar.setProgress(progress);
myLabel.setText(Integer.toString((int)Math.round(progress *100))+" %");
}
Hm... I have the very same code in all classes and the fxml file and im getting this error:
Caused by: java.lang.NumberFormatException: Character , is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
Can anyone help?
I have the same problem. I get a number of exceptions including this one when I include BigDecimal
Exception in Application start method
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.RuntimeException
Caused by: javafx.fxml.LoadException
...at sample.Main.start(Main.java:13)
Caused by: java.lang.NumberFormatException
...at sample.Controller.(Controller.java:25)
...Exception running application sample.Main
I'm having the same problem :( did you find any solution?
@@nico-n3987 not yet
USE this ------> BigDecimal progress = new BigDecimal(String.format("%.2f", 0.0).replace(",", "."));
Simply we replace "," s with "." this.
People who do all of these unnecessary stuff: 🤓
Who who make a rectangle bigger and smaller: 🗿