Results 1 to 8 of 8
  1. #1
    ZaabZ is offline Member
    Join Date
    Aug 2010
    Location
    Denmark
    Posts
    8
    Rep Power
    0

    Default JOption Msgbox title help?

    Hey all

    Just been working on this program for a couple of days now.. I recently started learning Java @ school, though my teacher cant give me a good answer on this issue:

    Java Code:
    package opg_c_uge34_valuta;
    
    public class Main {
        {
    }
          public static void main(String[] args) {
          String valmsgtext = "Intast kursen du ønsker at regner med, eksempel: (578.35)";
          String str1 = javax.swing.JOptionPane.showInputDialog(valmsgtext, "Skriv kurs her");
          Double kur = Double.parseDouble(str1);
          String Msgtext = "Indtast det antal kroner som skal omregnes."; 
         
          String str2 = javax.swing.JOptionPane.showInputDialog(Msgtext, "Skriv tal her");
          Double svar = Double.parseDouble(str2);
          Double result;
          result = svar / kur * 100;      
                
          int ix = (int)(result * 100.0); 
          double result2 = ((double)ix)/100.0;
                
          String res = "Dine " + svar + " kroner bliver i alt " + result2 + " Amerikanske Dollars:";      
          javax.swing.JOptionPane.showMessageDialog(null, res);
    }
    
    }
    }
    Dont mind the danish words, the code is what we are here for ;)
    Anyway, what I want is to change the name of the MsgBox that will pop-up, "Input" isnt really a name I like in this case;)

    Thanks in advance

    - ZaabZ

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default

    Have you read the API for JOptionPane to see whether there are any overloads of showImputDialog(...) that allow you to set the title?
    JOptionPane (Java Platform SE 6)

    And it's not called a MsgBox. Java is not VB.

    db

  3. #3
    gafa's Avatar
    gafa is offline Senior Member
    Join Date
    Jun 2010
    Posts
    107
    Rep Power
    0

    Default

    As I may think you are to put your attention at the showMessageDialog method params
    Watch the JOptionPane.showMessageDialog Docs to find "title" param description

  4. #4
    ZaabZ is offline Member
    Join Date
    Aug 2010
    Location
    Denmark
    Posts
    8
    Rep Power
    0

    Default

    Quote Originally Posted by Darryl.Burke View Post
    Have you read the API for JOptionPane to see whether there are any overloads of showImputDialog(...) that allow you to set the title?
    JOptionPane (Java Platform SE 6)

    And it's not called a MsgBox. Java is not VB.

    db
    Well thanks for the pointer - Although I did mention that I am new to Java, as I am new to this forum; I did not expect to get "flamed" for my unknown. The point is that you understood what I asked for when I said MsgBox, I did not refer to the actual Msgbox command in VB. Then I would have said so, and I would obviously NOT have been posting on this forum. ;)

    Also I dont really know anything about API, ofcouse I will try to learn something, but just saying that I should look after API overloads doesnt really help me. I am still new to Java, and wouldnt know where the tale/head was.


    - ZaabZ

  5. #5
    ZaabZ is offline Member
    Join Date
    Aug 2010
    Location
    Denmark
    Posts
    8
    Rep Power
    0

    Default

    Quote Originally Posted by gafa View Post
    As I may think you are to put your attention at the showMessageDialog method params
    Watch the JOptionPane.showMessageDialog Docs to find "title" param description
    I did look in these docs, but with no result earlier.
    Anyway I found this link with the docs helping ;D..

    JOptionPane (Java 2 Platform SE 5.0)

    Thank you very much though.
    Problem solved.

    - ZaabZ

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default

    Quote Originally Posted by ZaabZ View Post
    I did not expect to get "flamed" for my unknown.
    If you call that flaming, you've never been flamed. Grow a thicker skin or avoid forums like the plague.

    db

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Darryl.Burke View Post
    If you call that flaming, you've never been flamed. Grow a thicker skin or avoid forums like the plague.
    I agree with Darryl and have seen no flaming in this thread at all. Please chill.

  8. #8
    ZaabZ is offline Member
    Join Date
    Aug 2010
    Location
    Denmark
    Posts
    8
    Rep Power
    0

    Default

    Quote Originally Posted by Darryl.Burke View Post
    If you call that flaming, you've never been flamed. Grow a thicker skin or avoid forums like the plague.

    db
    Yeah.. My apologies :)
    Though I just personally found it a bit tough getting corrected like that.


    Quote Originally Posted by Fubarable View Post
    I agree with Darryl and have seen no flaming in this thread at all. Please chill.
    I couldnt be more chill :)


    Quote Originally Posted by gafa View Post
    As I may think you are to put your attention at the showMessageDialog method params
    Watch the JOptionPane.showMessageDialog Docs to find "title" param description
    Thanks for the help;) That pointed me in the right direction!

    Problem is solved.

    - ZaabZ

Similar Threads

  1. Getting text on the title bar of the browser...
    By vaibhavspawar in forum New To Java
    Replies: 1
    Last Post: 07-23-2010, 10:39 PM
  2. Replies: 2
    Last Post: 02-10-2010, 08:27 PM
  3. Replies: 1
    Last Post: 12-02-2009, 03:39 PM
  4. Replies: 0
    Last Post: 02-28-2009, 04:08 AM
  5. set * at tab title
    By keffie91 in forum Advanced Java
    Replies: 7
    Last Post: 10-06-2008, 07:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •