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

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

本文整理了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

@ScriptFunction
@Override
public void setBackground(Color aValue) {
  super.setBackground(aValue);
}

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

/**
 * Returns the <code>JMenu</code> displaying the appropriate menu items for
 * manipulating the Frame.
 * 
 * @return <code>JMenu</code> displaying the appropriate menu items for
 *         manipulating the Frame.
 */
private JMenu createMenu() {
  JMenu menu = new JMenu("");
  menu.setOpaque(false);
  menu.setBackground(null);
  if (this.getWindowDecorationStyle() == JRootPane.FRAME) {
    this.addMenuItems(menu);
  }
  return menu;
}

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

@Override
public void installUI (JComponent c) {
  super.installUI (c);
  JMenu menu = (JMenu) c;
  menu.setFont (UIManager.getFont ("Menu.font"));
  menu.setBorder (UIManager.getBorder ("Menu.border"));
  menu.setBackground (UIManager.getColor ("Menu.background"));
  menu.setForeground (UIManager.getColor ("Menu.foreground"));
  menu.setOpaque (UIManager.getBoolean ("Menu.opaque"));
}

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

private void updateDefaultBackgroundColor() {
  if (!UIDefaultsLookup.getBoolean("Menu.useMenuBarBackgroundForTopLevel")) {
    return;
  }
  JMenu menu = (JMenu) menuItem;
  if (menu.getBackground() instanceof UIResource) {
    if (menu.isTopLevelMenu()) {
      menu.setBackground(UIDefaultsLookup.getColor("MenuBar.background"));
    }
    else {
      menu.setBackground(UIDefaultsLookup.getColor(getPropertyPrefix() + ".background"));
    }
  }
}

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

/**
 * Returns the <code>JMenu</code> displaying the appropriate menu items for
 * manipulating the Frame.
 *
 * @return <code>JMenu</code> displaying the appropriate menu items for
 *         manipulating the Frame.
 */
private JMenu createMenu() {
  JMenu menu = new JMenu("");
  menu.setOpaque(false);
  menu.setBackground(null);
  //if (this.getWindowDecorationStyle() == JRootPane.FRAME) {
    this.addMenuItems(menu);
  //}
  menu.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      if (e.getClickCount() > 1) {
        closeAction.actionPerformed(new ActionEvent(e.getSource(),
            ActionEvent.ACTION_PERFORMED, null,
            EventQueue.getMostRecentEventTime(), e.getModifiers()));
      }
    }
  });
  return menu;
}

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

static JMenu createMenu( final String title, final Configuration conf ) {
  final JMenu jmenu = new JMenu( title );
  if ( !conf.isUseNativeUI() ) {
    jmenu.setFont( MainFrame.menu_font );
    jmenu.setBackground( conf.getGuiMenuBackgroundColor() );
    jmenu.setForeground( conf.getGuiMenuTextColor() );
  }
  return jmenu;
}

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

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

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

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

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

JMenu m = new JMenu("File");
m.setForeground(navyBlue);
m.setBackground(lightYellow);
m.add(sim.makeMenuItem("Add Index"));
m.add(sim.makeMenuItem("Add Server"));
JMenu helpMenu = new JMenu("Help");
helpMenu.setForeground(navyBlue);
helpMenu.setBackground(lightYellow);
helpMenu.add(sim.makeMenuItem("Help"));
helpMenu.add(sim.makeMenuItem("About"));

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

