Simple program but error?

hi everyone!!
i am trying to make a simple help file displaying hi and how are you in text area.the compilation gives no error but still i can't run that.can anyone please tell me how to solve my problem of making a simple help screen display...
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Help extends JFrame
public Help ()
Container c= getContentPane();
c.setLayout(new FlowLayout() ) ;
String val="hi.\n"+"how r u.\n";
TextArea text= new TextArea( val,20,30);
add(text);
setSize(300,300);
setVisible(true);
public static void main(String args[])
Help hm=new Help();
hm.addWindowListener(
new WindowAdapter()
public void WindowClosing(WindowEvent e)
System.exit(0);
}

is this what you mean..its not working..
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Help extends JFrame
public Help ()
Container c= getContentPane();
c.setLayout(new FlowLayout() ) ;
String val="hi.\n"+"how r u.\n";
TextArea text= new TextArea( val,20,30);
Help.getContentPane().add(text);
setSize(300,300);
setVisible(true);
public static void main(String args[])
Help hm=new Help();
hm.addWindowListener(
new WindowAdapter()
public void WindowClosing(WindowEvent e)
System.exit(0);
}

Similar Messages

  • Hello!!! I Reenroll "Developer Enterprise Program" but error:We are unable to process your request. Help pleeeeees!

    Hello!!! I Reenroll "Developer Enterprise Program" but error:We are unable to process your request. Help plees!
    Development period ended six months ago.

    ???????

  • Proc a simple program but got error

    I tried to proc the sample program cppdemo1.pc with the
    following command....
    proc CODE=CPP include=/usr/include/
    include=/opt/SUNWspro/WS6U2/include/CC/Cstd/
    include=/opt/SUNWspro/WS6U2/include/CC/ cppdemo1.pc
    but I got
    INTERNAL ERROR: Failed assertion [PGE Code=90105]
    Segmentation Fault
    WHY???

    A lot longer ago than that. PowerPC apps haven't been supported since Lion, 10.7.x.
    You may have just purchased the game, but the developers obviously haven't kept up to date with the requirements for newer versions of the Mac OS.
    You have three options, depending on how old your Mac is.
    1) If it were ever able to boot directly to Snow Leopard, you could create a separate partition and install SL onto that partition. Make sure to turn on the option during the installation to install Rosetta. That is OS X's PPC emulator.
    2) If your Mac is too new to install Snow Leopard, then you can purchase and install Snow Leopard Server within a VM, such as Parallels, VirtualBox, or Vmware.
    3) Use a separate older Mac for running outdated software.

  • Simple program, getting error, can't figure out why

    Hello. I'm new to java and am having some trouble with this simple piece of code. When i compile DisplayObjStatsApplication I get:
    DisplayObjStatsApplication.java [6:1] cannot resolve symbol
    symbol : variable height
    location: class ObjStats
    box1.height = 60;
    ^
    DisplayObjStatsApplication.java [7:1] cannot resolve symbol
    symbol : variable weight
    location: class ObjStats
    box1.weight = 50;
    ^
    DisplayObjStatsApplication.java [8:1] cannot resolve symbol
    symbol : variable depth
    location: class ObjStats
    box1.depth = 20;
    ^
    3 errors
    Errors compiling DisplayObjStatsApplication.
    Here is the code for ObjStats.java:
    public class ObjStats {
    public ObjStats() {
    int height, weight, depth;
    And here is the code for DisplayObjStatsApplication:
    public class DisplayObjStatsApplication {
    public static void main(String[] args) {
    ObjStats box1 = new ObjStats();
    box1.height = 60;
    box1.weight = 50;
    box1.depth = 20;
    What am I doing wrong?
    Thanks

    hi,
    i am new to java too!!!!!!
    maybe you can use some "setter' and "getter" methods!!!!!!!
    Here is the code for ObjStats.java:
    public class ObjStats {
    int height;
    int weight;
    int depth;
    public ObjStats() {
        this.height=0;
        this.weight=0;
        this.depth=0;
    public setHeight(int height) {
       this.height=height;
    public setWeight(int weight) {
       this.weight=weight;
    public setDepth(int depth) {
       this.depth=depth;
    public getHeight() {
       return height;
    public getWeight() {
       return weight;
    public getDepth() {
       return depth;
    And here is the code for DisplayObjStatsApplication:
    public class DisplayObjStatsApplication {
    public static void main(String[] args) {
    ObjStats box1 = new ObjStats();
    box1setHeight(60) ;
    box1.setWeight(50);
    box1.setDepth(20);
    System.out.println("The height of the box is " + box1.getHeight());
    System.out.println("The weight of the box is " + box1.getWeight());
    System.out.println("The depth of the box is " + box1.getDepth());
    }

  • Simple program, but "invalid method dec" at "displayObject(newTriangle)"

    Little help would be appreciated. Hopefully a quickie for some of you pros out there. Won't complile as per subject. Just want to view my object. thanks, djason
    // For extending the GeometricObject class.
    public class Triangle extends GeometricObject{
         private double s1, s2, s3;
         GeometricObject newTriangle=new Triangle(2,3,4);
         displayObject(newTriangle);
         //System.out.println(newTriangle.toString());
         //System.out.println("& " +newTriangle.findArea());
         //Constructor
         public Triangle(double s1, double s2, double s3){
              this.s1=s1;
              this.s2=s2;
              this.s3=s3;
         //Use abstract method findArea from GeometricObject.class
         public double findArea(){
              double s=((s1+s2+s3)/2);
              double b=((s-s1)*(s-s2)*(s-s3));
              double a=Math.sqrt(s*b);
              return a;
         public double findPerimeter(){
              return (s1+s2+s3);          
         static void displayObject(GeometricObject object){
              System.out.println();
              System.out.println(object.toString());          
              System.out.println(object.findArea());
              System.out.println(object.findPerimeter());
    }

    Sorry- tried to update the "code" ugliness, but too late. This should be more appealing to the eye. Thanks, djason
    // For extending the GeometricObject class.
    public class Triangle extends GeometricObject{
         private double s1, s2, s3;
         GeometricObject newTriangle=new Triangle(2,3,4);
         displayObject(newTriangle);
         //System.out.println(newTriangle.toString());
         //System.out.println("& " +newTriangle.findArea());
         //Constructor
         public Triangle(double s1, double s2, double s3){
              this.s1=s1;
              this.s2=s2;
              this.s3=s3;
         //Use abstract method findArea from GeometricObject.class
         public double findArea(){
              double s=((s1+s2+s3)/2);
              double b=((s-s1)*(s-s2)*(s-s3));
              double a=Math.sqrt(s*b);
              return a;
         public double findPerimeter(){
              return (s1+s2+s3);          
         static void displayObject(GeometricObject object){
              System.out.println();
              System.out.println(object.toString());          
              System.out.println(object.findArea());
              System.out.println(object.findPerimeter());
    }

  • Error in my simple program

    hey I'm a beginner to java and i tried to program a simple calculator but my Jcreator says it has an Error this is the program that i encoded:
    import javax.swing.JOptionPane;
    public class quiz
         public static void main(String[]args)
              String input;
              double quiz1,quiz2,quiz3,quiz4,quiz5,average;
              input=JOptionPane.showInputDialog("Enter first quiz:");
              Double.parseDouble(input);
              input=JOptionPane.showInputDialog("Enter second quiz:");
              Double.parseDouble(input);
              input=JOptionPane.showInputDialog("Enter third quiz:");
              Double.parseDouble(input);
              input=JOptionPane.showInputDialog("Enter fourth quiz:");
              Double.parseDouble(input);
              input=JOptionPane.showInputDialog("Enter fifth quiz:");
              Double.parseDouble(input);
              average=(quiz1+quiz2+quiz3+quiz4+quiz5)/5
              JOptionPane.showMessageDialog(null,"The average is" +average,"Average",JOptionPane.INFORMATION_MESSAGE);
              System.exit(0);
    }

    shouldn't it be like
    input=JOptionPane.showInputDialog("Enter first quiz:");
    if (input == null) {
                return;
    quiz1 = Double.parseDouble(input); or something like that?
    or else your "quiz" variable don't have any value?
    Edited by: Billwaa on Dec 14, 2008 8:31 AM

  • Numbers 09 not working - I can open the program but only a few files are available, missing blank, checklist and many others. e.g  when I click on a file I get this error: The document "nmbtemplate is invalid. The index.xml file is missing. help.

    Please let me know what I can do to get my Numbers (iWork 09) working properly again.
    Here is what is going on:
    Numbers in iWork 09 not working can't access Blank, Checklist and many other files within Numbers.   I can open the program but only a few files are available. When I click on the file (which also has no icon just the name of the file) this warning appears:
    The document "Blank.nmbtemplate" is invalid.  The index.xml file is missing.
    I recently had to get a new hard drive installed and had the system upgraded and more memory put in by a Mac certified specialist recommended to me from the Apple store in Northbrook because this was the 3rd time my drive went bad but this time it was to old (I got the IMAC- in 2007) and the Apple store could no longer work on it this time so they recommended a few places that had certified Mac specialists.  Since then Numbers is not working right.
    I'm sure it's something simple to fix, but I've tried re installing it and that didn't work.  Appreciate any help.
    Thanks
    AppMare

    There is one way its getting fixed. Once I update my Adobe Illustrator CC to Adobe Illustrator CC 2014 it is further allowing me to go into the system folder and allocate the font to the file so that it can replace it. My only concern now is that our MAC partners who will receive these files back from us have Adobe CS6. We will down save it to CS6 but I hope they won't experience any font issues because of us using CC 2014? Any light you can shed on this?

  • Simple SQL, but i get an error?

    Here's my code:
    <cfquery name="setNote"
    datasource="#DS#" dbtype="ODBC"
    username="#DSUsername#" password="#DSPassword#"
    >
    update Notes set note = 'test' where noteid = 1
    </cfquery>
    Seems simple enough, but I get this:
    [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
    UPDATE statement.
    Yeah, I know "Access Sucks.", but this still seems like it
    should work, no?
    If I do a "select * from notes" and cfdump the results, I see
    the data that is there, I just can't update it.
    What am I missing here?

    duplicate post. answered in db access forum.
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • My garageband can't be used because when I open a project (new or old) the program extends beyond the bottom of the display screen and I can't access what is below the bottom of the screen (like the record button).  I know there's a simple fix, but what?

    My garageband can't be used because when I open a project (new or old) the program extends beyond the bottom of the display screen and I can't access what is below the bottom of the screen (like the record button).  I know there's a simple fix, but what?

    two things to try: either click the green "zoom" bottom at the topLeft of the window in the title bar, or go to your System Prefs and then Displays, and increase the resolution that is used

  • I just bought PSE 11. Serial No. accepted but Error appears, preventing me to install. What is wrong OR, how can I get program installed?  I've tried at least four times!!  Jim H.

    I just bought PSE 11. Serial No. accepted but Error appears, preventing me to install. What is wrong OR, how can I get program installed?  I've tried at least four times!!  Jim H.

    Use the instructions here to completely remove/uinstall all iTunes/Apple software and componenets and then start from scratch.
    http://support.apple.com/kb/HT1923
    B-rock

  • I am getting a runtime error, try to uninstall all itune programs but I cannot uninstall apple mobile device support, so I can reinstall itunes, what now

    I am getting a runtime library error r6034, it tells me to uninstall all Apple programs, but when I get to Apple Mobile Device Support I will not let me uninstall this program to continue, what do I do next?

    Solving the iTunes Installation Problems in Windows
    1. Apple has posted their solution here: iTunes 11.1.4 for Windows- Unable to install or open - MSVCR80 issue.
    2. If the Apple article does not fully resolve the problem for you, then try Troubleshooting issues with iTunes for Windows updates - MSVCR80.

  • I tried installing an update to QuickTime. An error occurred and it wouldn't install. I tried removing the QuickTime program, but a window appeared telling me that a fatal error  ccurred during installation and I could not remove the program.  Now what?

    I tried installing an update to QuickTime. An error occurred and it wouldn't install. I tried removing the QuickTime program, but a window appeared telling me that a fatal error  ccurred during installation and I could not remove the program.  Now what?

    I tried removing the QuickTime program, but a window appeared telling me that a fatal error  ccurred during installation and I could not remove the program.
    I think we'd better see if some other application (other than QuickTime itself) has dropped old QuickTime componentry in the system files on the PC. (If there's a version mismatch between the old componentry and the "QuickTime proper" componentry, that can create those symptoms.)
    So we'll go looking for the older QuickTime componentry in the most common locations for it to be stashed.
    First we'll need to change some view options on the PC.
    1. Open My Computer from the desktop or Start menu.
    2. In the Tools menu, click Folder Options.
    3. Click the View tab.
    4. In the "Advanced settings" pane under "Hidden files and folders" make sure that the "Show hidden files and folders" option is selected, and the "Hide extensions for known file types" option is unchecked.
    5. Click OK.
    Now in My Computer, open your C drive.
    Open the "Windows" folder.
    Open the "system32" folder.
    What files and/or folders can you see in there with QuickTime in the file/folder name? (In a standard installation of QuickTime, you should see precisely two files ... QuickTime.qts and QuickTimeVR.qtx ... and no QuickTime folders whatsoever.)

  • The server deploy EJB but I run EJB Client program,The error msg is can't find JNDI

    Hi all:
    I am using Weblogic 6.1/SP2. I use the console to start
    server and deploy EJB jar,from the msg I see my EJB jar
    been deployed. When I run EJB Client program, the error
    msg is can't find JNDI name t3://URL:11003.....
    I check my ejb-jar.xml amd weblogic-ejb-jar.xml are fine.
    Last week I did deploy EJB and ran the client both
    suceessful. Any ideas, Thank you.

    Sabha:
    Thank you for your help info, I soloved the problem.
    The problem is the ejb jar was deleted(I don't why)
    then System Admin to deploy EJB jar from Admin console.
    After that everything is fine.
    "Sabha" <[email protected]> wrote:
    Run weblogic.Admin -url ... LIST to see whether the JNDI name is there
    . or
    you can view the jndi tree of the server from the console (right click
    on
    server name) and check whether the ejb home is bound to the correct jndi
    name.
    -Sabha
    "Matthew Shinn" <[email protected]> wrote in message
    news:[email protected]..
    Hi Albert,
    I would double check to make sure the EJB was indeed deployed (check
    server log). What message did you see that leads you to believe itwas
    successfully deployed? Also, verify the JNDI name you are lookingup in
    your client matches the JNDI name for the EJB. If this doesn't solve
    the problem, please post the error message and stack trace you are
    seeing on the client.
    - Matt
    Albert Pi wrote:
    Hi all:
    I am using Weblogic 6.1/SP2. I use the console to start
    server and deploy EJB jar,from the msg I see my EJB jar
    been deployed. When I run EJB Client program, the error
    msg is can't find JNDI name t3://URL:11003.....
    I check my ejb-jar.xml amd weblogic-ejb-jar.xml are fine.
    Last week I did deploy EJB and ran the client both
    suceessful. Any ideas, Thank you.

  • JMS: simple program (urgent please)

    I am quite new with the JMS. I am trying to have a simple program running in order to start from it towards the application I want to build.
    I tried to run the sample program below:
    package chat;
    import javax.jms.*;
    import javax.naming.*;
    import java.io.*;
    import java.io.InputStreamReader;
    import java.util.Properties;
    public class Chat implements javax.jms.MessageListener {
    private TopicSession pubSession;
    private TopicSession subSession;
    private TopicPublisher publisher;
    private TopicConnection connection;
    /* Constructor. Establish JMS publisher and subscriber */
    public Chat() throws Exception {
    // Obtain a JNDI connection
    Properties env = new Properties();
    // ... specify the JNDI properties specific to the vendor
    InitialContext jndi = new InitialContext(env);
    // Look up a JMS connection factory
    TopicConnectionFactory conFactory =
    (TopicConnectionFactory) jndi.lookup("TopicConnectionFactory");
    // Create a JMS connection
    TopicConnection connection =
    conFactory.createTopicConnection();
    // Create two JMS session objects
    TopicSession pubSession =
    connection.createTopicSession(false,
    Session.AUTO_ACKNOWLEDGE);
    TopicSession subSession =
    connection.createTopicSession(false,
    Session.AUTO_ACKNOWLEDGE);
    // Look up a JMS topic
    Topic chatTopic = (Topic) jndi.lookup("anytopic");
    // Create a JMS publisher and subscriber
    TopicPublisher publisher =
    pubSession.createPublisher(chatTopic);
    TopicSubscriber subscriber =
    subSession.createSubscriber(chatTopic);
    // Set a JMS message listener
    subscriber.setMessageListener(this);
    // Intialize the Chat application
    set(connection, pubSession, subSession, publisher);
    // Start the JMS connection; allows messages to be delivered
    connection.start();
    /* Initialize the instance variables */
    public void set(TopicConnection con, TopicSession pubSess,
    TopicSession subSess, TopicPublisher pub) {
    this.connection = con;
    this.pubSession = pubSess;
    this.subSession = subSess;
    this.publisher = pub;
    /* Receive message from topic subscriber */
    public void onMessage(Message message) {
    try {
    TextMessage textMessage = (TextMessage) message;
    String text = textMessage.getText();
    System.out.println(text);
    } catch (JMSException jmse) {
    jmse.printStackTrace();
    /* Create and send message using topic publisher */
    protected void writeMessage(String text) throws JMSException {
    TextMessage message = pubSession.createTextMessage();
    publisher.publish(message);
    /* Close the JMS connection */
    public void close() throws JMSException {
    connection.close();
    /* Run the Chat client */
    public static void main(String[] args) {
    try {
    Chat chat = new Chat();
    // Read from command line
    BufferedReader commandLine = new
    java.io.BufferedReader(new
    InputStreamReader(System.in));
    // Loop until the word "exit" is typed
    while (true) {
    String s = commandLine.readLine();
    if (s.equalsIgnoreCase("exit")) {
    chat.close(); // close down connection
    System.exit(0); // exit program
    } else {
    chat.writeMessage(s);
    } catch (Exception e) {
    e.printStackTrace();
    But at the line
    �TopicConnectionFactory conFactory =
    (TopicConnectionFactory) jndi.lookup("TopicConnectionFactory");�
    I got this exception:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
         at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at chat.Chat.<init>(Chat.java:24)
         at chat.Chat.main(Chat.java:94)
    I realize that the problem is in the jndi setup. But, the problem is that I do not know where to go now and what should I do. I do not know how can I get the jndi.properties file and where and how to put it.
    Please, kindly advise from your experience. I would appreciate clear steps to have this program running properly. Otherwise, if you do have a sample program that is already running, please provide it to me.

    Thank you for your prompt reply.
    I tried another example.
    package test;
    javax.jms.*;
    import javax.naming.*;
    public class SimpleTopicPublisher { /** * Main method. * * @param args the topic used by the example and, * optionally, the number of messages to send */
    public static void main(String[] args) {
    String topicName = null;
    Context jndiContext = null;
    TopicConnectionFactory topicConnectionFactory = null;
    TopicConnection topicConnection = null;
    TopicSession topicSession = null;
    Topic topic = null;
    TopicPublisher topicPublisher = null;
    TextMessage message = null;
    final int NUM_MSGS;
    // if ((args.length < 1) || (args.length > 2)) {
    // System.out.println("Usage: java " + "SimpleTopicPublisher " + "[]");
    // System.exit(1);
    topicName = new String("MyTopic");
    System.out.println("Topic name is " + topicName);
    if (args.length == 2) {
    NUM_MSGS = (new Integer(args[1])).intValue();
    } else {
    NUM_MSGS = 1;
    /* * Create a JNDI API InitialContext object if none exists * yet. */
    try {
    jndiContext = new InitialContext
    } catch (NamingException e) {
    System.out.println("Could not create JNDI API " + "context: " +
    e.toString());
    e.printStackTrace();
    System.exit(1);
    /* * Look up connection factory and topic. If either does * not exist, exit. */
    try {
    topicConnectionFactory = (TopicConnectionFactory) jndiContext.
    lookup("TopicConnectionFactory");
    topic = (Topic) jndiContext.lookup(topicName);
    } catch (NamingException e) {
    System.out.println("JNDI API lookup failed: " + e.toString());
    e.printStackTrace();
    System.exit(1);
    /* * Create connection. * Create session from connection; false means session is * not transacted. * Create publisher and text message. * Send messages, varying text slightly. * Finally, close connection. */
    try {
    topicConnection = topicConnectionFactory.createTopicConnection();
    topicSession = topicConnection.createTopicSession(false,
    Session.AUTO_ACKNOWLEDGE);
    topicPublisher = topicSession.createPublisher(topic);
    message = topicSession.createTextMessage();
    for (int i = 0; i < NUM_MSGS; i++) {
    message
    .setText("This is message " + (i + 1));
    System.out.println("Publishing message: " + message.getText());
    topicPublisher.publish(message);
    } catch (JMSException e) {
    System.out.println("Exception occurred: " + e.toString());
    } finally {
    if (topicConnection != null) {
    try {
    topicConnection.close();
    } catch (JMSException e) {}
    It is mentioned in SUN JMS tutorial that "When you use the J2EE SDK 1.3.1, your JMS provider is the SDK. " So I am using that and I did the follwoing:
    --start the J2EE server as follows:
    j2ee -verbose
    Then I created the adminstrated object:
    j2eeadmin -addJmsDestination MyTopic topic
    But still getting this error:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    So now where is the error?
    Thank you in advance

  • Even a simple program is not working ?

    Hi there,
    I typed a simple program to display the customer details. The program goes like this :
    import java.lang.*;
    public class Customer
         String custname;
         String custID;
    public Customer()
         custname = "Bob";
         custID = "S20010";
    public void displaydetails()
         System.out.println("Customer name is " + custname);
         System.out.println("Customer ID is " + custID);
    public static void main(String a[])
         Customer cust = new Customer();
         cust.displaydetails();
    The compilation went right. But, when I executed the program the following error message is displayed :
    c:\>java Customer.java
    Exception in thread "main" java.lang.NoClassDefFoundError: Customer/java.
    Please help !!

    Don't cross-post.
    http://forum.java.sun.com/thread.jspa?threadID=576890&messageID=2891064#2891064

Maybe you are looking for

  • All PA & OM Infotypes in one IDOC

    Hi All, Could anyone please let me know if there is any standard idoc which can cater to all the PA & OM infotypes. I searched for some some of the HRMD* idoc types which supports either PA or OM infotypes , but not completely. Any help is really app

  • Initialisation Period according to SAP Note: 487381

    Hi, SAP Gurus, I have a problem My fiscal year start from April to March. Unfortunately I open the period 11th i.e. February. Now I want to post in month of November ie…. in Period “08”. I checked in MMRV where back posting allowed. So I can post onl

  • Screen protectors and image quality

    I have a screen protector on my 3G and thinking about getting one for my iPhone 4. How you guys liking them so far? I am worried about it degrading the image quality of the new high res screen. Tom

  • Image Map in a div tag causing problems in webpage

    I have an image map in a div tag (I'm using Dreamweaver so I've place hot spots on a gif within a div tag). When I preview in a browser the hot spots are creating an empty space between the image and the div tag below it, which there shouldn't be. Pr

  • Aperture 3 opening error

    Hello Anybody know how to solve this problem, when I click on aperture icon below message is appeared . Please help my. Thanks.