⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startitcolors.java

📁 SRI international 发布的OAA框架软件
💻 JAVA
字号:
/**
 * The contents of this file are subject to the OAA  Community Research
 * License Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License
 * at http://www.ai.sri.com/~oaa/.  Software distributed under the License
 * is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * rights and limitations under the License.  Portions of the software are
 * Copyright (c) SRI International, 1999-2003.  All rights reserved.
 * "OAA" is a registered trademark, and "Open Agent Architecture" is a
 * trademark, of SRI International, a California nonprofit public benefit
 * corporation.
*/

package com.sri.oaa2.agt.startit;

import javax.swing.*;
import javax.swing.plaf.*;
import javax.swing.plaf.metal.*;
import java.awt.*;

// http://java.sun.com/docs/books/tutorial/uiswing/misc/plaf.html

public class StartitColors {
  static public Color gray0 = new Color(0x9b, 0x9b, 0x9b);
  static public Color gray1 = new Color(0xa7, 0xa7, 0xa7);
  static public Color gray2 = new Color(0xb2, 0xb2, 0xb2);
  static public Color gray3 = new Color(0xbf, 0xbf, 0xbf);

  static public void initialize(JFrame frame) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme() {
	// scrollbar and menu outline
	private final ColorUIResource primary1 = new ColorUIResource(new Color(0,0,40));

	// focus-rectangle and scrollbar bg
	private final ColorUIResource primary2 = new ColorUIResource(new Color(0,0xa0,0xc0));

	// part of scrollbar bg
	private final ColorUIResource primary3 = new ColorUIResource(new Color(0,0xf0,0xf0));

	// lots of outlines: combobox,checkbox,scrollbar space
	private final ColorUIResource secondary1 = new ColorUIResource(new Color(40,40,40));

	// combobox pressed arrow,little outline: jmenu underline, scrollbar space
	// all ghosted stuff
	private final ColorUIResource secondary2 = new ColorUIResource(new Color(40,120,120));

	// default bg
	private final ColorUIResource secondary3 = new ColorUIResource(gray1);
    
	protected ColorUIResource getPrimary1() { return primary1; }
	protected ColorUIResource getPrimary2() { return primary2; }
	protected ColorUIResource getPrimary3() { return primary3; }
	protected ColorUIResource getSecondary1() { return secondary1; }
	protected ColorUIResource getSecondary2() { return secondary2; }
	protected ColorUIResource getSecondary3() { return secondary3; }
	// light highlight for checkbox indent (default too bright for this bg)
	public ColorUIResource getControlHighlight() {
	  return new ColorUIResource(new Color(230,230,230)); }
      });

    try {
      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } 
    catch (Exception e) { System.out.println(e); }

    SwingUtilities.updateComponentTreeUI(frame);

  }
}

⌨️ 快捷键说明

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