简体   繁体   English

GWT按钮蓝色边框行为

[英]GWT push button blue border behaviour

Does anybody can tell me where that blue border that appears after you push a PushButton comes from? 有人能告诉我按下按钮后出现的蓝色边框是从哪里来的吗?

I really want to override that behaviour, don't know where or how though 我真的很想超越这种行为,不知道在哪里或如何

UPDATE: 更新:

the effect I'm talking about turns out to be blue on Safari, it goes orange on Chrome and no effect on Mozilla 我说的效果在Safari上显示为蓝色,在Chrome上显示为橙色,对Mozilla没有影响

it occurs when the button has been pressed once, best way to explain it is the http://gwt.google.com/samples/Showcase/Showcase.html#!CwCustomButton 一次按下按钮就会发生这种情况,最好的解释方法是http://gwt.google.com/samples/Showcase/Showcase.html#!CwCustomButton

This behavior should be defined in the appropriate stylesheet. 此行为应在适当的样式表中定义。 If you check GWT sources that would be in /trunk/user/src/com/google/gwt/user/theme/standard/public/gwt/standard/standard.css. 如果您检查GWT来源,则该来源位于/trunk/user/src/com/google/gwt/user/theme/standard/public/gwt/standard/standard.css中。 It's also defined in other themes. 其他主题中也定义了它。

What you should do is define your own styles 您应该做的就是定义自己的样式

.my-PushButton
{
    border                      :   1px solid #666;
    padding                     :   0 10px;
}
.my-PushButton-down-hovering
{
    background-color            :   #aaf;
}
.my-PushButton-up-hovering
{
    background-color            :   #afa;
}

And then 接着

PushButton btn = new PushButton(...);
widget.setStylePrimaryName("my-PushButton");

Hope this helps. 希望这可以帮助。

Are you talking about the "focus ring" that appear around any element when it's focused? 您是否在谈论在聚焦时出现在任何元素周围的“聚焦环”?

You can tweak it using the outline set of CSS properties: http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines But please note that it's bad practice (re. accessibility) to completely remove it, as you'd remove any indication of whether the button is focused or not, and incidentally, which element is focused, if any. 您可以使用CSS属性的outline设置对其进行调整: http : //www.w3.org/TR/CSS21/ui.html#dynamic-outlines但是请注意,完全删除它是一种不好的做法(可访问性),因为您将删除任何有关按钮是否已聚焦的指示,以及除去哪个元素已聚焦(如果有)的任何指示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM