Package javax.swing.plaf.metal

Examples of javax.swing.plaf.metal.DefaultMetalTheme$FontDelegate


* Runs the test using the specified harness.
*
* @param harness  the test harness (<code>null</code> not permitted).
*/
  public void test(TestHarness harness) {
  MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    FontUIResource f = MetalLookAndFeel.getUserTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.PLAIN, 12));

    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme() {
      public FontUIResource getUserTextFont() {
        return new FontUIResource("Dialog", Font.PLAIN, 99);
      }
    });

    f = MetalLookAndFeel.getUserTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.PLAIN, 99));

    // reset the theme so that other tests won't be affected
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
  }
View Full Code Here


  public void test(TestHarness harness)
  {
    // test with DefaultMetalTheme
    try
      {
        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
        UIManager.setLookAndFeel(new MetalLookAndFeel());
      }
    catch (UnsupportedLookAndFeelException e)
      {
        e.printStackTrace()
View Full Code Here

        JMenuItem metal_theme = new JMenuItem("Metal Default");
        lfMenu.add(metal_theme);
        metal_theme.addActionListener(new SetLFAction("javax.swing.plaf.metal.MetalLookAndFeel") {
            public void actionPerformed(ActionEvent e) {
                MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
                super.actionPerformed(e);
            }
        });

        JMenuItem ocean_theme = new JMenuItem("Metal Ocean");
View Full Code Here

  public void test(TestHarness harness)      
  {
    // test with DefaultMetalTheme
    try
      {
        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
        UIManager.setLookAndFeel(new MetalLookAndFeel());
      }
    catch (UnsupportedLookAndFeelException e)
      {
        e.printStackTrace()
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)
  {
    DefaultMetalTheme t = new DefaultMetalTheme();
    FontUIResource f = t.getControlTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));
    FontUIResource f2 = t.getControlTextFont();
    harness.check(f == f2);
   
    // setting defaults property doesn't affect already created themes...
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    f = t.getControlTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));
    // ...but is picked up by new themes
    DefaultMetalTheme t2 = new DefaultMetalTheme();
    f = t2.getControlTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.PLAIN, 12));
   
    // set it to true
    UIManager.put("swing.boldMetal", Boolean.TRUE);
    DefaultMetalTheme t3 = new DefaultMetalTheme();
    f = t3.getControlTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));

    // clear it again
    UIManager.put("swing.boldMetal", null);
    DefaultMetalTheme t4 = new DefaultMetalTheme();
    f = t4.getControlTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));
   
  }
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)
  {
    DefaultMetalTheme t = new DefaultMetalTheme();
    FontUIResource f = t.getUserTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.PLAIN, 12));
    FontUIResource f2 = t.getUserTextFont();
    harness.check(f == f2);
   
    // setting defaults property doesn't affect this font...
    UIManager.put("swing.boldMetal", Boolean.TRUE);
    f = t.getUserTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.PLAIN, 12));
    // ...but is picked up by new themes
    DefaultMetalTheme t2 = new DefaultMetalTheme();
    f = t2.getUserTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.PLAIN, 12));
   
    // set it to false
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    DefaultMetalTheme t3 = new DefaultMetalTheme();
    f = t3.getUserTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.PLAIN, 12));

    // clear it again
    UIManager.put("swing.boldMetal", null);
    DefaultMetalTheme t4 = new DefaultMetalTheme();
    f = t4.getUserTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.PLAIN, 12));
 
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)
  {
    DefaultMetalTheme t = new DefaultMetalTheme();
    FontUIResource f = t.getWindowTitleFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));
    FontUIResource f2 = t.getWindowTitleFont();
    harness.check(f == f2);
   
    // setting defaults property doesn't affect this font...
    UIManager.put("swing.boldMetal", Boolean.TRUE);
    f = t.getWindowTitleFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));
    // ...but is picked up by new themes
    DefaultMetalTheme t2 = new DefaultMetalTheme();
    f = t2.getWindowTitleFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));
   
    // set it to false
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    DefaultMetalTheme t3 = new DefaultMetalTheme();
    f = t3.getWindowTitleFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));

    // clear it again
    UIManager.put("swing.boldMetal", null);
    DefaultMetalTheme t4 = new DefaultMetalTheme();
    f = t4.getWindowTitleFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));
 
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted)
   */
  public void test(TestHarness harness)
  {
    DefaultMetalTheme t = new DefaultMetalTheme();
    harness.check(t.getName(), "Steel");
  }
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)
  {
    DefaultMetalTheme t = new DefaultMetalTheme();
    FontUIResource f = t.getMenuTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));
    FontUIResource f2 = t.getMenuTextFont();
    harness.check(f == f2);
   
    // setting defaults property doesn't affect already created themes...
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    f = t.getMenuTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));
    // ...but is picked up by new themes
    DefaultMetalTheme t2 = new DefaultMetalTheme();
    f = t2.getMenuTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.PLAIN, 12));
   
    // set it to true
    UIManager.put("swing.boldMetal", Boolean.TRUE);
    DefaultMetalTheme t3 = new DefaultMetalTheme();
    f = t3.getMenuTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));

    // clear it again
    UIManager.put("swing.boldMetal", null);
    DefaultMetalTheme t4 = new DefaultMetalTheme();
    f = t4.getMenuTextFont();
    harness.check(f, new FontUIResource("Dialog", Font.BOLD, 12));
  }
View Full Code Here

  public void constructor1(TestHarness harness)
  {
    harness.checkPoint("()");
   
    // use a known look and feel
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    try
      {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
      }
    catch (UnsupportedLookAndFeelException e)
View Full Code Here

TOP

Related Classes of javax.swing.plaf.metal.DefaultMetalTheme$FontDelegate

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.