How can I do this in JAVA
what i need is the following:
Create an applet that has a JTextField for the user to enter the name of a color. If the color entered is not either red, white, blue, then your applet should throw an Exception and tell the user the color entered was not valid. Otherwise change the background color to the appropriate color.
Re: How can I do this in JAVA
Hello Daren,
Looks like you have a problem with your java related issues everyday or most often, I will suggest you using following site http://forums.sun.com/ to get immediate help.
Someone will surely help you fix your problem here.
Re: How can I do this in JAVA
You may use the following jtextfield programming logic to apply in your project.
Code:
JTextArea textArea = new JTextArea();
textArea.setOpaque(true);
textArea.setBackground(Color.Blue);
textArea.setForeground(Color.BLACK);
textArea.setText(answer);
textArea.setBorder(CommonUI.createEtchedBorder());
textArea.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
or else you may also have the following programming logic in your project.
Code:
someField.setBackground(new JTextField().getBackground());