Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problem when trying to create a new look and feel

0 views
Skip to first unread message

Lloyd Dupont

unread,
Dec 6, 1998, 3:00:00 AM12/6/98
to
i try to customize a look and feel so i write

package lloyd.NeXT;
public class NeXTScrollBarUI BasicScrollBarUI
{
public static ComponentUI createUI(JComponent c)
{
return new NeXTScrollBarUI();
}
... other code
}

in my test function i write
public static void main(String[] args)
{
Frame f = new Frame();
UIManager.put("ScrollBarUI","lloyd.NeXT.NeXTScrollBarUI");
f.add(new JButton("hello"));
}

and i always have the following exception (with is stack)
UIDefaults.getUI() failed: no ComponentUI class for:
javax.swing.JScrollBar,0,0,0x0,invalid,alignmentX=null,alignmentY=null,borde
r=,flags=0,maximumSize=,minimumSize=,preferredSize=,blockIncrement=10,orient
ation=VERTICAL,unitIncrement=1]java.lang.Error
at javax.swing.UIDefaults.getUIError(UIDefaults.java:351)
at javax.swing.UIDefaults.getUI(UIDefaults.java:377)
at javax.swing.UIManager.getUI(UIManager.java:544)
at javax.swing.JScrollBar.updateUI(JScrollBar.java:192)
at javax.swing.JScrollBar.<init>(JScrollBar.java:143)
at javax.swing.JScrollBar.<init>(JScrollBar.java:158)
at javax.swing.JScrollBar.<init>(JScrollBar.java:172)
at lloyd.NeXT.Main.main(Main.java:31)


what can i do ?
even worst i define a LookAndFeel
package lloyd.NeXT;
public class NeXTLookAndFeel extends BasicLookAndFeel
{
public String getDescription() {return "simple NeXT look and feel (few
Component designed).";}
public String getID() {return "NeXT";}
public String getName() {return "NeXT/Lloyd";}

public boolean isNativeLookAndFeel() {return false;}
public boolean isSupportedLookAndFeel() {return true;}

protected void initClassDefaults(UIDefaults table)
{
super.initClassDefaults(table);

String NeXT = "lloyd.NeXT.NeXT";
Object[] classes =
{
"ScrollBarUI", NeXT + "ScrollBarUI"
};
table.putDefaults(classes);
}
}

and when in the test function i write
UIManager.setLookAndFeel("lloyd.NeXT.NeXTLookAndFeel");
this bugs ... (don't find my look and feel)

but if i write
UIManager.setLookAndFeel(new lloyd.NeXT.NeXTLookAndFeel());
this works well and deliver the same exception when i try to create my
JScrollBar


Lloyd Dupont

unread,
Dec 6, 1998, 3:00:00 AM12/6/98
to
i am using the just new shipped jdk1.2 (for windows)
0 new messages