Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 03-04-08   #11 (permalink)
Programmer
 
intel nvidia

Join Date: Jul 2006
Posts: 194

Rep: 11 mjoc13 Unknown
Unique Rep: 10
Trader Rating: 5
Default

to me it looks like your logging into the app and want to validate the entered info then continue to the reset of the app?

Since your already logged in, the context of the app is based on the user, so you do not need any info from that login screen. Simple get a handle to the login window and dispose. Assuming the actionPerformed is part of the login window, you can do something like

public void actionPerformed(ActionEvent evt) {
Frame window = null;
if (evt.getSource() == empLogin) {
employeeLogin emp = new employeeLogin();
emp.init();

window = new Frame("Employee");
window.add("Center", emp);
window.pack();
window.setVisible(false);

}

if (window != null) {
//context based on login window
this.dispose();
window.setVisible(true);
}
}

of course you may have to play around, as i haven't done swing in a couple years. Web services ftw

Keep us posted.
__________________
Relax and enjoy life!

System: My System
CPU
C2D e6400
Motherboard
eVga 680i - T1
Memory
2x1GB Gskill HZ
Graphics Card
eVga 8800 gts sc 320
Hard Drive
wd 320 sataII, WD 250 PATA
Sound Card
OB
Power Supply
Corsair HX620W
Case
Coolmaster Elite
OS
Win XP pro sp2
Monitor
Sammy 19 ws LCD
mjoc13 is offline   Reply With Quote
Old 03-04-08   #12 (permalink)
New to Overclock.net
 
intel nvidia

Join Date: Nov 2007
Posts: 163

Rep: 6 Sivsta Unknown
Unique Rep: 6
Trader Rating: 0
Default

Code:
this.dispose();
is not valid.

But yes, Once the user types in the correct login/password then it will (in theory) close the login screen and open the logged on screen.
__________________
The GreenThing - You probably guessed it

System: The GreenThing
CPU
E8400
Motherboard
EVGA 680i A1
Memory
2x2GB Crucial Balistix PC2 8500
Graphics Card
2x BFG 8800 GTS G92 512mb
Hard Drive
RaptorX 150gb, WD 500gb
Sound Card
X-Fi XtremeGamer Fata1y Pro
Power Supply
Thermaltake Toughpower 700w
Case
Antec 900
CPU cooling
Tuniq Tower
GPU cooling
Stock
OS
Windows Vista
Monitor
22'' Samsung
Sivsta is offline   Reply With Quote
Old 03-06-08   #13 (permalink)
Programmer
 
intel nvidia

Join Date: Jul 2006
Posts: 194

Rep: 11 mjoc13 Unknown
Unique Rep: 10
Trader Rating: 5
Default

Quote:
Originally Posted by Sivsta View Post
Code:
this.dispose();
is not valid.

But yes, Once the user types in the correct login/password then it will (in theory) close the login screen and open the logged on screen.
(**getLoginWindow**).dispose();

that is why you need the context of the login window. Once you have it you can dispose it from the windows manager and it's ready for garbage collection.
__________________
Relax and enjoy life!

System: My System
CPU
C2D e6400
Motherboard
eVga 680i - T1
Memory
2x1GB Gskill HZ
Graphics Card
eVga 8800 gts sc 320
Hard Drive
wd 320 sataII, WD 250 PATA
Sound Card
OB
Power Supply
Corsair HX620W
Case
Coolmaster Elite
OS
Win XP pro sp2
Monitor
Sammy 19 ws LCD
mjoc13 is offline   Reply With Quote
Old 03-09-08   #14 (permalink)
New to Overclock.net
 
intel ati

Join Date: Mar 2007
Posts: 159

Rep: 11 ghell Unknown
Unique Rep: 9
Trader Rating: 0
Default

