javax.swing.JMenu.setBackground()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中javax.swing.JMenu.setBackground()方法的一些代码示例,展示了JMenu.setBackground()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenu.setBackground()方法的具体详情如下:
包路径:javax.swing.JMenu
类名称:JMenu
方法名:setBackground

JMenu.setBackground介绍

暂无

代码示例

代码示例来源:origin: com.eas.platypus/platypus-js-forms

  1. @ScriptFunction
  2. @Override
  3. public void setBackground(Color aValue) {
  4. super.setBackground(aValue);
  5. }

代码示例来源:origin: org.java.net.substance/substance

  1. /**
  2. * Returns the <code>JMenu</code> displaying the appropriate menu items for
  3. * manipulating the Frame.
  4. *
  5. * @return <code>JMenu</code> displaying the appropriate menu items for
  6. * manipulating the Frame.
  7. */
  8. private JMenu createMenu() {
  9. JMenu menu = new JMenu("");
  10. menu.setOpaque(false);
  11. menu.setBackground(null);
  12. if (this.getWindowDecorationStyle() == JRootPane.FRAME) {
  13. this.addMenuItems(menu);
  14. }
  15. return menu;
  16. }

代码示例来源:origin: atarw/material-ui-swing

  1. @Override
  2. public void installUI (JComponent c) {
  3. super.installUI (c);
  4. JMenu menu = (JMenu) c;
  5. menu.setFont (UIManager.getFont ("Menu.font"));
  6. menu.setBorder (UIManager.getBorder ("Menu.border"));
  7. menu.setBackground (UIManager.getColor ("Menu.background"));
  8. menu.setForeground (UIManager.getColor ("Menu.foreground"));
  9. menu.setOpaque (UIManager.getBoolean ("Menu.opaque"));
  10. }

代码示例来源:origin: com.jidesoft/jide-oss

  1. private void updateDefaultBackgroundColor() {
  2. if (!UIDefaultsLookup.getBoolean("Menu.useMenuBarBackgroundForTopLevel")) {
  3. return;
  4. }
  5. JMenu menu = (JMenu) menuItem;
  6. if (menu.getBackground() instanceof UIResource) {
  7. if (menu.isTopLevelMenu()) {
  8. menu.setBackground(UIDefaultsLookup.getColor("MenuBar.background"));
  9. }
  10. else {
  11. menu.setBackground(UIDefaultsLookup.getColor(getPropertyPrefix() + ".background"));
  12. }
  13. }
  14. }

代码示例来源:origin: com.github.insubstantial/substance

  1. /**
  2. * Returns the <code>JMenu</code> displaying the appropriate menu items for
  3. * manipulating the Frame.
  4. *
  5. * @return <code>JMenu</code> displaying the appropriate menu items for
  6. * manipulating the Frame.
  7. */
  8. private JMenu createMenu() {
  9. JMenu menu = new JMenu("");
  10. menu.setOpaque(false);
  11. menu.setBackground(null);
  12. //if (this.getWindowDecorationStyle() == JRootPane.FRAME) {
  13. this.addMenuItems(menu);
  14. //}
  15. menu.addMouseListener(new MouseAdapter() {
  16. @Override
  17. public void mouseClicked(MouseEvent e) {
  18. if (e.getClickCount() > 1) {
  19. closeAction.actionPerformed(new ActionEvent(e.getSource(),
  20. ActionEvent.ACTION_PERFORMED, null,
  21. EventQueue.getMostRecentEventTime(), e.getModifiers()));
  22. }
  23. }
  24. });
  25. return menu;
  26. }

代码示例来源:origin: org.biojava.thirdparty/forester

  1. static JMenu createMenu( final String title, final Configuration conf ) {
  2. final JMenu jmenu = new JMenu( title );
  3. if ( !conf.isUseNativeUI() ) {
  4. jmenu.setFont( MainFrame.menu_font );
  5. jmenu.setBackground( conf.getGuiMenuBackgroundColor() );
  6. jmenu.setForeground( conf.getGuiMenuTextColor() );
  7. }
  8. return jmenu;
  9. }

代码示例来源:origin: cytoscape.coreplugins/attribute-browser

  1. curItem.setBackground(Color.white);
  2. curItem.add(getPopupMenu());

代码示例来源:origin: edu.illinois.lis/indri

  1. JMenu m = new JMenu("File");
  2. m.setForeground(navyBlue);
  3. m.setBackground(lightYellow);
  4. m.add(makeMenuItem("View as HTML"));

代码示例来源:origin: edu.illinois.lis/indri

  1. JMenu m = new JMenu("File");
  2. m.setForeground(navyBlue);
  3. m.setBackground(lightYellow);
  4. m.add(sim.makeMenuItem("Add Index"));
  5. m.add(sim.makeMenuItem("Add Server"));
  6. JMenu helpMenu = new JMenu("Help");
  7. helpMenu.setForeground(navyBlue);
  8. helpMenu.setBackground(lightYellow);
  9. helpMenu.add(sim.makeMenuItem("Help"));
  10. helpMenu.add(sim.makeMenuItem("About"));

