Go Back   Java Programming Forums > Java Standard Edition Programming Help > Loops & Control Statements


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 21-03-2010, 11:29 PM
Junior Member
 

Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
soccer_kid_6 is on a distinguished road
Default I am trying on how to print values from an array all to show up on a dialog using a f

I am trying on how to print values from an array all to show up on a dialog using a for loop. Can anybody help me with this?
Java Code
double[] dailyTemperatures;
		  dailyTemperatures= new double[7];
		  for (int d = 0; d<dailyTemperatures.length; d++)
		  		{
		  			String t;
		  			t = JOptionPane.showInputDialog(null, "Enter daily temperature values:");
		  			dailyTemperatures[d] = Double.parseDouble(t);
		        }// end for loop
		  for (int i =0; i <= 6; i++)
i want to print all my values in just one dialog box. I would rather use a for loop but if you guys can not tell me another way it is okay



Reply With Quote Share this thread on Facebook
Sponsored Links
Java Training from DevelopIntelligence
  #2 (permalink)  
Old 22-03-2010, 08:34 PM
Junior Member
 

Join Date: Dec 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
MaGgy is on a distinguished road

I'm feeling Cool
Default Re: I am trying on how to print values from an array all to show up on a dialog using

Ok meaby that can help something...

Java Code
import javax.swing.*;
public class StringLengthTableModel{

	public static void main(String[] args){
	double[] dailyTemperatures = new double[7];
	String a="";
	for (int d = 0; d<dailyTemperatures.length; d++)
	  		{
		  		int[] t = new int[dailyTemperatures.length];
	  			t[d]=new Integer(JOptionPane.showInputDialog("Enter daily temperature values:")).intValue();

	  			String m="The temperature "+ d+ "   -   ";
	  			a=a+t[d]+" Measure \n  "+m;
	  		}
	  JOptionPane.showMessageDialog(null,a);
	}
}

Last edited by helloworld922; 22-03-2010 at 10:46 PM. Reason: [code] tags please
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
Assgining values to array indexes chronoz13 Collections and Generics 4 19-01-2010 07:01 PM
How do i show all the values in one window(JOptionPane)?? Antonioj1015 AWT / Java Swing 1 26-11-2009 01:24 AM
Substitution of Values in Array nyeung Collections and Generics 2 27-10-2009 12:02 AM
Having trouble insert/sorting array values w/ binary searching. bh-chobo Collections and Generics 4 08-10-2009 07:38 AM
How to Populate all array values using the java.util.Arrays class JavaPF Java Code Snippets and Tutorials 0 07-04-2009 10:31 AM


100 most searched terms
Search Cloud
2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java programming practice problems java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

All times are GMT. The time now is 02:08 AM.
Powered by vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.