473,546 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using JOptionPane

Hi,

I am new to Java Programming and I am trying to write code using JOption
pane to prompt user to type information and then have string output command
to display information on the screen.
I am able to prompt for typing the information but the display does not
work. Here is my sample code:

**

/**

* <p>TitleTesting </p>

* <p>Descriptio : Display Movie list</p>

*

*/

//Print Address Labels

import javax.swing.JOp tionPane;

public class Homework1 {

public Homework1() {

}

public static void main(String[] args) {

String movieName;

String theaterName;

//Enter Movie Name

String movieName =

JOptionPane.sho wInputDialog(

null, "Enter the Name of the Movie ",

"Example 1.0 Input",

JOptionPane.QUE STION_MESSAGE);

//Enter Name

String directorName=

JOptionPane.sho wInputDialog(

null, "Enter Name of Director ",

"Example 1.1 Input",

JOptionPane.QUE STION_MESSAGE);

//Display Name of Movie and Director

String output = movieName+ directorName

JOptionPane.sho wMessageDialog( null,output,"Ex ample 1.2 output",

JOptionPane.INF ORMATION_MESSAG E);

System.exit(0);



}

}


Jul 23 '05 #1
1 4839
jazzy wrote:
Hi,
I am new to Java Programming and I am trying to write code using JOption
pane to prompt user to type information and then have string output command
to display information on the screen.
I am able to prompt for typing the information but the display does not
work. Here is my sample code:

<snip>

You'll probalby do better at comp.lang.java. programmer, this is a
javascript group.

Good Luck,
Mike

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
12839
by: - Steve - | last post by:
Example String testString = "Testing \t tabs"; JOptionPane.showMessageDialog(null, testString, "TEST", JOptionPane.INFORMATION_MESSAGE); Instead of getting the output "Testing tabs", I get something more like "Testing | tabs" (although it isn't a pipe symbol, it's something unusual).
1
3362
by: Oleg Konovalov | last post by:
Hi, I am trying to implement an application administrative tool with interactive console (i.e. showing some info to the user and taking user input) using Swing and JDK 1.4. Up until now I have done info display part after selecting items from the menu (using JTextArea and append() ),
1
4356
by: AliceG | last post by:
Hi all, By using JOptionPane, I'm trying to do this little program with Notepad for generating a password from the user's first two letters of the first name, the age calculated as a difference of the current year (by use of GregorianCalendar) and the birthday year and the last two letters of the last name, all concatenated in lower case. The...
1
5036
by: R69D | last post by:
Write and test the following method that implements the power function: static double pow(double x, int n) This method returns the value of x raised to the power n. For example pow(2.0, -3) would return 2-3 = 0.125 For each value of pow(x,n) that you print, also print the value of Math.pow(x,n) to check your results.
2
3336
by: ragaman123 | last post by:
Hello there, I am designing a battleships game in java and am trying to output to the screen a simple message when a user sinks a ship. I have been trying to use JOptionPane to output a message, however it is not working correctly. The message is not being painted to the screen properly and the whole screen becomes inactive and i cant press any...
3
8230
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0 build with these methods, will appear to encrypt and decrypt, but the resulting decrypted file will be corrupted. I tried encrypting a .bmp file and...
1
2115
by: Smarteric | last post by:
import javax.swing.JOptionPane; public class MilesPerGallon { public static void main(String args) { String miles; String gallons; double MPG; double miles1, gallons1;
5
4530
by: Ramola | last post by:
hi, I was wondering if i can customise a JOptionPane ??? ex : A JOptionPane by default has a background color gray............. can i change it ?? can i put some images in the background ? Its necessary coz............in my game i cant afford having a JOptionPane tht looks sad .........I want to be catchy !!! kind regards, Malavika
3
7445
by: heat84 | last post by:
I want to customise JOptionPane and add a KeyListener to it. I want to behave in a certain manner when the enter key is pressed , but from the look of things, the key listener I am adding to the JDialog is not working. The code is running and not giving errors but when it comes to printing the statements, when I press enter , nothing is happening...
0
7507
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7435
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7794
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3492
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3472
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.