473,417 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,417 software developers and data experts.

Passing Data From JFrame to JFrame Or to JDialog

HI

Can anyone help with the scenario where where you have to pass a certain data from one JFrame to another.

For example, suppose you have a JFrame is your main window you disabled your Jmenu and have an option of Login button and the login button calls another JDialog Class, say if Login() is true in Jdialog then enable JMenu on JFrame(Main window) exit the JDialog class.
I am using NetBeans.

Because I want to control the menu according to the Login status if is Administrator or not.
Nov 26 '08 #1
1 6111
JosAH
11,448 Expert 8TB
Do it the other way around: create a singleton Administrator object with a method (for convenience): public boolean isAdministrator(). Also create the methods login() and logout() and most important: create an addListener() method that can be used to register objects that are interested in the status change of the Administrator object (see the PropertyChangeSupport class for details).

Any objects interested in the login status of the Adminstrator register themself at that object and change their state accordingly when they receive an event. A bit of work setting it all up but it certainly pays back.

kind regards,

Jos
Nov 26 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Oliver Hirschi | last post by:
Hi, First of all sorry for my german posting before! Here is my question in english: By starting my application I construct a JFrame. By clicking onto a JButton on this JFrame, it construct...
2
by: Seanus | last post by:
Hi all, I've got a little problem with the JDialogs. Housekeeping: I'm on windows xp, with the latest JRE, I'm getting no error as such. Basically, I've got some JDialogs in my program (are...
5
Shinzon
by: Shinzon | last post by:
ok so far I have got: JFrame frame = new JFrame( "Matt's DVD's" ); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.setSize( 420, 170 ); // set frame size ...
5
Shinzon
by: Shinzon | last post by:
Ok so I have been working on this for a moment now and wondering how to add multiple jlabels to a jframe. the code looks like this: JLabel jl = new JLabel("DVD ID #= " + dvd); //Displays DVD...
9
by: aleplgr | last post by:
Hello, in this code suppose that the dlg is defined in one case as a JDialog, I run it and it seems that the JDialog is executed AFTER closing it, so the message is printed after closing the JDialog....
3
by: coffeetime | last post by:
Hi, I just decided to learn java, so I'm quite a noob. I use the book learning java third edition. have JDK 1.6 program in notepad. I have made the simple HelloJava example, and now i wanted to...
3
by: coffeetime | last post by:
Hi, I just decided to learn java, so I'm quite a noob. I use the book learning java third edition. have JDK 1.6 program in notepad. I have made the simple HelloJava example, and now i wanted to...
2
by: zahit | last post by:
hi guys, my line doesn't appear on the frame. what's the problem? import java.util.*; import java.io.*; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.*; public class...
1
by: bouncydeath | last post by:
I think my question ultimately stems from the fact that I don't fully understand classes: how they work together, when to make them, etc. So I have a class called Creature. These guys have...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.