我有一个进度对话框窗口,其中包含3个JComponents:JLabel,JProgressBar,JButton,它在不同线程的应用程序的不同部分用作默认对话框窗口.因此,当我尝试更改标签的值时,它不会清除其下的背景,它只是在旧文本上绘制新文本.包装器类不会覆盖它只是将方法调用委托给它包含的组件的任何方法.
这是代码:
public void setNote(String note) {
this.note = note;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
label.setText(ProgressDialog.this.note);
}
});
}
Run Code Online (Sandbox Code Playgroud)
实际结果类似于http://www.daniweb.com/forums/post1073367.html#post1073367 但该解决方案不适合我.
有没有人遇到这样的问题?
谢谢.
这是该类的cuted版本.但正如我所说,我不能让它错误地工作.希望这可以帮助.
public class Tesssst {
public static void main(String [] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ProgressDialog dialog = new ProgressDialog(frame, "Title", "Message");
dialog.showDialog(true);
}
}
class ProgressDialog extends JComponent {
/**
*
*/
private JProgressBar progressBar;
private JLabel label;
private JFrame parentComponent;
private String title;
private String note;
private boolean canceled; …Run Code Online (Sandbox Code Playgroud) 我在我的示例项目中使用星云菜单。我有一个场景如下。我假设侧边栏中有 4 个菜单项,每个菜单项有 4 到 5 个子菜单。
例如。
menu 1
submenu 1
submenu 2
menu 2
submenu 1
submenu 2
submenu 3
menu 3
menu 4
Run Code Online (Sandbox Code Playgroud)
等等。
现在,当我单击菜单 1 时,我可以看到 2 个菜单,现在我单击子菜单 2 ,它会将我定向到该特定页面。现在,如果我单击菜单 2,我可以看到 3 个子菜单,如果我单击子菜单 3,它会将我重定向到该特定页面,
现在的问题是,两个菜单都在侧边栏中打开,我可以看到所有子菜单。如果其他菜单打开,我想关闭侧边栏中的上一个菜单。这在星云菜单中可能吗?任何帮助表示赞赏。
请查看以下链接以供参考,(也可以尝试单击侧边栏菜单,与我的场景相同。)
https://akveo.github.io/nebular/docs/components/menu/api#nbmenucomponent
这是我的侧边栏菜单代码供参考。
import { Component, OnDestroy } from '@angular/core';
import { delay, withLatestFrom, takeWhile } from 'rxjs/operators';
import {
NbMediaBreakpoint,
NbMediaBreakpointsService,
NbMenuItem,
NbMenuService,
NbSidebarService,
NbThemeService,
} from '@nebular/theme';
import { StateService } from '../../../@core/data/state.service';
// TODO: move layouts into the …Run Code Online (Sandbox Code Playgroud) 我正在使用 Nebular Theme 组件,并希望通过单击按钮手动激活特定选项卡。我在他们的文档https://akveo.github.io/nebular/docs/components/tabs/overview#nbtabsetcomponent 中找不到任何信息
<nb-tabset>
<nb-tab tabTitle="Search">xxxx</ng-tab>
<nb-tab tabTitle="Add">yyyyy</ng-tab>
</nb-tabset>
<button (click)="ActivateTabAdd()">Add</button>
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏。谢谢