• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 385
  • Last Modified:

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
0
sangameshrh
Asked:
sangameshrh
  • 5
  • 2
1 Solution
 
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
 
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
ksivananthCommented:
>>I am not getting that. Can u tell me how exactly it should be done??

try this,

"OptionPaneUI", "javax.swing.plaf.basic.BasicOptionPaneUI"
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now