Graphing with JLabel for looks [null layout] Java Swing *ERROR
up vote
-1
down vote
favorite
I am trying to build a student graph with JLabels
my app does a sql query and returns an int value for each month's number of entries and if doesnt find any it returns 0.
//scale variable is an int
//ene is a return value from another method that runs before
//in case there are no students in january I dont have to graph anything
//so this 'if' doesnt run
Scale = 50;
if (Ene != 0)
System.out.println(Ene + " ene stdds");
// this prints out 11 ene stdds
double EneBH = 449 * (Ene / Scale);
int EneBHeight = (int) Math.round(EneBH);
int EneBYLocal = 612 - EneBHeight;
EneP.setBounds(76, EneBYLocal, 7, EneBHeight);
EneP.setVisible(true);
else
//if the last if didnt run I want to know if it hidd the label
System.out.println("HIDDEN ENE");
EneP.setVisible(false);
*Ene P is the very first jlabel for graphing, it looks kida gray and is at the enero zone.
*EneP prints out 11 students but never shows up, doesnt print hidden ene, it just doesnt show up
*EneP will have the same code than the other jlabels if I solve it or you solve it, please
java swing interface helper javahelp
add a comment |
up vote
-1
down vote
favorite
I am trying to build a student graph with JLabels
my app does a sql query and returns an int value for each month's number of entries and if doesnt find any it returns 0.
//scale variable is an int
//ene is a return value from another method that runs before
//in case there are no students in january I dont have to graph anything
//so this 'if' doesnt run
Scale = 50;
if (Ene != 0)
System.out.println(Ene + " ene stdds");
// this prints out 11 ene stdds
double EneBH = 449 * (Ene / Scale);
int EneBHeight = (int) Math.round(EneBH);
int EneBYLocal = 612 - EneBHeight;
EneP.setBounds(76, EneBYLocal, 7, EneBHeight);
EneP.setVisible(true);
else
//if the last if didnt run I want to know if it hidd the label
System.out.println("HIDDEN ENE");
EneP.setVisible(false);
*Ene P is the very first jlabel for graphing, it looks kida gray and is at the enero zone.
*EneP prints out 11 students but never shows up, doesnt print hidden ene, it just doesnt show up
*EneP will have the same code than the other jlabels if I solve it or you solve it, please
java swing interface helper javahelp
1
Sorry, I could't see a question in your question.
– yole
Nov 9 at 17:29
For better help sooner, post a Minimal, Complete, and Verifiable example or Short, Self Contained, Correct Example. (And ask a question.)
– Andrew Thompson
Nov 10 at 3:24
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I am trying to build a student graph with JLabels
my app does a sql query and returns an int value for each month's number of entries and if doesnt find any it returns 0.
//scale variable is an int
//ene is a return value from another method that runs before
//in case there are no students in january I dont have to graph anything
//so this 'if' doesnt run
Scale = 50;
if (Ene != 0)
System.out.println(Ene + " ene stdds");
// this prints out 11 ene stdds
double EneBH = 449 * (Ene / Scale);
int EneBHeight = (int) Math.round(EneBH);
int EneBYLocal = 612 - EneBHeight;
EneP.setBounds(76, EneBYLocal, 7, EneBHeight);
EneP.setVisible(true);
else
//if the last if didnt run I want to know if it hidd the label
System.out.println("HIDDEN ENE");
EneP.setVisible(false);
*Ene P is the very first jlabel for graphing, it looks kida gray and is at the enero zone.
*EneP prints out 11 students but never shows up, doesnt print hidden ene, it just doesnt show up
*EneP will have the same code than the other jlabels if I solve it or you solve it, please
java swing interface helper javahelp
I am trying to build a student graph with JLabels
my app does a sql query and returns an int value for each month's number of entries and if doesnt find any it returns 0.
//scale variable is an int
//ene is a return value from another method that runs before
//in case there are no students in january I dont have to graph anything
//so this 'if' doesnt run
Scale = 50;
if (Ene != 0)
System.out.println(Ene + " ene stdds");
// this prints out 11 ene stdds
double EneBH = 449 * (Ene / Scale);
int EneBHeight = (int) Math.round(EneBH);
int EneBYLocal = 612 - EneBHeight;
EneP.setBounds(76, EneBYLocal, 7, EneBHeight);
EneP.setVisible(true);
else
//if the last if didnt run I want to know if it hidd the label
System.out.println("HIDDEN ENE");
EneP.setVisible(false);
*Ene P is the very first jlabel for graphing, it looks kida gray and is at the enero zone.
*EneP prints out 11 students but never shows up, doesnt print hidden ene, it just doesnt show up
*EneP will have the same code than the other jlabels if I solve it or you solve it, please
java swing interface helper javahelp
java swing interface helper javahelp
edited Nov 9 at 17:18
camickr
272k14124237
272k14124237
asked Nov 9 at 17:15
Miguel Romero
1
1
1
Sorry, I could't see a question in your question.
– yole
Nov 9 at 17:29
For better help sooner, post a Minimal, Complete, and Verifiable example or Short, Self Contained, Correct Example. (And ask a question.)
– Andrew Thompson
Nov 10 at 3:24
add a comment |
1
Sorry, I could't see a question in your question.
– yole
Nov 9 at 17:29
For better help sooner, post a Minimal, Complete, and Verifiable example or Short, Self Contained, Correct Example. (And ask a question.)
– Andrew Thompson
Nov 10 at 3:24
1
1
Sorry, I could't see a question in your question.
– yole
Nov 9 at 17:29
Sorry, I could't see a question in your question.
– yole
Nov 9 at 17:29
For better help sooner, post a Minimal, Complete, and Verifiable example or Short, Self Contained, Correct Example. (And ask a question.)
– Andrew Thompson
Nov 10 at 3:24
For better help sooner, post a Minimal, Complete, and Verifiable example or Short, Self Contained, Correct Example. (And ask a question.)
– Andrew Thompson
Nov 10 at 3:24
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I have found a Solution for My Own Problem
The solution was easy turns out that If you divide Ene (the return variable from a query that saves as an integer value) by the Scale variable which is also an integer it causes java to return 0
So I have discovered this on my own by placing a system.out.print() after every line and printing the values of every variable.
I noticed 11/50 shouldn't return 0, so I changed the scale variable to be a double and still returned 0; but I changed both and now it works just right.
Scale = 50;
if (Ene != 0)
System.out.println(Ene + " ene stdds");
// this prints out 11 ene stdds
double EneBH = 449 * (Ene / Scale);
int EneBHeight = (int) Math.round(EneBH);
int EneBYLocal = 612 - EneBHeight;
EneP.setBounds(76, EneBYLocal, 7, EneBHeight);
EneP.setVisible(true);
else
//if the last if didnt run I want to know if it hidd the label
System.out.println("HIDDEN ENE");
EneP.setVisible(false);
enter image description here
New contributor
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I have found a Solution for My Own Problem
The solution was easy turns out that If you divide Ene (the return variable from a query that saves as an integer value) by the Scale variable which is also an integer it causes java to return 0
So I have discovered this on my own by placing a system.out.print() after every line and printing the values of every variable.
I noticed 11/50 shouldn't return 0, so I changed the scale variable to be a double and still returned 0; but I changed both and now it works just right.
Scale = 50;
if (Ene != 0)
System.out.println(Ene + " ene stdds");
// this prints out 11 ene stdds
double EneBH = 449 * (Ene / Scale);
int EneBHeight = (int) Math.round(EneBH);
int EneBYLocal = 612 - EneBHeight;
EneP.setBounds(76, EneBYLocal, 7, EneBHeight);
EneP.setVisible(true);
else
//if the last if didnt run I want to know if it hidd the label
System.out.println("HIDDEN ENE");
EneP.setVisible(false);
enter image description here
New contributor
add a comment |
up vote
0
down vote
I have found a Solution for My Own Problem
The solution was easy turns out that If you divide Ene (the return variable from a query that saves as an integer value) by the Scale variable which is also an integer it causes java to return 0
So I have discovered this on my own by placing a system.out.print() after every line and printing the values of every variable.
I noticed 11/50 shouldn't return 0, so I changed the scale variable to be a double and still returned 0; but I changed both and now it works just right.
Scale = 50;
if (Ene != 0)
System.out.println(Ene + " ene stdds");
// this prints out 11 ene stdds
double EneBH = 449 * (Ene / Scale);
int EneBHeight = (int) Math.round(EneBH);
int EneBYLocal = 612 - EneBHeight;
EneP.setBounds(76, EneBYLocal, 7, EneBHeight);
EneP.setVisible(true);
else
//if the last if didnt run I want to know if it hidd the label
System.out.println("HIDDEN ENE");
EneP.setVisible(false);
enter image description here
New contributor
add a comment |
up vote
0
down vote
up vote
0
down vote
I have found a Solution for My Own Problem
The solution was easy turns out that If you divide Ene (the return variable from a query that saves as an integer value) by the Scale variable which is also an integer it causes java to return 0
So I have discovered this on my own by placing a system.out.print() after every line and printing the values of every variable.
I noticed 11/50 shouldn't return 0, so I changed the scale variable to be a double and still returned 0; but I changed both and now it works just right.
Scale = 50;
if (Ene != 0)
System.out.println(Ene + " ene stdds");
// this prints out 11 ene stdds
double EneBH = 449 * (Ene / Scale);
int EneBHeight = (int) Math.round(EneBH);
int EneBYLocal = 612 - EneBHeight;
EneP.setBounds(76, EneBYLocal, 7, EneBHeight);
EneP.setVisible(true);
else
//if the last if didnt run I want to know if it hidd the label
System.out.println("HIDDEN ENE");
EneP.setVisible(false);
enter image description here
New contributor
I have found a Solution for My Own Problem
The solution was easy turns out that If you divide Ene (the return variable from a query that saves as an integer value) by the Scale variable which is also an integer it causes java to return 0
So I have discovered this on my own by placing a system.out.print() after every line and printing the values of every variable.
I noticed 11/50 shouldn't return 0, so I changed the scale variable to be a double and still returned 0; but I changed both and now it works just right.
Scale = 50;
if (Ene != 0)
System.out.println(Ene + " ene stdds");
// this prints out 11 ene stdds
double EneBH = 449 * (Ene / Scale);
int EneBHeight = (int) Math.round(EneBH);
int EneBYLocal = 612 - EneBHeight;
EneP.setBounds(76, EneBYLocal, 7, EneBHeight);
EneP.setVisible(true);
else
//if the last if didnt run I want to know if it hidd the label
System.out.println("HIDDEN ENE");
EneP.setVisible(false);
enter image description here
New contributor
New contributor
answered Nov 10 at 6:48
Miguel Romero
1
1
New contributor
New contributor
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53230455%2fgraphing-with-jlabel-for-looks-null-layout-java-swing-error%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Sorry, I could't see a question in your question.
– yole
Nov 9 at 17:29
For better help sooner, post a Minimal, Complete, and Verifiable example or Short, Self Contained, Correct Example. (And ask a question.)
– Andrew Thompson
Nov 10 at 3:24