Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Alert help please!
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lord_pwnerer




PostPosted: Mon Oct 09, 2006 3:59 pm   Post subject: Alert help please!

Ok, I actually do know how to do alerts and crap (basically), lol, but what I was wondering is (and it might not be possible at all, this question may just sound ridiculoius). Is there a way to make the appearance of the Java alert change? For example, the look that I want is the alert that can be made with Javascript and HTML. Just wondering if it's possible. Thanks.
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Mon Oct 09, 2006 4:34 pm   Post subject: (No subject)

You can't make an alert with HTML, you can with JavaScript.

To change to appearance of these alerts, all you have to do is change the look and feel to Windows style, if I'm correct in assuming that's what you want. I'll leave the rest to you and Google.
Tony




PostPosted: Mon Oct 09, 2006 5:37 pm   Post subject: (No subject)

the JavaScript alert design is actually browser dependent, and is very different between Firefox, Opera, Safari, etc.

Anyways, you'd probably need to dig through the Java's GUI library to find out where the alert is being rendered, and possibly extend that class into your own.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
lord_pwnerer




PostPosted: Mon Oct 09, 2006 5:45 pm   Post subject: (No subject)

thanks, I read a tiny bit about look and feel, but I'll look into it further. Thanks alot

(and btw technically you can make an alert with HTML, I've done so with the onclick method many times)

code:

onClick="alert('Hello!')"





simply put that onto anything with params. Not trying to be condescending, just saying, that's all. thanks for the help.
[Gandalf]




PostPosted: Mon Oct 09, 2006 6:37 pm   Post subject: (No subject)

Hrm... Isn't that just a form of 'inline' JavaScript? I may be wrong...
lord_pwnerer




PostPosted: Mon Oct 09, 2006 6:40 pm   Post subject: (No subject)

i dunno, anyway, as you may have guessed, I'm having trouble with the looks and feels, I don't really understand how to set it to windows XP. do you need a certain version of Java? I googled it and some ways came up. but I don't really get it. If anyone out there has an example of Look and Feels to Window's it would be greatly appreciated.
lord_pwnerer




PostPosted: Mon Oct 09, 2006 6:51 pm   Post subject: (No subject)

disregard the above, I did get the XP look and feel working, and it is great. Thanks alot for all your help!
Tony




PostPosted: Tue Oct 10, 2006 1:23 am   Post subject: (No subject)

that's great. Mind sharing your solution with the rest of us for future reference?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
lord_pwnerer




PostPosted: Tue Oct 10, 2006 4:16 pm   Post subject: (No subject)

sure, this should work.

code:
// Look and Feel XP test
import java.awt.*;
import java.io.*;
import javax.swing.*;

public class lookAndFeelTest
{
   

    public static void main (String[] args)
    {

     
        try
        {

            UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName ());
        }
        catch (Exception e)
        {

        }
        String tempInput = null;
        tempInput = JOptionPane.showInputDialog (null, "Please Enter Name", "Input Box", JOptionPane.ERROR_MESSAGE);

    }
}


that should generate an alert with a textbox in it, you can change the type of alert from WARNING, ERROR, and QUESTION, (i dunno, there may be others), by simply replacing where you see ERROR, with one of those.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: