Java JTabbedPane插入颜色 [英] Java JTabbedPane Inset Color

查看:318
本文介绍了Java JTabbedPane插入颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道你将如何得到一个JTabbedPane插入的颜色。我似乎不能得到这种颜色。每次尝试我得到236,236,236这是外框架颜色,其中内框架颜色约10更暗,227,227,227(使用内置的苹果色表)。



我使用UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())设置外观和感觉;



您可以在我在互联网上找到的图片中看到这个。 查找颜色。


I was wondering how you would get the color of the inset of a JTabbedPane. I cannot seem to get this color. Every attempt I make I get 236,236,236 which is the outside frame color, where the inside frame color is about 10 darker, 227,227,227 (using the built in apple color meter).

I am setting the look and feel using UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

You can see this in an image that I found on the internet. http://pagesofinterest.net/wordpress/wp-content/uploads/2009/06/Quaqua-Maven-Netbeans.jpg Where the words "Panel's Title" is the area that I am getting the lighter color that is not useful to me. Inside the round corners is the darker color I am trying to obtain. I tried getting the color of the content pane to no avail.

Thanks for all your help!

**EDIT:**Added code! As you see, I am trying to get the color of the area inside the rounded corners(if your on a mac) not the color of the frame or the tabs that say "1" "2". I have attached a photo and I am trying to get the background color of the portion that says "Here" Thanks!

import java.awt.Container;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;

public class main {
JFrame frame;
Container c1 = new Container();
Container c2 = new Container();
JTabbedPane top = new JTabbedPane();
static main GUI;
public void createGUI(){
    frame = new JFrame();
    Container c = frame.getContentPane();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    top = new JTabbedPane(JTabbedPane.TOP);
    top.setFocusTraversalKeysEnabled(false);
    top.setFocusable(false);
    top.addTab("1", c1);
    top.addTab("2", c2);
    frame.setSize(315,450);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setResizable(true);
    c.add(top);
    frame.pack();
    frame.setVisible(true);
} 
public static void main(String[] args) {
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch(Exception e) {}
    GUI = new main();
    GUI.createGUI();
}
}

EDIT: camickr, Here is a screenshot of the UIManager Defaults. Unfortunately none of there colors in the are the correct color that the inset is.

解决方案

You might be able to use UIMangaer Defaults to find the color.

这篇关于Java JTabbedPane插入颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