0

I'm developing an application with Swing and there is a situation that I couldn't decide to what to do. I need multiple pages but;

  • Should I use multiple JFrame or JDialog or something else?
  • What are the advantages of them? Is there specific way to choose?
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Vivian Maya
  • 498
  • 1
  • 4
  • 11

2 Answers2

1

I would use JDesktopPane with JInternalFrames. With that technique you can create as many windows as you need. A good place to start with this is here: https://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html.

chris
  • 1,685
  • 3
  • 18
  • 28
  • I was exactly checking, JDesktopPane with JInternalFrame. thank you for your attention. – Vivian Maya Jun 03 '15 at 06:10
  • FYI: The MDI paradigm has been deprecated for more years then I care to remember – MadProgrammer Jun 03 '15 at 06:28
  • @MadProgrammer: Ok, what is the recommended approach if multiple documents are needed? I used the java mdi a few month ago and was pleased about it. – chris Jun 03 '15 at 06:40
  • @chris `CardLayout`, `JTabbedPane`, pretty much anything else :P – MadProgrammer Jun 03 '15 at 06:42
  • @MadProgrammer: i just loved (i promise to never use it again:) the way the user can create, arrange, resize, close the windows at runtime as needed. – chris Jun 03 '15 at 06:56
  • 1
    @chris I spent the last 6 years trying to disassemble a MDI based application because (amongst other things), it's a monolithical pile of ... joy and happiness, but it was always the wrong choice for what the organisation was trying to do, just wish I had been there when they were making the decisions. It's impossible to have any sort of application context for a single document and if one crashes, they all crash, then theirs the issues of memory within a shared context, blah, blah, blah :P – MadProgrammer Jun 03 '15 at 07:06
  • @MadProgrammer: ok, got it. Thx for the infos, was helpful for me and will be probably for others. – chris Jun 03 '15 at 07:09
1

You can also use multiple JTabbedPane in a JFrame which will make your work eassier.

see the link below:

https://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html

Programmer
  • 445
  • 4
  • 12