Results 1 to 6 of 6

Thread: JOptionPane

  1. #1
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default JOptionPane

    Hi All

    Can i Edit in JOptionPane.Like Add Some Button And TextArea.

    Plz help me..

  2. #2
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Hi,
    You can add all components to a Jpanel and then add it to JOptionPane.
    That will solve your problem.. :)
    To finish sooner, take your own time....
    Nivedithaaaa

  3. #3
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Niveditha View Post
    Hi,
    You can add all components to a Jpanel and then add it to JOptionPane.
    That will solve your problem.. :)
    Hi Niveditha

    Can you give me some example code..

  4. #4
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Java Code:
    public void doMyJob(){
    		 JPanel panel = new JPanel();
    		 JTextField tf = new JTextField();
    		 JLabel lbl = new JLabel("Name");
    		 panel.add(lbl);
    		 panel.add(tf);
    		 
    		 JOptionPane.showMessageDialog([B]parent [/B],"Title",JOptionPane.PLAIN_MESSAGE);
    	 }
    where parent is the component you are invoking this JOptionPane on.
    To finish sooner, take your own time....
    Nivedithaaaa

  5. #5
    matt_well's Avatar
    matt_well is offline Member
    Join Date
    Jul 2008
    Posts
    59
    Rep Power
    0

    Default

    Hi, there are many ways u can do
    Java Code:
    import javax.swing.*; 
    public DisplayADialog{
      public static void main (String[] args) {
        JOptionPane.showMessageDialog(null,"Hello Attention! How Are You?",
               "Learn Java For Fun",JOptionPane.WARNING_MESSAGE);
        System.exit(0);
     }
    }
    There "WARNING_MESSAGE" can be changed to such as...

    "ERROR_MESSAGE"
    "PLAIN_MESSAGE"
    "QUESTION_MESSAGE"
    "INFORMATION_MESSAGE":)

  6. #6
    Alekz89 is offline Member
    Join Date
    Nov 2008
    Posts
    1
    Rep Power
    0

    Default

    Well you forgot public class DisplayADialog just so you know ;)

    Quote Originally Posted by matt_well View Post
    Hi, there are many ways u can do
    Java Code:
    import javax.swing.*; 
    public DisplayADialog{
      public static void main (String[] args) {
        JOptionPane.showMessageDialog(null,"Hello Attention! How Are You?",
               "Learn Java For Fun",JOptionPane.WARNING_MESSAGE);
        System.exit(0);
     }
    }
    There "WARNING_MESSAGE" can be changed to such as...

    "ERROR_MESSAGE"
    "PLAIN_MESSAGE"
    "QUESTION_MESSAGE"
    "INFORMATION_MESSAGE":)

Similar Threads

  1. JOptionPane (customizing)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-14-2008, 12:39 PM
  2. About JOptionPane.showMessageDialog
    By jhetfield18 in forum AWT / Swing
    Replies: 2
    Last Post: 11-02-2007, 11:45 PM
  3. About JOptionPane.showMessageDialog
    By jhetfield18 in forum Advanced Java
    Replies: 0
    Last Post: 11-02-2007, 11:56 AM
  4. Problem with JOptionPane.showInputDialog()
    By romina in forum AWT / Swing
    Replies: 1
    Last Post: 08-07-2007, 06:33 AM
  5. problems with JOptionPane
    By oregon in forum AWT / Swing
    Replies: 2
    Last Post: 08-05-2007, 06:58 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
  •