
-----------------------------------
lord_pwnerer
Mon Oct 09, 2006 3:59 pm

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.

-----------------------------------
[Gandalf]
Mon Oct 09, 2006 4:34 pm


-----------------------------------
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
Mon Oct 09, 2006 5:37 pm


-----------------------------------
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.

-----------------------------------
lord_pwnerer
Mon Oct 09, 2006 5:45 pm


-----------------------------------
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)


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]
Mon Oct 09, 2006 6:37 pm


-----------------------------------
Hrm...  Isn't that just a form of 'inline' JavaScript?  I may be wrong...

-----------------------------------
lord_pwnerer
Mon Oct 09, 2006 6:40 pm


-----------------------------------
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
Mon Oct 09, 2006 6:51 pm


-----------------------------------
disregard the above, I did get the XP look and feel working, and it is great. Thanks alot for all your help!

-----------------------------------
Tony
Tue Oct 10, 2006 1:23 am


-----------------------------------
that's great. Mind sharing your solution with the rest of us for future reference?

-----------------------------------
lord_pwnerer
Tue Oct 10, 2006 4:16 pm


-----------------------------------
sure, this should work.

// 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.
