I want to make a simulation hack program because I'm bored. I want it to fill a progress bar, here's the method for that:
public void HackFrame() {
double count = 0;
outerloop:
for(char i = '!'; i <= '~'; i++){
for(char j = '!'; j <= '~'; j++){
for(char k = '!'; k <= '~'; k++){
count++;
int completion = (int) ((count / 830584) * 100);
System.out.println(completion);
HackCompletion.setValue((int) completion);
}
}
}
}
Now I had System.out.println(completion) to make sure it would set values from 0 to 100. Which it does. The thing I don't understand is the progress bar. The only time it progresses is when I have
System.out.println(completion);. Literally every time I remove that, the bar is always filled. Is there a reason I don't know?
Here's my entire code:
import java.awt.Color;
import javax.swing.*;
public class Hack {
private String [] HackPhrases = {"Connecting to server. Sent control packet type is 7 (Outgoing-Call-Request)", "Validating user...", "Generating SHA-256 verification strings: 100%", "Validating blocks [1-512]: 512", "Connecting to game server. Outgoing call established (call ID 0, peer's call ID 19319)", "Establishing connection: 100%", "Connection successful on port 31337", "Downloading data: 100%", "Extracting data: 100%", "Calculating CRC values", "Packing data: 100%", "Injecting script. Sending 100%", "Checking server response...", "Generating Resources: 100%", "Generating Resources: Done", "Finalizing Process: 100%"};
private JFrame Hack = new JFrame ();
private JTextArea HackText = new JTextArea();
private String Password = "~~~";
private JProgressBar HackCompletion = new JProgressBar();
public void makeFrame() {
Hack.setSize(600, 400);
Hack.getContentPane().setBackground(Color.black);
HackText.setBounds(40, 20, 500, 200);
HackText.setBackground(Color.black);
HackCompletion.setBounds(140, 250, 300, 30);
HackCompletion.setBackground(Color.green);
HackCompletion.setForeground(Color.blue);
Hack.add(HackCompletion);
Hack.add(HackText);
Hack.setLayout(null);
Hack.setVisible(true);
Hack.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void HackFrame() {
double count = 0;
outerloop:
for(char i = '!'; i <= '~'; i++){
for(char j = '!'; j <= '~'; j++){
for(char k = '!'; k <= '~'; k++){
count++;
int completion = (int) ((count / 830584) * 100);
System.out.println(completion);
HackCompletion.setValue(completion);
}
}
}
}
public static void main (String [] args){
Hack exampleHack = new Hack();
exampleHack.makeFrame();
exampleHack.HackFrame();
}
}