java.lang.Objectjavax.swing.LookAndFeel
javax.swing.plaf.basic.BasicLookAndFeel
javax.swing.plaf.metal.MetalLookAndFeel
public class MetalLookAndFeel
Implements the Java look and feel (codename: Metal).
By default metal uses bold fonts for many controls. To make all controls (with the exception of the internal frame title bars and client decorated frame title bars) use plain fonts you can do either of the following:
swing.boldMetal to
false. For example,
java -Dswing.boldMetal=false MyApp.
swing.boldMetal to
Boolean.FALSE. For example:
UIManager.put("swing.boldMetal", Boolean.FALSE);
swing.boldMetal, if set,
takes precendence over the system property of the same name. After
setting this defaults property you need to re-install the
MetalLookAndFeel, as well as update the UI
of any previously created widgets. Otherwise the results are undefined.
These lines of code show you how to accomplish this:
// turn off bold fonts // re-install the Metal Look and Feel // only needed to update existing widgets
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans package.
Please see XMLEncoder.
| Constructor Summary | |
|---|---|
MetalLookAndFeel()
|
|
| Methods inherited from class javax.swing.plaf.basic.BasicLookAndFeel |
|---|
createAudioAction, getAudioActionMap, initialize, loadSystemColors, playSound, uninitialize |
| Methods inherited from class javax.swing.LookAndFeel |
|---|
getDesktopPropertyValue, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, toString, uninstallBorder |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MetalLookAndFeel()
| Method Detail |
|---|
public String getName()
LookAndFeel
getName in class LookAndFeelpublic String getID()
LookAndFeel
getID in class LookAndFeelpublic String getDescription()
LookAndFeel
getDescription in class LookAndFeelpublic boolean isNativeLookAndFeel()
LookAndFeel
isNativeLookAndFeel in class LookAndFeelpublic boolean isSupportedLookAndFeel()
LookAndFeel
isSupportedLookAndFeel in class LookAndFeelpublic boolean getSupportsWindowDecorations()
LookAndFeel returned
RootPaneUI instances support providing Window decorations
in a JRootPane.
This implementation returns true, since it does support providing these border and window title pane decorations.
getSupportsWindowDecorations in class LookAndFeelJDialog.setDefaultLookAndFeelDecorated(boolean),
JFrame.setDefaultLookAndFeelDecorated(boolean),
JRootPane.setWindowDecorationStyle(int)protected void initClassDefaults(UIDefaults table)
ComponentUI classes,
putting the ID-ComponentUI pairs
in the passed-in defaults table.
Each JComponent class
specifies its own UI class ID string.
For example,
JButton has the UI class ID "ButtonUI",
which this method maps to "javax.swing.plaf.metal.MetalButtonUI".
initClassDefaults in class BasicLookAndFeelprotected void initSystemColorDefaults(UIDefaults table)
initSystemColorDefaults in class BasicLookAndFeelprotected void initComponentDefaults(UIDefaults table)
initComponentDefaults in class BasicLookAndFeelprotected void createDefaultTheme()
public UIDefaults getDefaults()
LookAndFeel
getDefaults in class BasicLookAndFeelpublic void provideErrorFeedback(Component component)
Invoked when the user attempts an invalid operation,
such as pasting into an uneditable JTextField
that has focus.
If the user has enabled visual error indication on the desktop, this method will flash the caption bar of the active window. The user can also set the property awt.visualbell=true to achieve the same results.
provideErrorFeedback in class LookAndFeelcomponent - Component the error occured in, may be
null indicating the error condition is
not directly associated with a
Component.LookAndFeel.provideErrorFeedback(java.awt.Component)public static void setCurrentTheme(MetalTheme theme)
MetalLookAndFeel.
This may not be null.
MetalLookAndFeel, as well as update the UI
of any previously created widgets. Otherwise the results are undefined.
These lines of code show you how to accomplish this:
// turn off bold fonts // re-install the Metal Look and Feel // only needed to update existing widgets
theme - the theme to be used, non-null
NullPointerException - if given a null parametergetCurrentTheme()public static MetalTheme getCurrentTheme()
MetalLookAndFeel.
This will always be non-null, as it will set the current theme if one
hasn't been set already.
setCurrentTheme(javax.swing.plaf.metal.MetalTheme)public Icon getDisabledIcon(JComponent component, Icon icon)
Icon with a disabled appearance.
This method is used to generate a disabled Icon when
one has not been specified. For example, if you create a
JButton and only specify an Icon via
setIcon this method will be called to generate the
disabled Icon. If null is passed as icon
this method returns null.
Some look and feels might not render the disabled Icon, in which case they will ignore this.
getDisabledIcon in class LookAndFeelcomponent - JComponent that will display the Icon, may be nullicon - Icon to generate disable icon from.
public Icon getDisabledSelectedIcon(JComponent component, Icon icon)
Icon for use by disabled
components that are also selected. This method is used to generate an
Icon for components that are in both the disabled and
selected states but do not have a specific Icon for this
state. For example, if you create a JButton and only
specify an Icon via setIcon this method
will be called to generate the disabled and selected
Icon. If null is passed as icon this method
returns null.
Some look and feels might not render the disabled and selected Icon, in which case they will ignore this.
getDisabledSelectedIcon in class LookAndFeelcomponent - JComponent that will display the Icon, may be nullicon - Icon to generate disabled and selected icon from.
public static FontUIResource getControlTextFont()
public static FontUIResource getSystemTextFont()
public static FontUIResource getUserTextFont()
public static FontUIResource getMenuTextFont()
public static FontUIResource getWindowTitleFont()
public static FontUIResource getSubTextFont()
public static ColorUIResource getDesktopColor()
public static ColorUIResource getFocusColor()
public static ColorUIResource getWhite()
public static ColorUIResource getBlack()
public static ColorUIResource getControl()
public static ColorUIResource getControlShadow()
public static ColorUIResource getControlDarkShadow()
public static ColorUIResource getControlInfo()
public static ColorUIResource getControlHighlight()
public static ColorUIResource getControlDisabled()
public static ColorUIResource getPrimaryControl()
public static ColorUIResource getPrimaryControlShadow()
public static ColorUIResource getPrimaryControlDarkShadow()
public static ColorUIResource getPrimaryControlInfo()
public static ColorUIResource getPrimaryControlHighlight()
public static ColorUIResource getSystemTextColor()
public static ColorUIResource getControlTextColor()
public static ColorUIResource getInactiveControlTextColor()
public static ColorUIResource getInactiveSystemTextColor()
public static ColorUIResource getUserTextColor()
public static ColorUIResource getTextHighlightColor()
public static ColorUIResource getHighlightedTextColor()
public static ColorUIResource getWindowBackground()
public static ColorUIResource getWindowTitleBackground()
public static ColorUIResource getWindowTitleForeground()
public static ColorUIResource getWindowTitleInactiveBackground()
public static ColorUIResource getWindowTitleInactiveForeground()
public static ColorUIResource getMenuBackground()
public static ColorUIResource getMenuForeground()
public static ColorUIResource getMenuSelectedBackground()
public static ColorUIResource getMenuSelectedForeground()
public static ColorUIResource getMenuDisabledForeground()
public static ColorUIResource getSeparatorBackground()
public static ColorUIResource getSeparatorForeground()
public static ColorUIResource getAcceleratorForeground()
public static ColorUIResource getAcceleratorSelectedForeground()
Ces informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
8 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)