java - JOptionPane.showInternalInputDialog not being editable -


i'm writing jdesktoppane application, , in jinternalframe, i've got jeditorpane webpage open (yes, i'm aware of crappy abilities of jeditorpane net, don't scold).

i have way user input page visit, when call joptionpane.showinternalinputdialog(this, "what page visit?") text field not editable. problem has occurred me both in java 6 , java 7.

edit: here's constructor of class

public internet() {     super("internet", true, true, true, true);     setsize(500, 400);     try {         pane = new jeditorpane(new url("http://www.vetrustech.tk"));     } catch (malformedurlexception e) {         e.printstacktrace();     } catch (ioexception e) {         e.printstacktrace();     }     setcontentpane(pane);     bar = new jmenubar();     page = new jmenu("page");     enterpage = new jmenuitem("enter page");     bar.add(page);     page.add(enterpage);      setjmenubar(bar);      enterpage.addactionlistener(new actionlistener() {          @override         public void actionperformed(actionevent arg0) {             loadpage();         }     }); 

and here's method loading page

private void loadpage() {     string s = joptionpane.showinternalinputdialog(this,             "what page visiting?");     if (s == null) {         return;     }     if (s.equals("")) {         return;     }     try {         url u = new url(s);         pane.setpage(u);     } catch (malformedurlexception e) {         e.printstacktrace();     } catch (ioexception e) {         e.printstacktrace();     } } 

here's reason why suited sscce important...

this works....

import java.awt.borderlayout; import java.awt.eventqueue; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jdesktoppane; import javax.swing.jframe; import javax.swing.jinternalframe; import javax.swing.joptionpane; import javax.swing.uimanager; import javax.swing.unsupportedlookandfeelexception;  public class internet {      public static void main(string[] args) {         new internet();     }      public internet() {         eventqueue.invokelater(new runnable() {             @override             public void run() {                 try {                     uimanager.setlookandfeel(uimanager.getsystemlookandfeelclassname());                 } catch (classnotfoundexception | instantiationexception | illegalaccessexception | unsupportedlookandfeelexception ex) {                 }                  jdesktoppane dp = new jdesktoppane();                 final jinternalframe inf = new jinternalframe("help", true, true, true, true);                 inf.setsize(200, 200);                 inf.setvisible(true);                 dp.add(inf);                  jbutton btn = new jbutton("click");                 btn.addactionlistener(new actionlistener() {                     @override                     public void actionperformed(actionevent e) {                         joptionpane.showinternalinputdialog(inf, "hit me");                     }                 });                 inf.add(btn);                  jframe frame = new jframe("testing");                 frame.setdefaultcloseoperation(jframe.exit_on_close);                 frame.setlayout(new borderlayout());                 frame.add(dp);                 frame.setsize(400, 400);                 frame.setlocationrelativeto(null);                 frame.setvisible(true);             }         });     }  } 

this suggests doing else in code we're not seeing.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -