Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Get and Display using JOptionPane
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Izzuddin
Get and Display using JOptionPane
1 Answer(s)      2 years and 7 months ago
Posted in : Java Beginners


Hello everyone,

I have been asked by my lecturer to do a simple program. But, I don't have the idea how to start on in because this is my first time handling java. She ask to get some data from student, name and age, by using JOptionPane. Then display it.

Really appreciate your help if you guys can help me in my studies.

Thanks everyone


Advertisement
View Answers

February 13, 2012 at 11:21 AM


import javax.swing.*;

class JOPtionPaneExample 
{
    public static void main(String[] args) 
    {
        String name=JOptionPane.showInputDialog(null,"Enter Name: ");
        int age=Integer.parseInt(JOptionPane.showInputDialog(null, "Enter Age: "));
        JOptionPane.showMessageDialog(null, "Name is: "+name+" and Age is: "+Integer.toString(age));
        System.out.println("Name is: "+name+" and Age is: "+Integer.toString(age));
    }
}


Related Tutorials/Questions & Answers:
Get and Display using JOptionPane
Get and Display using JOptionPane  Hello everyone, I have been... on in because this is my first time handling java. She ask to get some data from student, name and age, by using JOptionPane. Then display it. Really
Selection Using JoptionPane
Selection Using JoptionPane  Help, can someone provide me the code using JOptionPane for the following:- Part A 1) Prompt user to make 3 selection... to quit, display the total cost of the two items; otherwise, display the total
Advertisements
Unable looping using JOptionPane - Java Beginners
Unable looping using JOptionPane  import javax.swing.*; public class Shop{ public static void main(String [] args){ Shop shop = new Shop(); String mainMenu= "(MAIN SCREEN )"; mainMenu+= "\n1) Computer Menu
Display JList value selected from the JOptionPane
Display JList value selected from the JOptionPane In this section, we are going to select the particular value from the JOptionPane combobox and displayed.... To proceed further, when the user click the button, the JOptionPane with combobox
how to display jsp page containing mysql query in particular division using ajax ?my code is below bt i cundt get it properly
how to display jsp page containing mysql query in particular division using ajax ?my code is below bt i cundt get it properly   index.html <...; } } } request.open("GET", "newjsp.jsp", true); // Create a function
joptionpane validation
joptionpane validation  import javax.swing.*; import java.util.regex.*; public class joptionpane { public static void main(String[] args... help me!i need to validate the user input on the joptionpane,and if the user
display image using jsp
display image using jsp  display image using jsp and phonegap on emulator of eclipse   Here is a simple jsp code that displays an image on browser. <%@ page import="java.io.*" %> <%@page contentType="image/gif
get and display blob from mysql on jsf
get and display blob from mysql on jsf  i want to get blob from mysql, and display on jsf page. your examples with jsp. i dont find an example with jsf. plese help me about this. thanks..   Have a look at the following
Display Hello even before main get executed??
Display Hello even before main get executed??  I have a class (main method) as follow.....As I know this can be done using static method, but Q...;class Hello{ static void display(){ System.out.print("Hello
By using Applet display a circle in a rectangle
By using Applet display a circle in a rectangle  Write a java applet to display a circle in a rectangle
Set delay time in JOptionPane
the message should be displayed using JOptionpane. For this, first of all we prompt the user to enter time in seconds and the message to display. After that using... Set delay time in JOptionPane      
Display helloworld using servlet in jboss
Display helloworld using servlet in jboss  import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld.... When i runned ma deploy.cmd, I get a message like NO SUCH FILE OR DIRECTORY,I'm
joptionpane - Java Beginners
joptionpane  Hi, I need joptionpane validation. I have joptionpane inputdialog textbox.I need to enter the string values only in the textbox for validation. Please send the sample code immediately. Its very urgent
Exporting to excel using display tag?
Exporting to excel using display tag?  Hai , I am implementing pagination in struts.It has export to excel option.When I am clicking on it ,it is displaying a alert box stating "the file you are trying to open
Set Color in JOptionPane
Set Color in JOptionPane       In this section, you will learn how to set color in JOptionPane. Now to do this, we have used UIManager class which is responsible for look and feel. Using
Set text color in JoptionPane
Set text color in JoptionPane In this section, you will learn how to set text color in JOptionPane. Now to do this, we have used UIManager class which is responsible for look and feel. Using following key value pair, we have set the text
Using JFreeChart to display recent changes in a time series
Using JFreeChart to display recent changes in a time series  Using JFreeChart to display recent changes in a time series
Write a query to display a row using index
Write a query to display a row using index  Write a query to display a row using index
joptionpane - Java Beginners
joptionpane   I need joptionpane showinputdialog textbox integer validation. Please send the sample code for me. Please its very urgent.... Thanks, Valarmathi  Hi Friend, Try the following code: import
joptionpane - Java Beginners
joptionpane  Hi, I need joptionpane showinputdialog textbox string validation. Please send the sample code for me. Please its very urgent.... Thanks, Valarmathi  Hi Friend, Try the following code: import
Display Image using Toolkit.getImage()
Display Image using Toolkit.getImage()       This section illustrates you how to display the specified image using Toolkit.getImage() method. To display the image, put an image
Array in JOptionPane - Java Beginners
Array in JOptionPane  Hello, I'm having trouble with printing an array in a JOptionPane. I am supposed to make a 2 dimensional int array called BlasTable. I'm supposed to use a method to print the array in a JOptionPane
joptionpane - Java Beginners
joptionpane  Hi, I need to change the JOptionpane foreground text color only. Please send the sample code. JOptionPane.showMessageDialog(createqmbutton, "Succesfully Create the Queue Manager", "Create Queue
JOptionPane Validation
On entering the integers, it will display error message: JOptionPane Integer...JOptionPane Validation JOptionPane allow you to create dialog boxes easily... look complex. Here we are going to validate the textfield of JoptionPane dialog
Display Multiple Images in jscrollpane using Java Jpanel
Display Multiple Images in jscrollpane using Java Jpanel  Browse and Display multiple images in vertical view of java jscrollpane using jpanel
joptionpane - Java Beginners
joptionpane  Hi, I need to hide the joptionpane message dialogs. import javax.swing.*; import java.util.regex.*; public class ValidateJOptionPane { public static void main(String[]args){ String input
how to get HTTP GET request value using javascript
how to get HTTP GET request value using javascript  how to get HTTP GET request value using javascript   how is how you can get HTTP GET request value using javascript: var parameter = window.location.search.replace
JOptionPane - Java Beginners
and output should be via JOptionPane dialogue boxes. Examples are shown below
Display Errors using Message Resources - Struts
Display Errors using Message Resources  Hello.. I've a login page where i used applicationresources.properties to display errors for null values... required.. I want to display errors using message resources using
display Helloworld through servlets using jboss
display Helloworld through servlets using jboss  I'm beginner,Can You please Write the code for this.Including WEB.INF   Please visit the following link: http://www.roseindia.net/jboss
Html form using JavaScript to display the table content
Html form using JavaScript to display the table content  HI There, Greetings, I am new to this java and I need your assistance. I have created... want to write a Html JavaScript coding to display the content from database
 

 

 

DMCA.com