nimbusdefaults.java

来自「Mobile 应用程序使用 Java Micro Edition (Java M」· Java 代码 · 共 496 行 · 第 1/5 页

JAVA
496
字号
        register(Region.TEXT_FIELD, "TextField");        register(Region.FORMATTED_TEXT_FIELD, "FormattedTextField");        register(Region.PASSWORD_FIELD, "PasswordField");        register(Region.TEXT_AREA, "TextArea");        register(Region.TEXT_PANE, "TextPane");        register(Region.EDITOR_PANE, "EditorPane");        register(Region.TOOL_BAR, "ToolBar");        register(Region.BUTTON, "ToolBar:Button");        register(Region.TOGGLE_BUTTON, "ToolBar:ToggleButton");        register(Region.TOOL_BAR_SEPARATOR, "ToolBarSeparator");        register(Region.TOOL_TIP, "ToolTip");        register(Region.TREE, "Tree");        register(Region.TREE_CELL, "Tree:TreeCell");        register(Region.LABEL, "Tree:\"Tree.cellRenderer\"");        register(Region.ROOT_PANE, "RootPane");
    }

    //--------------- Methods called by NimbusLookAndFeel

    /**
     * Called from NimbusLookAndFeel to initialize the UIDefaults.
     *
     * @param d UIDefaults table to initialize. This will never be null.
     *          If listeners are attached to <code>d</code>, then you will
     *          only receive notification of LookAndFeel level defaults, not
     *          all defaults on the UIManager.
     */
    void initializeDefaults(UIDefaults d) {
        //Color palette        d.put("text",new ColorUIResource(new Color(0, 0, 0, 255)));        d.put("control",new ColorUIResource(new Color(214, 217, 223, 255)));        d.put("nimbusBase",new ColorUIResource(new Color(51, 98, 140, 255)));        d.put("nimbusBlueGrey",getDerivedColor("nimbusBase",0.032459438f,-0.52518797f,0.19607842f,0));        d.put("nimbusOrange",new ColorUIResource(new Color(191, 98, 4, 255)));        d.put("nimbusGreen",new ColorUIResource(new Color(176, 179, 50, 255)));        d.put("nimbusRed",new ColorUIResource(new Color(169, 46, 34, 255)));        d.put("nimbusBorder",getDerivedColor("nimbusBlueGrey",0.0f,-0.017358616f,-0.11372548f,0));        d.put("nimbusSelection",getDerivedColor("nimbusBase",-0.010750473f,-0.04875779f,-0.007843137f,0));        d.put("nimbusInfoBlue",new ColorUIResource(new Color(47, 92, 180, 255)));        d.put("nimbusAlertYellow",new ColorUIResource(new Color(255, 220, 35, 255)));        d.put("nimbusFocus",new ColorUIResource(new Color(115, 164, 209, 255)));        d.put("nimbusSelectedText",new ColorUIResource(new Color(255, 255, 255, 255)));        d.put("nimbusSelectionBackground",new ColorUIResource(new Color(57, 105, 138, 255)));        d.put("nimbusDisabledText",new ColorUIResource(new Color(142, 143, 145, 255)));        d.put("nimbusLightBackground",new ColorUIResource(new Color(255, 255, 255, 255)));        d.put("infoText",getDerivedColor("text",0.0f,0.0f,0.0f,0));        d.put("info",new ColorUIResource(new Color(242, 242, 189, 255)));        d.put("menuText",getDerivedColor("text",0.0f,0.0f,0.0f,0));        d.put("menu",getDerivedColor("nimbusBase",0.021348298f,-0.6150531f,0.39999998f,0));        d.put("scrollbar",getDerivedColor("nimbusBlueGrey",-0.006944418f,-0.07296763f,0.09019607f,0));        d.put("controlText",getDerivedColor("text",0.0f,0.0f,0.0f,0));        d.put("controlHighlight",getDerivedColor("nimbusBlueGrey",0.0f,-0.07333623f,0.20392156f,0));        d.put("controlLHighlight",getDerivedColor("nimbusBlueGrey",0.0f,-0.098526314f,0.2352941f,0));        d.put("controlShadow",getDerivedColor("nimbusBlueGrey",-0.0027777553f,-0.0212406f,0.13333333f,0));        d.put("controlDkShadow",getDerivedColor("nimbusBlueGrey",-0.0027777553f,-0.0018306673f,-0.02352941f,0));        d.put("textHighlight",getDerivedColor("nimbusSelectionBackground",0.0f,0.0f,0.0f,0));        d.put("textHighlightText",getDerivedColor("nimbusSelectedText",0.0f,0.0f,0.0f,0));        d.put("textInactiveText",getDerivedColor("nimbusDisabledText",0.0f,0.0f,0.0f,0));        d.put("desktop",getDerivedColor("nimbusBase",-0.009207249f,-0.13984653f,-0.07450983f,0));        d.put("activeCaption",getDerivedColor("nimbusBlueGrey",0.0f,-0.049920253f,0.031372547f,0));        d.put("inactiveCaption",getDerivedColor("nimbusBlueGrey",-0.00505054f,-0.055526316f,0.039215684f,0));        //Font palette        d.put("defaultFont", new FontUIResource(defaultFont));        d.put("InternalFrame.titleFont", new DerivedFont("defaultFont", 1.0f, true, null));        //Border palette        //The global style definition        d.put("textForeground", getDerivedColor("text",0.0f,0.0f,0.0f,0));        d.put("textBackground", getDerivedColor("nimbusSelectionBackground",0.0f,0.0f,0.0f,0));        d.put("background", getDerivedColor("control",0.0f,0.0f,0.0f,0));        d.put("TitledBorder.position", "ABOVE_TOP");        d.put("FileView.fullRowSelection", Boolean.TRUE);        //Initialize ArrowButton        d.put("ArrowButton.contentMargins", new InsetsUIResource(0, 0, 0, 0));        d.put("ArrowButton.size", new Integer(16));        d.put("ArrowButton[Disabled].foregroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ArrowButtonPainter", ArrowButtonPainter.FOREGROUND_DISABLED, new Insets(0, 0, 0, 0), new Dimension(10, 10), false, AbstractRegionPainter.PaintContext.CacheMode.FIXED_SIZES, 1.0, 1.0));        d.put("ArrowButton[Enabled].foregroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ArrowButtonPainter", ArrowButtonPainter.FOREGROUND_ENABLED, new Insets(0, 0, 0, 0), new Dimension(10, 10), false, AbstractRegionPainter.PaintContext.CacheMode.FIXED_SIZES, 1.0, 1.0));        //Initialize Button        d.put("Button.contentMargins", new InsetsUIResource(6, 14, 6, 14));        d.put("Button.defaultButtonFollowsFocus", Boolean.FALSE);        d.put("Button[Default].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_DEFAULT, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[Default+Focused].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_DEFAULT_FOCUSED, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[Default+MouseOver].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_MOUSEOVER_DEFAULT, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[Default+Focused+MouseOver].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_MOUSEOVER_DEFAULT_FOCUSED, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[Default+Pressed].textForeground", getDerivedColor("nimbusSelectedText",0.0f,0.0f,0.0f,0));        d.put("Button[Default+Pressed].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_PRESSED_DEFAULT, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[Default+Focused+Pressed].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_PRESSED_DEFAULT_FOCUSED, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[Disabled].textForeground", getDerivedColor("nimbusDisabledText",0.0f,0.0f,0.0f,0));        d.put("Button[Disabled].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_DISABLED, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[Enabled].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_ENABLED, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[Focused].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_FOCUSED, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[MouseOver].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_MOUSEOVER, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[Focused+MouseOver].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_MOUSEOVER_FOCUSED, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[Pressed].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_PRESSED, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));        d.put("Button[Focused+Pressed].backgroundPainter", new LazyPainter("com.sun.java.swing.plaf.nimbus.ButtonPainter", ButtonPainter.BACKGROUND_PRESSED_FOCUSED, new Insets(7, 7, 7, 7), new Dimension(104, 33), false, AbstractRegionPainter.PaintContext.CacheMode.NINE_SQUARE_SCALE, Double.POSITIVE_INFINITY, 2.0));

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?