sangameshrh
asked on
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(UIDefaul ts table)
{
super.initClassDefaults(ta ble);
Object[] defaults = {"TextFieldUI","com.sun.ja va.swing.p laf.window s.WindowsT extFieldUI ","TextAre aUI","com. sun.java.s wing.plaf. windows.Wi ndowsTextA reaUI"};
table.putDefaults(defaults );
}
}
and
UIManager.setLookAndFeel(n ew 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
class TextFieldLookNFeel extends PgsLookAndFeel
{
protected void initClassDefaults(UIDefaul
{
super.initClassDefaults(ta
Object[] defaults = {"TextFieldUI","com.sun.ja
table.putDefaults(defaults
}
}
and
UIManager.setLookAndFeel(n
But Now I am not getting icons in JOptionPane.(That is cross mark for error or "!" for information)
Also JFileChooser is not working
Thanks
if you want to try the second approach,
for file chooser,
"FileChooserUI", "com.sun.java.swing.plaf.w indows.Win dowsFileCh ooserUI"
for file chooser,
"FileChooserUI", "com.sun.java.swing.plaf.w
ASKER
When I gave
"FileChooserUI", "com.sun.java.swing.plaf.w indows.Win dowsFileCh ooserUI"
JFileChooser is opening but with a look and feel of PGS.
I want it to be windows look and feel
"FileChooserUI", "com.sun.java.swing.plaf.w
JFileChooser is opening but with a look and feel of PGS.
I want it to be windows look and feel
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.informationIco n";
break;
case 2:
propertyName = "OptionPane.warningIcon";
break;
case 3:
propertyName = "OptionPane.questionIcon";
break;
}
if (propertyName != null) {
return (Icon)DefaultLookup.get(op tionPane, 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"
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.informationIco
break;
case 2:
propertyName = "OptionPane.warningIcon";
break;
case 3:
propertyName = "OptionPane.questionIcon";
break;
}
if (propertyName != null) {
return (Icon)DefaultLookup.get(op
}
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"
ASKER
I am not getting that. Can u tell me how exactly it should be done??
>>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!
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!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forced accept.
Computer101
EE Admin
Computer101
EE Admin
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!