Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 08-21-2006, 06:07 PM   #1 (permalink)
patonb's Avatar
 
Master Techie

Join Date: Jan 2005

Location: In Gov't Regulated Cubical

Posts: 2,752

patonb has a spectacular aura aboutpatonb has a spectacular aura about

Default Java Q's

K, so my java self teaching is going okay, but I've run into a problem.I'm creating popup windows, and I get the window to popup, but its blank. A simple message should be shown but nope.
Added menu bars.. they show up but yet the message doesn't.
ALL LEGAL java and word for word from text, btw.

Is IE blocking my java popup from working??

thanks
patonb is offline  
Old 08-22-2006, 02:41 AM   #2 (permalink)
 
Newb Techie

Join Date: Jul 2006

Posts: 34

The Future

Send a message via AIM to The Future
Default

Could we see your source? It's possible you overlooked something, or the text did.
The Future is offline  
Old 08-22-2006, 11:49 AM   #3 (permalink)
patonb's Avatar
 
Master Techie

Join Date: Jan 2005

Location: In Gov't Regulated Cubical

Posts: 2,752

patonb has a spectacular aura aboutpatonb has a spectacular aura about

Default

K here it is:

Popupindow.java:

Quote:
import java.awt.*;

public class Popupindow extends java.applet.Applet{
Frame window;

public void init(){
add(new Button("Open"));
add(new Button("Close"));

window = new BaseFrame("A Popup Window");
window.resize(150,150);
window.show();
}

public boolean action(Event evt, Object arg){
if(evt.target instanceof Button){
String label=(String)arg;
if (label.equals("Open")){
if (!window.isShowing())
window.show();
}

else if (label.equals("Close")){
if(window.isShowing())
window.hide();
}
return true;
}
else return false;
}
}
BaseFrame.java:

Quote:
import java.awt.*;

class BaseFrame extends Frame{
String message = "This is a window";

BaseFrame(String title){
super(title);
setFont (new Font("Helvetica", Font.BOLD, 30));
}

public boolean handleEvent(Event evt){
if(evt.id == Event.WINDOW_DESTROY) hide();
return super.handleEvent(evt);
}

public void paint(Graphics g){
g.drawString(message, 20,20);
}
}
result:
Attached Images
 
patonb is offline  
Old 08-23-2006, 11:54 AM   #4 (permalink)
patonb's Avatar
 
Master Techie

Join Date: Jan 2005

Location: In Gov't Regulated Cubical

Posts: 2,752

patonb has a spectacular aura aboutpatonb has a spectacular aura about

Default

Anybody?? Man.... Teach'n yourself blows!....
__________________
Intel Q6600 g0 @ 3.2Ghz Turniq 120 Heatsink BFG 260 OC MaxCore (core 216) + xfx GTX 260 (core 216)
2x2gb OCZ Platinums XFX 680i motherboard Silverstone DA700 Antec 900
16,412 3dmark06 score


Foldie = e2180 Asus pq5-n SLI 8800gt T-rad cooler (710/1836/1010) 1Gig RAM
TOTAL
patonb is offline  
Old 08-23-2006, 12:47 PM   #5 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default

Sorry, I don't make GUI's with Java. I also think the best approach is to make console programs until you have learned the basics, regardless of which language you're learning. That's just my opinion, but I know many instructors/authors share that point of view.
jaeusm is offline  
Old 08-23-2006, 12:55 PM   #6 (permalink)
patonb's Avatar
 
Master Techie

Join Date: Jan 2005

Location: In Gov't Regulated Cubical

Posts: 2,752

patonb has a spectacular aura aboutpatonb has a spectacular aura about

Default

I'm actually half way through the book...... It's just so odd. Its like my simple drawstring doesn't work/ is being stopped by IE.

Adding more to the basic window works, menu bars andd such, but linking them to events doesn't run.. The destroy_window does though.
__________________
Intel Q6600 g0 @ 3.2Ghz Turniq 120 Heatsink BFG 260 OC MaxCore (core 216) + xfx GTX 260 (core 216)
2x2gb OCZ Platinums XFX 680i motherboard Silverstone DA700 Antec 900
16,412 3dmark06 score


Foldie = e2180 Asus pq5-n SLI 8800gt T-rad cooler (710/1836/1010) 1Gig RAM
TOTAL
patonb is offline  
Old 08-23-2006, 01:49 PM   #7 (permalink)
 
Newb Techie

Join Date: Jul 2006

Posts: 34

The Future

Send a message via AIM to The Future
Default

I don't make GUI in Java either, but I seem to remember something about having to cast your Graphics class into a "Graphics2D" class with an explicit cast before using it, but I think thats only for certain things, and in the most recent levels of Java.
The Future is offline  
Old 08-23-2006, 01:54 PM   #8 (permalink)
patonb's Avatar
 
Master Techie

Join Date: Jan 2005

Location: In Gov't Regulated Cubical

Posts: 2,752

patonb has a spectacular aura aboutpatonb has a spectacular aura about

Default

GAAAAAAAAAAAAAAAAAAAAAAH....... note to self......... don't get bored and decided learning more programing is a good idea.

Thanks all
__________________
Intel Q6600 g0 @ 3.2Ghz Turniq 120 Heatsink BFG 260 OC MaxCore (core 216) + xfx GTX 260 (core 216)
2x2gb OCZ Platinums XFX 680i motherboard Silverstone DA700 Antec 900
16,412 3dmark06 score


Foldie = e2180 Asus pq5-n SLI 8800gt T-rad cooler (710/1836/1010) 1Gig RAM
TOTAL
patonb is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On