我有一个带可关闭标签的TabPane.我想在用户单击选项卡内容中的按钮时触发"关闭选项卡事件".以下是用户单击按钮时调用的方法:
public class CustomTab extends Tab {
...
protected void close() {
Event.fireEvent(this, new Event(Tab.CLOSED_EVENT));
}
....
}
Run Code Online (Sandbox Code Playgroud)
我将此自定义标签添加到tabpane中:
TabPane tabPane = new TabPane();
...
CustomTab tab = new CustomTab();
tab.setOnClosed(new EventHandler<Event>() {
@Override
public void handle(Event t) {
System.out.println("Closed!");
}
});
tabPane.getTabs().add(tab);
tabPane.getSelectionModel().select(tab);
Run Code Online (Sandbox Code Playgroud)
通常,可以通过单击选项卡标题中的(默认)关闭图标来关闭选项卡,然后"关闭!" 被打印到屏幕上.但是,当用户单击按钮(即在选项卡的内容中)并再次调用close()方法CustomTab时,"已关闭!" 打印到屏幕上,但此时标签未关闭.这不奇怪吗?
如何在单击任意按钮时关闭选项卡?
PS:tabPane.getTabs().remove(tab)有效,但触发相应的事件非常优雅.它也应该关闭标签.
我有一个ListCell,其中我显示了ProgressIndicator下载文件的进度信息.
我的问题是删除指标下方显示的百分比信息.如前所述这里,我包括在我的CSS规则如下:
.customProgressIndicator .percentage{
visibility: hidden;
-fx-text-background-color: red;
}
Run Code Online (Sandbox Code Playgroud)
该-fx-text-background-color: red部分只是为了确保我们的css应用于节点.
问题是,我打电话indicator.setProgress(progress),百分比变得可见(红色),当我将光标悬停在指标上时,它再次变得不可见.最后,在完成调用indicator.setProgress(1.0)后,"完成"文本在底部变得可见,并在悬停后再次变为不可见.
它可能与ListView因为有关; 在悬停并使其变为不可见之后,如果我从中移除一个项目List并导致其updateItem开启ListCell,它将再次可见.
我尝试过一种解决方法:
Text text = (Text)indicator.lookup(".percentage");
if ( text != null )
{
text.setText("");
}
Run Code Online (Sandbox Code Playgroud)
但有时候text是空的,有时候不是.
我正在尝试SSLServerSocket使用自定义密钥库/信任库打开并且仅TLSv1.2启用.这是我打开这样的套接字的相关代码:
SSLContext sslContext = null;
ServerSocket serverSocket = null;
KeyManagerFactory kmf = null;
KeyStore keystore = loadKeyStore(KEYSTORE_FILE);
if (keystore == null) {
// throw exception
}
char[] psw = System.console().readPassword("Enter password for the key materials in file \"%s\":", KEYSTORE_FILE);
try {
kmf = KeyManagerFactory.getInstance("PKIX");
kmf.init(keystore, psw);
} catch (NoSuchAlgorithmException | UnrecoverableKeyException | KeyStoreException e) {
e.printStackTrace();
kmf = null;
// throw exception
}
try {
sslContext = SSLContext.getInstance("TLSv1.2");
System.out.println(kmf==null); // prints false
sslContext.init(kmf==null?null:kmf.getKeyManagers(), null, null);
} …Run Code Online (Sandbox Code Playgroud) 我在包装器代码中编码/解码音频有一些问题,我调试了我的代码,最后发现SetByteArrayRegion它没有按预期工作.开始了:
// incoming parameters => jbyteArray jencoded
jbyte encoded[320]; //
... // fill encoded with 'encodedSize' number of bytes
int i;
for (i = 0; i < encodedSize; i++) {
fprintf(encodeDbg, "%02X ", (unsigned char)(encoded[i]));
}
fprintf(encodeDbg, "\n");
fflush(encodeDbg);
(*env)->SetByteArrayRegion(env, jencoded, 0, encodedSize, encoded);
jbyte* encoded_test = (*env)->GetByteArrayElements(env, jencoded, NULL);
for (i = 0; i < encodedSize; i++) {
fprintf(encodeDbg, "%02X ", (unsigned char)(encoded_test[i]));
}
fprintf(encodeDbg, "\n");
fflush(encodeDbg);
(*env)->ReleaseByteArrayElements(env, jencoded, encoded_test, JNI_ABORT);
Run Code Online (Sandbox Code Playgroud)
encoded和jencoded(即encoded_test)中的值不匹配!多次调用此过程后, …
已提出类似的问题,但常规解决方案对我不起作用。也许我错过了一些东西。我快要失去理智了:(((
\n\n从标题中你可以明白,我有一个oracle数据库,其中包含非ascii内容。我想使用oci8用php查询/显示它。
\n\n首先数据库是ISO8859P9,即查询
\n\nselect parameter, value from v$nls_parameters where parameter in (\'NLS_CHARACTERSET\', \'NLS_LANGUAGE\', \'NLS_TERRITORY\')\nRun Code Online (Sandbox Code Playgroud)\n\n回报
\n\nNLS_LANGUAGE AMERICAN\nNLS_TERRITORY AMERICA\nNLS_CHARACTERSER WE8ISO8859P9\nRun Code Online (Sandbox Code Playgroud)\n\n所以我相应地设置了 NLS_LANG 变量,即 getenv("NLS_LANG") 返回“AMERICAN_AMERICA.WE8ISO8859P9”。
\n\n我插入AddDefaultCharset ISO-8859-9到 /etc/apache2/conf.d/charset 文件,并且我总是包含<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">在 php 文件的 html 内容的 head 部分中。因此,当我通过 firebug 检查时,我看到响应的“Content-Type”标头是“text/html; charset=ISO-8859-9”。
最后,我在 /etc/php5/apache2/php.ini 文件中有一行default_charset = "ISO-8859-9",在输出 phpinfo() 的核心部分中,我看到 default_charset 是 ISO-8859-9。
在完成所有这些内容之后,当我检索其中包含字符的字符串\xc4\xb0并回显它时,它显示为 \'?\'。那就是问题所在!!!当我查询时select dump(nameofthatstring, 16)...,我看到它的字节值为DD,即根据8859-9正确。
我不确定它是否相关,但是,我会给出最后的细节:当我 …