代码示例来源:origin: org.protege/protege-editor-core-application

  1. private JComponent createOtherActions() {
  2. Color fontColor = PropertyUtil.getColor(ProtegeProperties.getInstance().getProperty(ProtegeProperties.PROPERTY_COLOR_KEY),
  3. Color.GRAY);
  4. JPanel otherActionsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
  5. otherActionsPanel.setBackground(Color.WHITE);
  6. JMenuBar littleMenuBar = new JMenuBar();
  7. // littleMenuBar.setBackground(Color.WHITE);
  8. littleMenuBar.setOpaque(false);
  9. final JMenu dropDownMenu = new JMenu("More actions");
  10. dropDownMenu.setFont(getFont().deriveFont(Font.BOLD, 10.0f));
  11. dropDownMenu.setForeground(fontColor);
  12. dropDownMenu.setBackground(Color.WHITE);
  13. littleMenuBar.add(dropDownMenu);
  14. for (AltStartupActionPlugin plugin : new AltStartupActionPluginLoader(ProtegeWelcomeFrame.this).getPlugins()) {
  15. try {
  16. AbstractAction a = plugin.newInstance();
  17. JMenuItem subMenu = new JMenuItem(a);
  18. dropDownMenu.add(subMenu);
  19. }
  20. catch (Exception e) {
  21. ProtegeApplication.getErrorLog().logError(e);
  22. }
  23. }
  24. otherActionsPanel.add(littleMenuBar);
  25. Box southBox = new Box(BoxLayout.Y_AXIS);
  26. southBox.setBorder(BorderFactory.createEmptyBorder(0, 50, 0, 0));
  27. southBox.add(otherActionsPanel);
  28. return southBox;
  29. }

代码示例来源:origin: SimpleAmazonGlacierUploader/SAGU

  1. titleLabel.setFont(f3);
  2. viewMenu.setBackground(WHITE);
  3. viewMenu.add(viewLog);
  4. viewLog.setBackground(WHITE);
  5. fileMenu.setBackground(WHITE);
  6. fileMenu.add(saveFileMnu);
  7. saveFileMnu.setBackground(WHITE);
  8. exitApplicationMnu.addActionListener(this);
  9. menuBar.add(retrieveMenu);
  10. retrieveMenu.setBackground(WHITE);
  11. retrieveMenu.add(getAWSCredentialsLinkMnu);
  12. getAWSCredentialsLinkMnu.setBackground(WHITE);
  13. deleteArchiveMnu.addActionListener(this);
  14. menuBar.add(helpMenu);
  15. helpMenu.setBackground(WHITE);
  16. helpMenu.add(updateMnu);
  17. updateMnu.setBackground(WHITE);

代码示例来源:origin: Pragmatists/tdd-trainings

  1. menuHelp.setBackground(col);
  2. menuTable.setBackground(col);
  3. menuCards.setBackground(col);
  4. menuOptions.setBackground(col);
  5. menuDeal.setBackground(col);
  6. menuGame.setBackground(col);
  7. menuWindow.setBackground(col);
  8. JMenu blank = new JMenu(" ");
  9. blank.setBackground(col);
  10. add(blank);
  11. JMenu alert = new JMenu(mes);
  12. alert.setBackground(col);
  13. add(alert);

代码示例来源:origin: org.apache.directory/com.springsource.org.apache.directory.server.core

  1. backendMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
  2. backendMenu.setMnemonic( 'B' );
  3. helpMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
  4. helpMenu.add( about );
  5. treePane.setPreferredSize( new java.awt.Dimension( 285, 403 ) );
  6. searchMenu.setText( "Search" );
  7. searchMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
  8. searchMenu.add( run );
  9. searchMenu.add( debug );
  10. indices.setBackground( new java.awt.Color( 205, 205, 205 ) );

代码示例来源:origin: org.apache.directory.server/apacheds-xdbm-tools

  1. backendMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
  2. backendMenu.setMnemonic( 'B' );
  3. helpMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
  4. helpMenu.add( about );
  5. treePane.setPreferredSize( new java.awt.Dimension( 285, 403 ) );
  6. searchMenu.setText( "Search" );
  7. searchMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
  8. searchMenu.add( run );
  9. searchMenu.add( debug );
  10. indices.setBackground( new java.awt.Color( 205, 205, 205 ) );

代码示例来源:origin: pvto/konte-art

  1. fileMenu.setBackground(new java.awt.Color(187, 203, 209));
  2. fileMenu.setMnemonic('F');
  3. fileMenu.setText("File");
  4. editMenu.setBackground(new java.awt.Color(187, 203, 209));
  5. editMenu.setMnemonic('E');
  6. editMenu.setText("Edit");
  7. generateMenu.setBackground(new java.awt.Color(187, 203, 209));
  8. generateMenu.setMnemonic('G');
  9. generateMenu.setText("Generate");
  10. jMenu2.setBackground(new java.awt.Color(187, 203, 209));
  11. jMenu2.setMnemonic('X');
  12. jMenu2.setText("Export");
  13. tutMenu.setBackground(new java.awt.Color(187, 203, 209));
  14. tutMenu.setMnemonic('T');
  15. tutMenu.setText("Tutorials");
  16. menuBar.add(jMenu4);
  17. helpMenu.setBackground(new java.awt.Color(187, 203, 209));
  18. helpMenu.setMnemonic('H');
  19. helpMenu.setText("Help");

相关文章