Sponsors: Michael Fertik - Best JAVA Web hosting Company & 30% off


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-09-2010, 08:56 AM
Member
 
Join Date: Jan 2010
Posts: 9
Rep Power: 0
keycoffee is on a distinguished road
Default need help for JOptionPane....
hi. I'm noe struggling with using JOptionPane. The question which I was assigned to do this.

You are to write a program that will accept a positive integer in the range 0 to 9999, i.e. the integer has a maximum of 4 digits.s input and then outputs the digits one per line.

The input/output must be via dialog boxes. The following are examples of the input/output you should produce:

I don't know how to put the output but I will type it down.

Homework 3(The title)

Enter a positive 4 digit number
[empty box where you can type the number] [Lets say 1234]

OK[Button] Cancel[Button]



Once click OK button, it will shows the next dialog

Homework3 Answer[Title]

The number was 1234
The digits are
1
2
3
4
OK[Button]

So far I got this codes


import javax.swing.*;
public class Homework3{

public static void main(String args[]){

String number;

number=JOptionPane.showInputDialog (null,"Enter a positive 4 digit");
JOptionPane.showMessageDialog(null,"The number was" + number);




}
}
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 02-09-2010, 08:59 AM
Senior Member
 
Join Date: Aug 2009
Posts: 2,193
Rep Power: 4
r035198x is on a distinguished road
Default
So read the API specs for the String class to see what methods are available and pick the ones that are likely to help you.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

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
Help with JOptionPane SwEeTAcTioN New To Java 12 11-03-2009 04:12 AM
JOptionpane tommyyyy New To Java 2 03-20-2009 08:33 AM
JOptionPane Mir New To Java 5 11-29-2008 02:04 AM
JOptionPane whosadork New To Java 2 10-23-2008 02:17 AM
JOptionPane (customizing) Java Tip Java Tips 0 03-14-2008 11:39 AM


Java Forums is supported by the best jsp hosting.

All times are GMT +2. The time now is 09:00 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org