?
Solved

Jdialog / JFrame Confusion

Posted on 2004-08-26
8
Medium Priority
?
1,026 Views
Last Modified: 2008-01-09
I'm wanting to create a fairly simple UI which will present forms to the user which will allow them to view and alter data held in a database. It seems like it should be simple stuff, but I've got horribly confused. I started out using JFrame's for each of my forms - these had all the right window decoration, appeared on the Windows Taskbar ( which I want to happen ) but I couldn't make them modal. So I switched to JDialog, which I can make modal, but don't appear in the taskbar and don;t have the right window decoration ( can't minimze etc ... ) Then I read the API docs which said that creating the JDialog passig in a Frame as parent would give me what I need - I've tried about a million different combinations and I can't get it to work. Can someone explain to me what the relationship is between this two classes and how they can be used together to achieve what I'm after? I can't believe that this is as hard as I'm making out!
0
Comment
Question by:howesd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 92

Expert Comment

by:objects
ID: 11907798
onlt dialogs have a modal property, but they don't appear on the task bar.
why do u want a modal frame?
0
 
LVL 15

Expert Comment

by:Javatm
ID: 11908299
> Can someone explain to me what the relationship is between this two classes and how they can be used together to achieve what I'm after?

The only GUI that you can use for what you need is what your using now. JDialog is a modal frame but does not appear on the taskbar.
Thats the way it was made you if you still want to have a modal frame JDialog is the answer.

Hope that helps . . .
Javatm
0
 
LVL 1

Author Comment

by:howesd
ID: 11910592
Objects - it may be that I'm being a little naieve in my gui design, but basically my design was to have a form ( frame / dialog / whatever ) which presents options to the user ( search / add new / run defined queries / maintain standing data etc ) - When they choose an option, a new form is presented - I was intending to keep these forms modal so that I don't have to worry about potential conflicts between the various gui items - if they're altering standing data in one window which directly influence a client viewed in a different window I'd have to be able the handle the circumstance - making the forms modal removes that difficulty

When you use the constructor for JDialog that takes a frame as a parameter, what happens? I don;'t understand what it's supposed to achieve?
0
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 11918408
the dialog will always stay on top of its owner
0
 
LVL 18

Expert Comment

by:armoghan
ID: 11920070
I would suggest use a JFrame as the first window with menus etc and on there clicks open JDialogs as models, which have JFrame reference as owner/parent. If you need to open more windows on top of JDialog.. They will also be JDialogs..

This is a simple design for your application

Hope that helps
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question