I am a bit rusty with AWT (why don't you use Swing, are you compiling using gcj or something) but you should be able to either create the new Frame and close the old one or get the content pane (whatever is the AWT equivalent) and replace its contents rather than creating a new window at all.
__________________
System: Anon.
CPU
Core 2 Duo E8500
Motherboard
ASUS Striker Exteme 680i
Memory
4*1024MiB Corsair XMS2 Pro 800MHz 4-4-4-12 (LEDs)
Graphics Card
HD 4870x2
Hard Drive
2*250GB Seagate Barracuda 7200.10, 1*500GB 7200.11
Sound Card
X-Fi XtremeMusic
Power Supply
1000W Enermax Galaxy DXX
Case
SilverStone Temjin TJ07
CPU cooling
D-Tek Fuzion
OS
Vista Ultimate x64 / Debian x64
Monitor
Dell 2408WFP (DisplayPort)
ghell is offline   Reply With Quote
Old 03-09-08   #15 (permalink)
110100001101001111000
 
C-bro's Avatar
 
intel nvidia

Join Date: Jan 2006
Location: Hamilton, ON
Posts: 1,832

Rep: 283 C-bro is a proven memberC-bro is a proven memberC-bro is a proven member
Unique Rep: 215
FAQs Submitted: 6
Folding Team Rank: 240
Hardware Reviews: 9
Trader Rating: 1
Default

Quote:
Originally Posted by ghell View Post
I am a bit rusty with AWT (why don't you use Swing, are you compiling using gcj or something) but you should be able to either create the new Frame and close the old one or get the content pane (whatever is the AWT equivalent) and replace its contents rather than creating a new window at all.
This is the route I'd take. I like Swing as well. You'd have your main JFrame declared, then just use a collection of JPanel.

Basically you'd just have
Code:
JFrame mainFrame;
JPanel login;
JPanel loggedIn;

// set up all your panels and frame properties

mainFrame.setContentPane(login);
mainFrame.pack();
//do stuff
if(login is successful)
mainFrame.setContentPane(loggedIn);
mainFrame.pack()
This way you keep your main window Frame the same at all times, and you're just swapping out different content panels. You can dispose of the content JPanels afterwards if need be. Be sure to call pack() after changing content panes to redraw the window appropriately.

System: RAID0R
CPU
Intel E2180 3.33GHz
Motherboard
Asus P5K-E/WIFI-AP vMod
Memory
2GB Kingmax DDR2-1066
Graphics Card
EVGA 8800GT
Hard Drive
2x250GB WD+500GB 7200.11
Sound Card
SB Audigy 2
Power Supply
Corsair CMPSU-550VX
CPU cooling
Arctic Cooling Freezer 7 Pro
GPU cooling
Zalman VF900-Cu
OS
Windows Vista Business 32-Bit
Monitor
HP F2105 21" & Samsung 712N

Last edited by C-bro : 03-09-08 at 10:23 PM.
C-bro is offline I fold for Overclock.net Overclocked Account C-bro's Gallery   Reply With Quote
Old 03-09-08   #16 (permalink)
New to Overclock.net
 
intel ati

Join Date: Mar 2007
Posts: 159

Rep: 11 ghell Unknown
Unique Rep: 9
Trader Rating: 0
Default

Another advantage of Swing is that you can ditch the ye olde
Code:
window.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }            
        });
and just use
Code:
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
__________________
System: Anon.
CPU
Core 2 Duo E8500
Motherboard
ASUS Striker Exteme 680i
Memory
4*1024MiB Corsair XMS2 Pro 800MHz 4-4-4-12 (LEDs)
Graphics Card
HD 4870x2
Hard Drive
2*250GB Seagate Barracuda 7200.10, 1*500GB 7200.11
Sound Card
X-Fi XtremeMusic
Power Supply
1000W Enermax Galaxy DXX
Case
SilverStone Temjin TJ07
CPU cooling
D-Tek Fuzion
OS
Vista Ultimate x64 / Debian x64
Monitor
Dell 2408WFP (DisplayPort)
ghell is offline   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 07:42 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.23574 seconds with 8 queries