private JComponent createOtherActions() {
  Color fontColor = PropertyUtil.getColor(ProtegeProperties.getInstance().getProperty(ProtegeProperties.PROPERTY_COLOR_KEY),
                      Color.GRAY);
  JPanel otherActionsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
  otherActionsPanel.setBackground(Color.WHITE);
  JMenuBar littleMenuBar = new JMenuBar();
  // littleMenuBar.setBackground(Color.WHITE);
  littleMenuBar.setOpaque(false);
  final JMenu dropDownMenu = new JMenu("More actions");
  dropDownMenu.setFont(getFont().deriveFont(Font.BOLD, 10.0f));
  dropDownMenu.setForeground(fontColor);
  dropDownMenu.setBackground(Color.WHITE);
  littleMenuBar.add(dropDownMenu);
  for (AltStartupActionPlugin plugin : new AltStartupActionPluginLoader(ProtegeWelcomeFrame.this).getPlugins()) {
    try {
      AbstractAction a = plugin.newInstance();
      JMenuItem subMenu = new JMenuItem(a);
      dropDownMenu.add(subMenu);
    }
    catch (Exception e) {
      ProtegeApplication.getErrorLog().logError(e);
    }
  }
  otherActionsPanel.add(littleMenuBar);
  Box southBox = new Box(BoxLayout.Y_AXIS);
  southBox.setBorder(BorderFactory.createEmptyBorder(0, 50, 0, 0));
  southBox.add(otherActionsPanel);
  return southBox;
}

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

titleLabel.setFont(f3);
viewMenu.setBackground(WHITE);
viewMenu.add(viewLog);
viewLog.setBackground(WHITE);
fileMenu.setBackground(WHITE);
fileMenu.add(saveFileMnu);
saveFileMnu.setBackground(WHITE);
exitApplicationMnu.addActionListener(this);
menuBar.add(retrieveMenu);
retrieveMenu.setBackground(WHITE);
retrieveMenu.add(getAWSCredentialsLinkMnu);
getAWSCredentialsLinkMnu.setBackground(WHITE);
deleteArchiveMnu.addActionListener(this);
menuBar.add(helpMenu);
helpMenu.setBackground(WHITE);
helpMenu.add(updateMnu);
updateMnu.setBackground(WHITE);

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

menuHelp.setBackground(col);
menuTable.setBackground(col);
menuCards.setBackground(col);
menuOptions.setBackground(col);
menuDeal.setBackground(col);
menuGame.setBackground(col);
menuWindow.setBackground(col);
JMenu blank = new JMenu("         ");
blank.setBackground(col);
add(blank);
JMenu alert = new JMenu(mes);
alert.setBackground(col);
add(alert);

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

backendMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
backendMenu.setMnemonic( 'B' );
helpMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
helpMenu.add( about );
treePane.setPreferredSize( new java.awt.Dimension( 285, 403 ) );
searchMenu.setText( "Search" );
searchMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
searchMenu.add( run );
searchMenu.add( debug );
indices.setBackground( new java.awt.Color( 205, 205, 205 ) );

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

backendMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
backendMenu.setMnemonic( 'B' );
helpMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
helpMenu.add( about );
treePane.setPreferredSize( new java.awt.Dimension( 285, 403 ) );
searchMenu.setText( "Search" );
searchMenu.setBackground( new java.awt.Color( 205, 205, 205 ) );
searchMenu.add( run );
searchMenu.add( debug );
indices.setBackground( new java.awt.Color( 205, 205, 205 ) );

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

fileMenu.setBackground(new java.awt.Color(187, 203, 209));
fileMenu.setMnemonic('F');
fileMenu.setText("File");
editMenu.setBackground(new java.awt.Color(187, 203, 209));
editMenu.setMnemonic('E');
editMenu.setText("Edit");
generateMenu.setBackground(new java.awt.Color(187, 203, 209));
generateMenu.setMnemonic('G');
generateMenu.setText("Generate");
jMenu2.setBackground(new java.awt.Color(187, 203, 209));
jMenu2.setMnemonic('X');
jMenu2.setText("Export");
tutMenu.setBackground(new java.awt.Color(187, 203, 209));
tutMenu.setMnemonic('T');
tutMenu.setText("Tutorials");
menuBar.add(jMenu4);
helpMenu.setBackground(new java.awt.Color(187, 203, 209));
helpMenu.setMnemonic('H');
helpMenu.setText("Help");

相关文章