0

I was try several opinion but neither of them it seams to work.

This method returns JTextArea

    private static JTextArea getJArea() {
    if (jArea == null) {
        jArea = new JTextArea();
        jArea.setBounds(new Rectangle(16, 153, 468, 139));
        jArea.setVisible(true);
        jArea.setLineWrap(true);
        jArea.setWrapStyleWord(true);
        jArea.setEditable(false);
        jsp.getViewport().add(jArea);

    }
    return jArea;
}

and i JDesktopPane i add this area with this code snippet

jDesktopPane.add(getJArea(), null);

And this not work, I was try to create a JScrollPane and assign JTextArea to him and add that to the JDesktopPane, but that also doesn't work.

vaske
  • 9,332
  • 11
  • 50
  • 69

1 Answers1

1

You need to use JInternalFrame too. JDesktopPane is supposed to be parent container for JInternalFrame objects.

JInternalFrame iframe = new JInternalFrame("Title", true, true, true, true);
iframe.setSize(180, 150);
iframe.setVisible(true);
iframe.getContentPane().add(new JScrollPane(new JTextArea("TestText",20,20)));
JDesktopPane desktop = new JDesktopPane();
desktop.add(iframe);

Then add the JDesktopPane to e.g. JFrame and you are done.

jitter
  • 53,475
  • 11
  • 111
  • 124
  • Yes, basically that's it. Thank you. – vaske Oct 16 '09 at 12:51
  • Just have to add ((javax.swing.plaf.basic.BasicInternalFrameUI) iframe.getUI()).setNorthPane(null); to remove the nort title bar, and thats it. – vaske Oct 16 '09 at 12:52