From dd485a42d1cfb87fef59a92d99cd2988d21299ee Mon Sep 17 00:00:00 2001 From: IamEld3st Date: Mon, 28 Sep 2015 23:00:23 +0200 Subject: [PATCH] Updated package name + fixed bug with wrong arrayMax counting --- src/com/{develd => develdsoft}/ranum/Main.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) rename src/com/{develd => develdsoft}/ranum/Main.java (95%) diff --git a/src/com/develd/ranum/Main.java b/src/com/develdsoft/ranum/Main.java similarity index 95% rename from src/com/develd/ranum/Main.java rename to src/com/develdsoft/ranum/Main.java index db2f5f0..acefae7 100644 --- a/src/com/develd/ranum/Main.java +++ b/src/com/develdsoft/ranum/Main.java @@ -1,4 +1,4 @@ -package com.develd.ranum; +package com.develdsoft.ranum; import java.awt.EventQueue; @@ -20,10 +20,10 @@ public class Main { public boolean Restarted = true; public int minval; public int maxval; + public int arrayMax; public int arrayCountHolder = 0; public Random rand = new Random(); public List genNumList = new ArrayList(); - public boolean genBool = false; public String resultRand; private JFrame frmRanum; @@ -113,7 +113,7 @@ private void initialize() { btnGenerate.setBounds(10, 91, 80, 23); frmRanum.getContentPane().add(btnGenerate); - JLabel lblCredits = new JLabel("by Andrzej Szczepaniak"); + JLabel lblCredits = new JLabel("by develdsoft.com"); lblCredits.setFont(new Font("Arial", Font.PLAIN, 10)); lblCredits.setBounds(96, 123, 133, 14); frmRanum.getContentPane().add(lblCredits); @@ -145,6 +145,8 @@ public void actionPerformed(ActionEvent event) { textFieldEnd.setEditable(false); System.out.println("Maximal Value: "+maxval+" | Locked Max Value!"); Restarted = false; + arrayMax = maxval - minval + 1; + System.out.println("Maximum Array Number set to: "+arrayMax); arrayCountHolder += 1; resultRand = Integer.toString(randomInteger(minval, maxval)); System.out.println("Random Value: "+resultRand+" | Array Usage: "+arrayCountHolder); @@ -157,7 +159,7 @@ public void actionPerformed(ActionEvent event) { } genNumList.add(resultRand); textFieldResult.setText(resultRand); - if(arrayCountHolder == maxval) { + if(arrayCountHolder == arrayMax) { System.out.println("All numbers in range Generated!"); btnGenerate.setEnabled(false); }