java - Internal widows don't show up in desktop pane -
after little research on internet, created desktop pane , want put internal frames. use factory pattern create multiple internal frames (windows)
i have abstract class
import javax.swing.*; public abstract class internalwindowtemplate extends jinternalframe{ jinternalframe internalwindow; public final void createinternalwindow(string title, int width, int height, int xoffset, int yoffset, boolean isresizable, boolean isclosable, boolean ismaximizable, boolean isiconifiable){ internalwindow = new jinternalframe(title, isresizable, isclosable, ismaximizable, isiconifiable); setinternalwindowsize(width, height); setinternalwindowlocation(xoffset, yoffset); internalwindow.setvisible(true); internalwindow.setdefaultcloseoperation(jinternalframe.exit_on_close); try { internalwindow.setselected(true); } catch (java.beans.propertyvetoexception exception) { exception.getmessage(); } catch(exception exception){ exception.getmessage(); } } public void setinternalwindowlocation(int xoffset, int yoffset){ setlocation(xoffset*getinternalwindowcounter(), yoffset*getinternalwindowcounter()); } public void setinternalwindowsize(int width, int height){ setsize(width,height); } }
and create commandwindow:
import internalframe.*; import javax.swing.*; public class commandwindow extends internalwindowtemplate { public commandwindow(){ createinternalwindow("command window", 60, 40, 30, 30, false, true, false, false); } }
finally, create view gui
import java.awt.*; import javax.swing.*; public class desktopview extends jframe{ private jdesktoppane desktop; internalwindowtemplate commandwindow; public desktopview(){ //make big window indented 50 pixels each edge of screen. int inset = 50; dimension screensize = toolkit.getdefaulttoolkit().getscreensize(); setbounds(inset, inset, screensize.width - inset*2, screensize.height - inset*2); //set gui. desktop = new jdesktoppane(); commandwindow = new commandwindow(); desktop.add(commandwindow); setcontentpane(desktop); } }
when try run in main
public class desktopapp { public static void main(string[] agrs){ desktopview desktopview = new desktopview(); desktopview.setvisible(true); desktopview.setdefaultcloseoperation(desktopview.exit_on_close); } }
i "big" window, not internals. doing wrong? there don't see? suggestions appreciated. thank in advance
Comments
Post a Comment