File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Setting a Default width for JOptionPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Setting a Default width for JOptionPane" Watch "Setting a Default width for JOptionPane" New topic
Author

Setting a Default width for JOptionPane

Andrew Geroge Alexander
Ranch Hand

Joined: Feb 14, 2012
Posts: 31
Hello,
I have a JTable of notes, but I do not want to show the entire notes on table level, when the user clicks the table a JOptionPane is opened to display the messages.. However, if the notes inside is long, then the message box also is long.. I have attached a jpeg to explain what I am saying, can I set a default width. so if the message is really big, it will be wrapped to accommodate? I am using Jave NetBeans IDE 7.1



[Thumbnail for LongBar.jpg]

Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

You can:
  • Split the message you're displaying to multiple lines
  • Create a panel and set its size, then pass it as parameter when displaying JOptionPane dialog


  • The quieter you are, the more you are able to hear.
    m Korbel
    Ranch Hand

    Joined: Jun 19, 2012
    Posts: 150
    - put JTextArea(String text, int rows, int columns) (disabled) in JScrollPane

    JOptionPane.showConfirmDialog(null, myJScrollPane, "Quesion", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);

    - use Html with JLabel / (disabled) JTextPane / EditorPane
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Setting a Default width for JOptionPane
     
    Similar Threads
    using JOtionPane
    JOptionPane
    JTable column width problem..
    TD Width
    Urgent (Removing "OK" button from JOptionpane)