pptx

kitewormsΛογισμικό & κατασκευή λογ/κού

3 Νοε 2013 (πριν από 3 χρόνια και 11 μήνες)

79 εμφανίσεις

Fall 2013

CISC124
-

Prof. McLeod

1

“Look and Feels”


Without worrying about the button and label for
now, see LookAndFeelDemoFrame.java and
RunLookAndFeelDemo.java.



You need to consider the starting appearance for
your windows and components.



Fall 2013

CISC124
-

Prof. McLeod

2

System Default Look and Feel


By setting:

JFrame.setDefaultLookAndFeelDecorated
(false);

and not changing the default look and feel you get
what the current system (Windows) settings
provide. In my case:

Fall 2013

CISC124
-

Prof. McLeod

3

Available Look and Feels


The command:

UIManager.getInstalledLookAndFeels();

returns an array of
UIManager.LookAndFeelInfo

objects.


For my system this provides the following:


Metal


Nimbus


CDE/Motif


Windows


Windows Classic


Fall 2013

CISC124
-

Prof. McLeod

4

Available Look and Feels, Cont.


Or, as full class names:


javax.swing.plaf.metal.MetalLookAndFeel


com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel


com.sun.java.swing.plaf.motif.MotifLookAndFeel


com.sun.java.swing.plaf.windows.WindowsLookAndFeel


com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel


Fall 2013

CISC124
-

Prof. McLeod

5

Available Look and Feels, Cont.


To use these ones, set:

JFrame.setDefaultLookAndFeelDecorated(true);


and then use:

UIManager.setLookAndFeel(
lafi_object
.getClassName());

before you instantiate your window.

Fall 2013

CISC124
-

Prof. McLeod

6

“Look and Feels”, Cont.


You should keep the same look and feel for all
windows in your program (
duh
…)


Fortunately, once you set it as shown above the
look and feel will not change.



Or, you just let the user see windows with the
same look that he is used to (however he has
configured his system).


This can be a bit
dangerous

if you set colours
directly anywhere in your program to non
-
system
colours.

Fall 2013

CISC124
-

Prof. McLeod

7

“Look and Feels”, Cont.


You can even download look and feels.


Here is a demo of one called “
Quaqua
” (what
does this look like to you?):


http://www.randelshofer.ch/quaqua/index.html



There are a bunch listed here:


http://www.javootoo.com/