下面列出了javax.swing.JMenuBar#setBackground ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void installUI (JComponent c) {
super.installUI (c);
JMenuBar menuBar = (JMenuBar) c;
menuBar.setFont (UIManager.getFont ("MenuBar.font"));
menuBar.setBackground (UIManager.getColor ("MenuBar.background"));
menuBar.setForeground (UIManager.getColor ("MenuBar.foreground"));
menuBar.setBorder (UIManager.getBorder ("MenuBar.border"));
}
@Override
public void uninstallUI(JComponent c) {
JMenuBar menuBar = (JMenuBar) c;
menuBar.setFont (null);
menuBar.setBackground (null);
menuBar.setBorder (null);
menuBar.setForeground (null);
super.uninstallUI(c);
}
public BitcoinWalletDialog(String text, Window parent) {
super(LSystem.applicationMain, text, Dialog.ModalityType.DOCUMENT_MODAL);
addWindowListener(HelperWindow.get());
setIconImage(UIRes.getIcon());
setResizable(false);
int frameWidth = 900;
int frameHeight = 580;
if (LSystem.applicationMain != null) {
frameWidth = LSystem.applicationMain.getWidth() - 150;
frameHeight = LSystem.applicationMain.getHeight() - 150;
}
setPreferredSize(new Dimension(frameWidth, frameHeight));
JMenuBar menuBar = new JMenuBar();
menuBar.setOpaque(true);
menuBar.setBackground(new Color(230, 230, 230));
menuBar.add(new Menus(this, "File", new String[] { "Exit", "exit" }));
menuBar.add(new Menus(this, "View", new String[] { "Receive Addresses", "view receive" },
new String[] { "Send Addresses", "view send" }));
menuBar.add(new Menus(this, "Actions", new String[] { "Send Coins", "send coins" },
new String[] { "Sign Message", "sign message" }, new String[] { "Verify Message", "verify message" }));
menuBar.add(new Menus(this, "Tools", new String[] { "Export Keys", "export keys" },
new String[] { "Import Keys", "import keys" }, new String[] { "Rescan Block Chain", "rescan" }));
setJMenuBar(menuBar);
transactionPanel = new TransactionPanel(this);
setContentPane(transactionPanel);
if (BTCLoader.networkChainHeight > BTCLoader.blockStore.getChainHeight()) {
setTitle("Bitcoin Wallet - Synchronizing with network");
synchronizingTitle = true;
}
addWindowListener(new ApplicationWindowListener());
BTCLoader.networkHandler.addListener(this);
BTCLoader.databaseHandler.addListener(this);
}
public static JMenuBar createMenuBar(JMenu menuAdd, JButton btnEdit, JButton btnQuery) {
JMenuBar menuBar = new JMenuBar();
menuBar.setFont(UI.FONT);
menuBar.setBackground(UI.BACKGROUND);
menuBar.setLayout(new FlowLayout());
menuBar.setAlignmentX(Component.CENTER_ALIGNMENT);
menuBar.add(menuAdd);
menuBar.add(new JSeparator());
menuBar.add(btnEdit);
menuBar.add(new JSeparator());
menuBar.add(btnQuery);
return menuBar;
}
public static JMenuBar createMenuBar(JMenu menuAdd, JButton btnEdit, JButton btnQuery) {
JMenuBar menuBar = new JMenuBar();
menuBar.setFont(UI.FONT);
menuBar.setBackground(UI.BACKGROUND);
menuBar.setLayout(new FlowLayout());
menuBar.setAlignmentX(Component.CENTER_ALIGNMENT);
menuBar.add(menuAdd);
menuBar.add(new JSeparator());
menuBar.add(btnEdit);
menuBar.add(new JSeparator());
menuBar.add(btnQuery);
return menuBar;
}