小编Ori*_*n31的帖子

JPasswordField的值和字符串不相等,但它们看起来相同

我知道人们以前曾问过这个问题,但是他们没有使用.equals()。所以我要再问一遍,为什么我有两个字符串,但是当我将它们与之比较时,.equals()我得到了错误。这两个字符串是1234(passwordField2.getPassword()String s = bufferedreader.readLine()。),我已经使用s.toCharArray对其进行了比较,这是相同的。我尝试将它们都打印出来 1234 1234

有人知道为什么会这样吗?谢谢!

java string jpasswordfield

2
推荐指数
1
解决办法
261
查看次数

CSS:在悬停时显示文本

当我遇到即使谷歌无法解决的问题(不是一个好兆头)时,我只是为了好玩而制作随机HTML的东西.当我在不同的地方盘旋时,我试图让文本框出现.我在google上看到了很多这样做的东西,但暗示你没有其他代码用于你正在盘旋的对象,这意味着它唯一会做的就是让文本出现,所以动画(尽管这不起作用)或者,我在标题上有动画,它将会悬停在上面.这是我的代码:

在我的代码中:我想将鼠标悬停在h1块上并使h3块出现.
HTML:

<!DOCTYPE html>
<html>

<head>
<link rel="stylesheet" href="style.css">
</head>

<body style="font-family:'Myriad Pro' ">
<div class="title">
    <h1 class="title">Random Thing</h1>
    <h3 class="ps">Playing around in HTML!</h3>
</div>
</body>

</html>
Run Code Online (Sandbox Code Playgroud)

CSS:

 h1.title{
    font-size: 100px;
  background: url(https://upload.wikimedia.org/wikipedia/commons/f/f3/Orion_Nebula_-_Hubble_2006_mosaic_18000.jpg);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: 5.6s ease, 3s transform;
}
h1.title:hover{
    background-position: left;
    transform: translateX(150px)
    <!-- Where the .ps would appear -->
}
.ps{
visibility: hidden;
}
Run Code Online (Sandbox Code Playgroud)

就个人而言,我认为其他人会有这个问题.

感谢您的时间,Orion31

html css transition

1
推荐指数
1
解决办法
2687
查看次数

GeoCoordinateWatcher 只能偶尔工作一次

以下代码尝试获取正在运行代码的计算机的位置:

GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
if (watcher.TryStart(false, TimeSpan.FromMilliseconds(3000)))
{
    GeoCoordinate coord = watcher.Position.Location;
    if (!coord.IsUnknown)
    {
        Printer.Print(String.Format("Current Lat: {0}, Current Long: {1}", coord.Latitude, coord.Longitude));
    }
    else // Path taken most often
    {
        throw new CommandException("Weather data unknown. (Are location services enabled?)"); 
    }
}
else
{
    throw new CommandException("Weather data unknown. (Are location services enabled?)");
}
Run Code Online (Sandbox Code Playgroud)

每隔一段时间,就会打印正确的位置,但大多数时候,会运行注释的 else 语句。经过多次测试,我意识到它是否有效完全是随机的。我这样做错了吗?

c# wpf location

1
推荐指数
1
解决办法
853
查看次数

CSS反转过渡顺序

我不知道以前是否曾经问过这个问题,但无论我在哪里,答案都没有用.我要做的是移开文本,然后抬起一个灰色的盒子,当我将鼠标从灰色框移开时,灰色框首先向下,然后文本向后移动.使用我的代码,文本首先移回,这看起来不太好.有什么方法可以在恢复正常时撤消转换顺序?这是我的CSS:

.doge{
    font-size: 50px;
    font-family: "Comic Sans MS";
    text-align: center;
    background-image: linear-gradient(#c6a65f 70%,#cbc595 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-position: left;
    transition: 1.6s;


}
.dogediv{
    width: 537px;
    height: 529px;
    background-image: url("https://pbs.twimg.com/profile_images/378800000822867536/3f5a00acf72df93528b6bb7cd0a4fd0c.jpeg");
    background-position: right;
    position: relative;
}
.div2 {
    background-color: gray;
    height: 100%;
    transition: 5s;
    transition-delay: 1s;
}
.div2:hover > .doge{
    transform: translateX(550px);
}
.div2:hover {
    height: 10px; 
}
Run Code Online (Sandbox Code Playgroud)

HTML:

<!DOCTYPE html>
<html>

<head>
    <title>Home of the Doge</title>
    <link rel="stylesheet" href="styles.css">
</head>

<body>
    <div class="dogediv">
        <div class="div2" style="background-color: gray">
            <h1 class="doge">Welcome to …
Run Code Online (Sandbox Code Playgroud)

html css transition css3

0
推荐指数
1
解决办法
122
查看次数

UWP KeyRoutedEventArgs.handled 不会取消退格键

有没有办法用KeyDownEventUWP 中的a 取消退格键?此事件使用KeyRoutedEventArgs,因此没有SuppressKeyPress功能。

event.Handled = true没有帮助;它只会阻止从同一按键快速连续多次调用该事件。

有这样的功能吗?

c# events event-handling uwp

0
推荐指数
1
解决办法
362
查看次数

Unity - 在一行中获取组件并检查空值?

有没有办法简化以下代码块?

MyComponent myComponent = gameObject.GetComponent<MyComponent>();
if (myComponent != null)
{
    // do something
}
Run Code Online (Sandbox Code Playgroud)

就像是

if (var myComponent = gameObject.GetComponent<MyComponent>() != null) {
    // do something
}
Run Code Online (Sandbox Code Playgroud)

我这样做的动机是因为我正在对鼠标按下进行光线投射,并且我希望用户单击的对象类型影响发生的事情。例如,我会做类似的事情

ComponentOne componentOne = gameObject.GetComponent<ComponentOne>();
if (componentOne != null)
{
    // do something
    return;
}

ComponentTwo componentTwo = gameObject.GetComponent<ComponentTwo>();
if (componentTwo != null)
{
    // do something
    return;
}

ComponentThree componentThree = gameObject.GetComponent<ComponentThree >();
if (componentThree != null)
{
    // do something
    return;
}
Run Code Online (Sandbox Code Playgroud)

然而,这很混乱,而且不必要地冗长。

c# unity-game-engine

0
推荐指数
1
解决办法
75
查看次数