[nbusers] For Loop, Array, TextArea

  • From: "coderkid" < >
  • To:
  • Subject: [nbusers] For Loop, Array, TextArea
  • Date: Mon, 15 Oct 2012 09:36:37 -0400


Edson Richter wrote:
> Em 15/10/2012 10:07, coderkid escreveu:
> 
> > Edson Richter wrote:
> > 
> > > Take a look here:
> > > 
> > > http://docs.oracle.com/javase/tutorial/uiswing/index.html
> > > 
> > > Regards,
> > > 
> > > Edson
> > > 
> > > 
> > > 
> > 
> > 
> > Thanks for the reply, but I am having no trouble creating the actual GUI 
> > (just using Java Desktop Application Template). The problem I am having 
> > is with creating the loop that does power function and puts the sentences 
> > to the text area. Just putting textarea.setText("Hello") does nothing: 
> > nothing appears in the text area.
> > 
> > 
> > 
> Well, most of the issues on this nature come from Threading issues.
> Again, check documentation regarding SwingUtilities.
> The link above has lots of information on how to (or how not) update 
> Swing components.
> 
> Regards,
> 
> Edson



Thanks again, Edson. I will try and look through the documentation more 
thoroughly. Would you, perhaps, know why the following code is not working:

  public void calculateButtonActionPerformed(java.awt.event.ActionEvent evt)  
 {

 double userBaseNumber = Double.valueOf(userBaseInputField.getText());
 int userExponentNumber = Integer.valueOf(userExponentInputField.getText());
 String userBaseString = userBaseInputField.getText();
int exponentNumber=1;
for(int i=1;i<=userExponentNumber;i++){

                exponentNumber+=i;
        }
        String exponentNumberString = Integer.toString(exponentNumber);
        Double exponentNumberDouble = 
Double.parseDouble(exponentNumberString);
        outputAnswerField.setText(userBaseString+"to the 
exponent"+exponentNumberString+"equals"+Double.toString(Math.pow(userBaseNumber,exponentNumberDouble)));
    }






[nbusers] For Loop, Array, TextArea

coderkid 10/14/2012

[nbusers] Re: For Loop, Array, TextArea

Edson Richter 10/15/2012

[nbusers] For Loop, Array, TextArea

coderkid 10/15/2012

[nbusers] Re: For Loop, Array, TextArea

Edson Richter 10/15/2012

[nbusers] For Loop, Array, TextArea

coderkid 10/15/2012

[nbusers] Re: For Loop, Array, TextArea

Edson Richter 10/15/2012

[nbusers] Re: For Loop, Array, TextArea

Bayless Kirtley 10/15/2012

[nbusers] For Loop, Array, TextArea

coderkid 10/16/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close