当你有一个摆动JComboBox并点击它的边框时,弹出窗口会立即显示并消失.当我说点击时,我的意思是按下鼠标左键并立即释放.
它可能被认为是糟糕的用户体验,因为没有用户会期望它发生.单击组合框的边框时,任何用户都会期望以下行为之一:
当然没有用户会期望弹出窗口立即打开和关闭.
用户不会故意点击边框.但是当组合框很小并且他试图快速点击它时,它可能经常发生.
在2000年,有人将此行为注册为openjdk网站中的错误:https://bugs.openjdk.java.net/browse/JDK-4346918
他们已经认识到它是一个错误,但是通过以下观察结果解决了它:"无法修复":
我已经能够重现这个问题,但它并不重要,所以我不打算解决它.问题是,单击边框后释放鼠标时,组合框的下拉部分将隐藏.这个bug没有很大的影响.
我同意他们的看法,它没有产生很大的影响.但我仍然认为这会导致糟糕的用户体验,我想知道是否有一个简单的解决方法是让用户点击其边框时弹出窗口要么保持打开状态,要么根本不打开.
通过单击任何JComboBox边框上的鼠标左键可以重现所描述的行为.请参阅下面一个可以复制的简单代码:
import java.awt.FlowLayout;
import javax.swing.*;
public class JComboBoxUX{
public static void main(String[] args){
SwingUtilities.invokeLater(new Runnable(){
@Override
public void run(){
JComboBox<String> combobox = new JComboBox<String>(
new String[]{"aaaaaaaaaa","bbbbbbbb","ccccccccc"});
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10));
panel.add(combobox);
JFrame frame = new JFrame("JComboBox UX");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(panel);
frame.setSize(300, 150);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
}
Run Code Online (Sandbox Code Playgroud) Microsoft Visual C++ 2010 Redistributable Package (vcredist 2010)我使用了需要安装的旧 Windows 版本 PostgreSQL 的二进制文件的 zip 存档。
I would like to know if the Windows binaries of the newer version of PostgreSQL still need the vcredist 2010. I didn't find anything about this in the download pages of the binaries (https://www.postgresql.org/download/windows/
and https://www.enterprisedb.com/download-postgresql-binaries).
Note: I prefer to use the binaries instead of the standard installer to include PostgreSQL as part of my application installer.
我想要一些继承父元素的颜色和文本大小的图标。我还希望它能够轻松地在代码的不同部分中重用。
我尝试在SVG路径中使用fill="currentColor",但图标的颜色没有变得与文本颜色相同。图标始终变黑。(jsfiddle)
.my-icon-inherit-font-size-and-color {
content: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16"> <path d="M2 15.5a.5.5 0 0 0 .74.439L8 13.069l5.26 2.87A.5.5 0 0 0 14 15.5V2a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v13.5zM8 4.41c1.387-1.425 4.854 1.07 0 4.277C3.146 5.48 6.613 2.986 8 4.412z"/></svg>');
height: 0.7em;
}Run Code Online (Sandbox Code Playgroud)
<p>
<a href="#" style="font-size: 28px; color: blue">
<i class="my-icon-inherit-font-size-and-color"></i> Some text
</a>
</p>
<p>
<a href="#" style="font-size: 38px; color: red">
<i class="my-icon-inherit-font-size-and-color"></i> Some text
</a>
</p>Run Code Online (Sandbox Code Playgroud)
结果: …
尝试访问端点http://localhost:8080/categoryOfPermissions时收到错误“无法写入 JSON:无限递归”。我在这里研究并找到了各种解决方案(、、),但似乎都不起作用。最后,我找到了一个答案,指出有必要从“设置”更改为“列表”,才能使解决方案发挥作用。我测试了它,从“设置”更改为“列表”后,它确实开始工作。@JsonManagedReference / @JsonBackReference@JsonIgnore@JsonIdentityInfo@JsonIdentityInfo
我觉得这很奇怪,但我发现了更奇怪的事情:从 Set 更改为 List 后,我删除了注释@JsonIdentityInfo,一切都继续工作。换句话说,我真正需要做的就是从 Set 更改为 List 以消除异常。没有其他的。不需要任何解决方案:@JsonManagedReference / @JsonBackReference,,@JsonIgnore。@JsonIdentityInfo
下面是产生异常的代码。我所要做的就是更改private Set<Permission> permission为private List<Permission> permission.
我想知道为什么,特别是因为我更喜欢使用 Set,以避免 Hibernate 使用“Bags”范例(这可能会导致一些不良行为)。
权限.java:
@Entity
@Data
public class Permission{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@NotBlank
private String name;
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "category_of_permission_id")
private CategoryOfPermission categoryOfPermission;
}
Run Code Online (Sandbox Code Playgroud)
CategoryOfPermission.java :
@Entity …Run Code Online (Sandbox Code Playgroud) 这有效:
String query = "select DATE '2016-03-16' + interval '7 days'";
Run Code Online (Sandbox Code Playgroud)
但我想在准备好的语句中使用 '2016-03-16' 和 7 作为参数。怎么做?
我试过这样,但没有奏效:
String query = "select DATE ? + interval ?";
Object param[] = {"2016-03-16", "7 days"};
Run Code Online (Sandbox Code Playgroud) 我正在使用 Let's Encrypt 在我的服务器中安装免费的 TLS/SSL 证书。我按照Mozilla SSL 配置生成器的建议并像这样配置了 nginx:
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
Run Code Online (Sandbox Code Playgroud)
问题是我需要 Java 7 才能与服务器通信,但它不适用于上述配置。
当我将我的网站提交给ssllabs 时,我收到以下消息:
Java 7u25 Server sent fatal alert: handshake_failure
Run Code Online (Sandbox Code Playgroud)
如果我只是在 nginx 配置中评论 ssl_ciphers 行,那么与 Java 7 的通信就会开始工作。
# After commenting the line below it works
# ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
Run Code Online (Sandbox Code Playgroud)
所以我从ssllabs收到以下消息:
Java 7u25 RSA 2048 (SHA256) TLS 1.0 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
Run Code Online (Sandbox Code Playgroud)
我不想让 ssl_ciphers 行注释,因为 nginx 将使用其默认配置,这不太安全。
我只想将密码 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 添加到 ssl_ciphers 列表中。
是否可以?怎么做?
我在下面创建了MCVE。ugly.char该服务应该收到一条消息并用来自的预定义替换元音application.properties。
应用程序属性:
ugly.char=x
Run Code Online (Sandbox Code Playgroud)
UglifyService.java:
public interface UglifyService {
String uglifyMessage(String message);
}
Run Code Online (Sandbox Code Playgroud)
UglifyServiceImpl.java:
@Service
public class UglifyServiceImpl implements UglifyService {
@Value("${ugly.char}")
private char uglyCharFromAppProp;
private final char uglyChar;
@Autowired
public UglifyServiceImpl() {
this.uglyChar = uglyCharFromAppProp;
}
@Override
public String uglifyMessage(String message) {
return message.replaceAll("[aeiouAEIOU]", String.valueOf(uglyChar));
}
}
Run Code Online (Sandbox Code Playgroud)
UglyCharController.java:
@Controller
public class UglyCharController {
private final UglifyService uglifyService;
@Autowired
public UglyCharController(UglifyService uglifyService) {
this.uglifyService = uglifyService;
}
@Value("${ugly.char}")
private char uglyChar;
@RequestMapping("/")
@ResponseBody
public String …Run Code Online (Sandbox Code Playgroud) java ×3
postgresql ×3
spring ×2
css ×1
date ×1
encryption ×1
jackson ×1
jcombobox ×1
lets-encrypt ×1
multi-tenant ×1
nginx ×1
performance ×1
schema ×1
spring-boot ×1
spring-mvc ×1
sql ×1
ssl ×1
svg ×1
swing ×1