Results 1 to 3 of 3
- 10-21-2012, 11:17 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 37
- Rep Power
- 0
Swing calculate area not printing anything
I am trying to get my swing program to calculate the area of one of the types of area (radio buttons) but when I run it, it seems to take the parameters correctly, but it doesnt print the area, which in the code below I used the code:cOutputLabel1.setText(strArea + " square inches"); . any ideas on why this wont work? I can post more code if needed.
private void CalculateRadioButtonActionPerformed(java.awt.event .ActionEvent evt) {
double area = 0;
if (CircleRadioButton.isSelected()) {
String strRadius = DimensionOneText.getText();
int radius = Integer.parseInt(strRadius);
area = areaCircle (radius);
}else{
if (rectangleRadioButton.isSelected()){
String strBase = DimensionOneText.getText();
int base = Integer.parseInt(strBase);
String strHeight = DimensionTwoText.getText();
int height = Integer.parseInt(strHeight);
area = areaTriangle (base, height);
}else{
if (triangleRadioButton.isSelected()){
String strBase = DimensionOneText.getText();
int base = Integer.parseInt(strBase);
String strHeight = DimensionTwoText.getText();
int height = Integer.parseInt(strHeight);
area = areaRectangle (base, height);
}
String strArea = String.valueOf(area);
OutputLabel1.setText(strArea + " square inches");
}
}
}
- 10-22-2012, 04:10 AM #2
Re: Swing calculate area not printing anything
Why do they call it rush hour when nothing moves? - Robin Williams
- 10-23-2012, 07:04 AM #3
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,547
- Rep Power
- 11
Similar Threads
-
Printing a GUI form that used swing
By Taron in forum AWT / SwingReplies: 3Last Post: 10-23-2012, 02:38 PM -
Printing of the image display area is to small to read on some large displays
By cnu.nandhikonda@gmail.com in forum Java 2DReplies: 0Last Post: 02-23-2012, 12:20 PM -
Swing Button and Text Area Function
By ScoutDavid in forum AWT / SwingReplies: 13Last Post: 12-21-2010, 02:07 PM -
Printing in Swing
By dhaivat in forum AWT / SwingReplies: 8Last Post: 03-04-2010, 03:55 PM -
Printing default Swing values
By Java Tip in forum Java TipReplies: 0Last Post: 03-12-2008, 11:09 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks