Problem with PGS Look And Feel

I am using PGS Look and feel. I was having a problem with JTextFileld and JTextArea. Hence according to the suggestion I got in experts-exchange I changed my code to

class TextFieldLookNFeel extends PgsLookAndFeel
{
      protected void initClassDefaults(UIDefaults table)
      {
            super.initClassDefaults(table);
            Object[] defaults = {"TextFieldUI","com.sun.java.swing.plaf.windows.WindowsTextFieldUI","TextAreaUI","com.sun.java.swing.plaf.windows.WindowsTextAreaUI"};
            table.putDefaults(defaults);
      }
}

and
UIManager.setLookAndFeel(new TextFieldLookNFeel());

But Now I am not getting icons in JOptionPane.(That is cross mark for error or "!" for information)

Also JFileChooser is not working

Thanks
sangameshrhAsked:
Who is Participating?
 
ksivananthConnect With a Mentor Commented:
>>I am not getting that. Can u tell me how exactly it should be done??

try this,

"OptionPaneUI", "javax.swing.plaf.basic.BasicOptionPaneUI"
0
 
ksivananthCommented:
can you post the exception stack?

one approach would be, you can find the name of the missing icons and provide them. The other would be to use windows LAF for thos components too like you did for text fields!
0
 
ksivananthCommented:
if you want to try the second approach,

for file chooser,

"FileChooserUI", "com.sun.java.swing.plaf.windows.WindowsFileChooserUI"
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
sangameshrhAuthor Commented:
When I gave
"FileChooserUI",      "com.sun.java.swing.plaf.windows.WindowsFileChooserUI"

JFileChooser is opening but with a look and feel of PGS.
I want it to be windows look and feel
0
 
ksivananthCommented:
on the other hand looks like you can fix the issue with the JOptionPane in PSG itself,

all you have to do is extend the below method and return appropriate Icon object for appropriate properties,

    protected Icon getIconForType(int messageType) {
      if(messageType < 0 || messageType > 3)
          return null;
        String propertyName = null;
      switch(messageType) {
      case 0:
          propertyName = "OptionPane.errorIcon";
            break;
      case 1:
          propertyName = "OptionPane.informationIcon";
            break;
      case 2:
          propertyName = "OptionPane.warningIcon";
            break;
      case 3:
          propertyName = "OptionPane.questionIcon";
            break;
      }
        if (propertyName != null) {
            return (Icon)DefaultLookup.get(optionPane, this, propertyName);
      }
      return null; //HERE YOU CAN RETURN YOUR ICON OBJ FOR APPROPRIATE PROPERTIES
    }

of the OptionPaneUI class of PSG LAF and register that class as UI as below,

"OptionPaneUI", "YOUR UI CLASS"


0
 
sangameshrhAuthor Commented:
I am not getting that. Can u tell me how exactly it should be done??
0
 
ksivananthCommented:
>>JFileChooser is opening but with a look and feel of PGS.
I want it to be windows look and feel
>>

I would rather say, it would have a mix of PGS and Windows! Since you use PGS for other fields like buttons, dropdown, table... they will retain the look of the PGS!
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.