Package javax.swing

Examples of javax.swing.UIDefaults


  public boolean isSupportedLookAndFeel() {
    return true;
  }
  public UIDefaults getDefaults()
  {
    UIDefaults def = new UIDefaults();
    def.put("LabelUI", "gnu.testlet.javax.swing.UIManager.TestLabelUI");
    return def;
  }
View Full Code Here


    try
    {
      UIManager.setLookAndFeel(new MetalLookAndFeel());
      // here I'm checking that the same object is returned from subsequent
      // calls - because it seems obvious that the UIDefaults are cached
      UIDefaults d1 = UIManager.getLookAndFeelDefaults();
      UIDefaults d2 = UIManager.getLookAndFeelDefaults();
      harness.check(d1 == d2);
    }
    catch (UnsupportedLookAndFeelException e)
    {
      harness.fail(e.toString());
View Full Code Here

    try
    {
      UIManager.setLookAndFeel(new MetalLookAndFeel());
      // here I'm checking that the same object is returned from subsequent
      // calls - because it seems obvious that the UIDefaults are cached
      UIDefaults d1 = UIManager.getDefaults();
      UIDefaults d2 = UIManager.getDefaults();
      harness.check(d1 == d2);
    }
    catch (UnsupportedLookAndFeelException e)
    {
      harness.fail(e.toString());
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    UIDefaults defaults = new UIDefaults();
    defaults.put("B1", Boolean.FALSE);
    defaults.put("B2", Boolean.TRUE);
    defaults.put("B3", "X");
    harness.check(defaults.getBoolean("B1"), false);
    harness.check(defaults.getBoolean("B2"), true);
    harness.check(defaults.getBoolean("B3"), false);
    harness.check(defaults.getBoolean("B4"), false);
  }
View Full Code Here

import javax.swing.UIDefaults;

public class remove implements Testlet {

    public void test(TestHarness harness) {
        UIDefaults def = new UIDefaults();
        def.put("foo", "bar");
        def.put("foo2", "bar2");
        harness.check(def.get("foo"), "bar", "simple get");
        harness.check(def.get("foo2"), "bar2");
        try {
            def.put("foo", null);
            harness.check(def.get("foo"), (Object) null, "put null equals remove");
        } catch(NullPointerException e) {
            harness.fail("put with null gave NullPointerException");
        }
        harness.checkPoint("rest intact?");
        harness.check(def.get("foo2"), "bar2");
    }
View Full Code Here

* values are beeing put into the Hashtable.
*/
public class putDefaults implements Testlet {

    public void test(TestHarness harness) {
        UIDefaults def = new UIDefaults();

  def.putDefaults(new Object[]{"foo", "bar"});
  harness.check(def.get("foo"), "bar", "simple get");
  def.putDefaults(new Object[]{"foo", null});
        try {
            def.put("foo", null);
      Object val = def.get("foo");
            harness.check(val, (Object) null,
        "putDefaults null equals remove");
        } catch(NullPointerException e) {
            harness.fail("putDefaults with null gave NullPointerException");
        }
View Full Code Here

public class addCustomEntriesToTable implements Testlet
{
  public void test(TestHarness harness)
  {
    UIDefaults defaults = new UIDefaults();
    OceanTheme theme = new OceanTheme();
    theme.addCustomEntriesToTable(defaults);
   
    harness.check(defaults.get("Button.disabledToolBarBorderBackground"),
            new ColorUIResource(204, 204, 204));
    harness.check(defaults.get("Button.gradient"), Arrays.asList(new Object[]
        {new Float(0.3), new Float(0.0), new ColorUIResource(221, 232, 243),
         new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
    harness.check(defaults.get("Button.rollover"), Boolean.TRUE);
    harness.check(defaults.get("Button.rolloverIconType"), "ocean");
    harness.check(defaults.get("Button.toolBarBorderBackground"),
        new ColorUIResource(153, 153, 153));
    harness.check(defaults.get("CheckBox.gradient"), Arrays.asList(new Object[]
        {new Float(0.3), new Float(0.0), new ColorUIResource(221, 232, 243),
         new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
    harness.check(defaults.get("CheckBox.rollover"), Boolean.TRUE); // -> true
    harness.check(defaults.get("CheckBoxMenuItem.gradient"), Arrays.asList(
        new Object[] {new Float(0.3), new Float(0.0),
        new ColorUIResource(221, 232, 243), new ColorUIResource(Color.WHITE),
        new ColorUIResource(184, 207, 229)}));
    //harness.check(defaults.get("FileChooser.homeFolderIcon"), null); // -> javax.swing.plaf.IconUIResource@5210f6d3
    //harness.check(defaults.get("FileChooser.newFolderIcon"), null); // -> javax.swing.plaf.IconUIResource@99b5393
    //harness.check(defaults.get("FileChooser.upFolderIcon"), null); // -> javax.swing.plaf.IconUIResource@732b3d53
    //harness.check(defaults.get("FileView.computerIcon"), null); // -> javax.swing.plaf.IconUIResource@73d6776d
    //harness.check(defaults.get("FileView.directoryIcon"), null); // -> javax.swing.plaf.IconUIResource@65faba46
    //harness.check(defaults.get("FileView.fileIcon"), null); // -> javax.swing.plaf.IconUIResource@77d80e6d
    //harness.check(defaults.get("FileView.floppyDriveIcon"), null); // -> javax.swing.plaf.IconUIResource@7e5a9de6
    //harness.check(defaults.get("FileView.hardDriveIcon"), null); // -> javax.swing.plaf.IconUIResource@6686fe26
    harness.check(defaults.get("InternalFrame.activeTitleGradient"),
        Arrays.asList(new Object[] {new Float(0.3), new Float(0.0),
        new ColorUIResource(221, 232, 243), new ColorUIResource(Color.WHITE),
        new ColorUIResource(184, 207, 229)}));
    //harness.check(defaults.get("InternalFrame.closeIcon"), null); // -> javax.swing.plaf.metal.OceanTheme$IFIcon@2fdb7df8
    //harness.check(defaults.get("InternalFrame.icon"), null); // -> javax.swing.plaf.IconUIResource@69f78ef1
    //harness.check(defaults.get("InternalFrame.iconifyIcon"), null); // -> javax.swing.plaf.metal.OceanTheme$IFIcon@7bc9a690
    //harness.check(defaults.get("InternalFrame.maximizeIcon"), null); // -> javax.swing.plaf.metal.OceanTheme$IFIcon@5f7a8a02
    //harness.check(defaults.get("InternalFrame.minimizeIcon"), null); // -> javax.swing.plaf.metal.OceanTheme$IFIcon@74b2002f
    //harness.check(defaults.get("InternalFrame.paletteCloseIcon"), null); // -> javax.swing.plaf.metal.OceanTheme$IFIcon@432a0f6c
    harness.check(defaults.get("Label.disabledForeground"),
        new ColorUIResource(153, 153, 153));
    LineBorderUIResource border = (LineBorderUIResource) defaults.get(
        "List.focusCellHighlightBorder");
    harness.check(border.getThickness(), 1);
    harness.check(border.getLineColor(), new ColorUIResource(99, 130, 191));
    harness.check(defaults.get("MenuBar.borderColor"),
        new ColorUIResource(204, 204, 204));
    harness.check(defaults.get("MenuBar.gradient"), Arrays.asList(new Object[]
        {new Float(1.0), new Float(0.0), new ColorUIResource(Color.WHITE),
         new ColorUIResource(218, 218, 218),
         new ColorUIResource(218, 218, 218)}));
    harness.check(defaults.get("MenuBarUI"),
        "javax.swing.plaf.metal.MetalMenuBarUI");
    harness.check(defaults.get("Menu.opaque"), Boolean.FALSE);
    //harness.check(defaults.get("OptionPane.errorIcon"), null); // -> javax.swing.plaf.IconUIResource@151a64ed
    //harness.check(defaults.get("OptionPane.informationIcon"), null); // -> javax.swing.plaf.IconUIResource@53ad085
    //harness.check(defaults.get("OptionPane.questionIcon"), null); // -> javax.swing.plaf.IconUIResource@4ba33d48
    //harness.check(defaults.get("OptionPane.warningIcon"), null); // -> javax.swing.plaf.IconUIResource@392d263f
    harness.check(defaults.get("RadioButton.gradient"), Arrays.asList(
        new Object[] {new Float(0.3), new Float(0.0),
        new ColorUIResource(221, 232, 243), new ColorUIResource(Color.WHITE),
        new ColorUIResource(184, 207, 229)}));
    harness.check(defaults.get("RadioButton.rollover"), Boolean.TRUE);
    harness.check(defaults.get("RadioButtonMenuItem.gradient"), Arrays.asList(
        new Object[] {new Float(0.3), new Float(0.0),
        new ColorUIResource(221, 232, 243), new ColorUIResource(Color.WHITE),
        new ColorUIResource(184, 207, 229)}));
    harness.check(defaults.get("ScrollBar.gradient"), Arrays.asList(
        new Object[] {new Float(0.3), new Float(0.0),
        new ColorUIResource(221, 232, 243), new ColorUIResource(Color.WHITE),
        new ColorUIResource(184, 207, 229)}));
    harness.check(defaults.get("Slider.altTrackColor"),
        new ColorUIResource(210, 226, 239));
    harness.check(defaults.get("Slider.focusGradient"), Arrays.asList(
        new Object[] {new Float(0.3), new Float(0.2),
        new ColorUIResource(200, 221, 242), new ColorUIResource(Color.WHITE),
        new ColorUIResource(184, 207, 229)}));
    harness.check(defaults.get("Slider.gradient"), Arrays.asList(new Object[]
        {new Float(0.3), new Float(0.2), new ColorUIResource(200, 221, 242),
         new ColorUIResource(Color.WHITE),
         new ColorUIResource(184, 207, 229)}));
    harness.check(defaults.get("SplitPane.dividerFocusColor"),
        new ColorUIResource(200, 221, 242));
    harness.check(defaults.get("SplitPane.oneTouchButtonsOpaque"),
        Boolean.FALSE);
    harness.check(defaults.get("TabbedPane.borderHightlightColor"),
        new ColorUIResource(99, 130, 191));
    harness.check(defaults.get("TabbedPane.contentAreaColor"),
        new ColorUIResource(200, 221, 242));
    harness.check(defaults.get("TabbedPane.contentBorderInsets"),
        new Insets(4, 2, 3, 3));
    harness.check(defaults.get("TabbedPane.tabAreaBackground"),
        new ColorUIResource(218, 218, 218));
    harness.check(defaults.get("TabbedPane.tabAreaInsets"),
        new Insets(2, 2, 0, 6));
    harness.check(defaults.get("TabbedPane.selected"),
        new ColorUIResource(200, 221, 242));
    harness.check(defaults.get("TabbedPane.unselectedBackground"),
        new ColorUIResource(238, 238, 238));
    harness.check(defaults.get("Table.focusCellHighlightBorder")
        instanceof LineBorderUIResource);
    harness.check(defaults.get("Table.gridColor"),
        new ColorUIResource(122, 138, 153));
    harness.check(defaults.get("ToggleButton.gradient"),
        Arrays.asList(new Object[] {new Float(0.3), new Float(0.0),
        new ColorUIResource(221, 232, 243), new ColorUIResource(Color.WHITE),
        new ColorUIResource(184, 207, 229)}));
    harness.check(defaults.get("ToolBar.borderColor"),
        new ColorUIResource(204, 204, 204));
    harness.check(defaults.get("ToolBar.isRollover"), Boolean.TRUE);
    //harness.check(defaults.get("Tree.expandedIcon"), null); // -> javax.swing.plaf.IconUIResource@2911a3a4
    //harness.check(defaults.get("Tree.leafIcon"), null); // -> javax.swing.plaf.IconUIResource@5ca352a5
    //harness.check(defaults.get("Tree.closedIcon"), null); // -> javax.swing.plaf.IconUIResource@584fce71
    //harness.check(defaults.get("Tree.collapsedIcon"), null); // -> javax.swing.plaf.metal.OceanTheme$COIcon@56406199
    //harness.check(defaults.get("Tree.openIcon"), null); // -> javax.swing.plaf.IconUIResource@57bcc0bc
    harness.check(defaults.get("Tree.selectionBorderColor"),
        new ColorUIResource(99, 130, 191));
  }
View Full Code Here

    this.instance = instance;
    this.loader = instance.getClass().getClassLoader();
  }
  @Override
  public UIDefaults getDefaults() {
    UIDefaults defaults = instance.getDefaults();
    defaults.put("ClassLoader", loader);
    return defaults;
  }
View Full Code Here

   */
  private static synchronized void maybeInitialize() {
    if (currentAddon != null) {
      // this is to ensure "UIManager#maybeInitialize" gets called and the
      // LAFState initialized
      UIDefaults defaults = UIManager.getLookAndFeelDefaults();
//      if (!UIManager.getBoolean(APPCONTEXT_INITIALIZED)) {
      // JW: trying to fix #784-swingx: frequent NPE in getUI
      // moved the "marker" property into the LookAndFeelDefaults
      if (!defaults.getBoolean(APPCONTEXT_INITIALIZED)) {
        setAddon(currentAddon);
      }
    }
  }
View Full Code Here

        return Boolean.TRUE.equals(docProperty);
    }

    private UIDefaults getUIDefaults() {
        if (uiDefaults == null) {
            uiDefaults = new UIDefaults();
        }

        return uiDefaults;
    }
View Full Code Here

TOP

Related Classes of javax.swing.UIDefaults

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.