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

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

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

JMenuItem.setBackground介绍

暂无

代码示例

代码示例来源:origin: com.synaptix.toast/toast-tk-automation-client

private void disableInitButton() {
    this.initButton.setBackground(Color.RED);
    this.initButton.setEnabled(false);
  }
}

代码示例来源:origin: com.synaptix.toast/toast-tk-automation-client

private void enableInitButton() {
  this.initButton.setBackground(Color.GREEN);
  this.initButton.setEnabled(true);
}

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

/**
 * Make a menu item with appropriate colors and <code>this</end> as its listener. 
 * @param label The label for the menu item
 * @return The menu item
 */
private JMenuItem makeMenuItem(String label) {
JMenuItem item     = new JMenuItem(label);
item.setForeground(navyBlue);
item.setBackground(lightYellow);
item.addActionListener(this);
return item;
}

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

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

代码示例来源:origin: stackoverflow.com

private JMenuItem createColoredSeparator(Color color){
  JMenuItem separator = new JMenuItem();
  separator.setPreferredSize(new Dimension(5,5));
  separator.setBackground(color);
  separator.setEnabled(false); //make the item unclickable so menu doesn't close
  return separator;
}

代码示例来源:origin: stackoverflow.com

JMenuItem a = new JMenuItem("A");
a.setOpaque(true);
a.setBackground(Color.GREEN);

代码示例来源:origin: stackoverflow.com

JMenuItem item= new JMenuItem("Test");
item.setOpaque(true);
item.setBackground(Color.CYAN);

代码示例来源:origin: stackoverflow.com

private JMenuItem createColoredSeparator(Color color){
   JMenuItem separator = new JMenuItem();
   separator.setPreferredSize(new Dimension(50,50)); //Increased to highlight whats happening
   //Imitate the default raised border
   Border raisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED,
       UIManager.getColor("MenuItem.background"),UIManager.getColor("MenuItem.background").darker());
   //Merge the borders with the raised border applied outside of the border concealing part of the background
   separator.setBorder(new CompoundBorder(
       raisedBorder, BorderFactory.createLineBorder(UIManager.getColor("MenuItem.background"), 8)));
   separator.setBackground(color);
   separator.setEnabled(false); //make the item un-clickable so menu doesn't close
   return separator;
 }

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

item.setBackground( new java.awt.Color( 205, 205, 205 ) );
indices.add( item );
item.setText( idx );
item.setBackground( new java.awt.Color( 205, 205, 205 ) );
indices.add( item );
item.setText( idx );

代码示例来源:origin: com.synaptix.toast/toast-tk-automation-client

private void createMenuBar() {
  JMenuBar menubar = new JMenuBar();
  JMenu startMenu = new JMenu("Start");
  startMenu.setIcon(new ImageIcon(Resource.ICON_POWER_16PX_IMG));
  
  initButton = new JMenuItem("Download & Init SUT Bat");
  initButton.setMnemonic(KeyEvent.VK_F);
  initButton.setBackground(Color.green);
  initButton.setToolTipText("download the system under test, and open a bat to start it's inspection & recording..");
  initButton.setIcon(new ImageIcon(Resource.ICON_POWER_16PX_IMG));
  startMenu.add(initButton);
  
  runtimePropertyButton = new JMenuItem("Settings");
  runtimePropertyButton.setIcon(new ImageIcon(Resource.ICON_CONF_16PX_2_IMG));
  runtimePropertyButton.setToolTipText("Edit runtime properties..");
  runtimePropertyButton.setMnemonic(KeyEvent.VK_F);
  
  startMenu.add(runtimePropertyButton);
  menubar.add(startMenu);
  setJMenuBar(menubar);
}

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

@Override
public void installUI (JComponent c) {
  super.installUI (c);
  JMenuItem menuItem = (JMenuItem) c;
  menuItem.setFont (UIManager.getFont ("MenuItem.font"));
  menuItem.setBackground (UIManager.getColor ("MenuItem.background"));
  menuItem.setForeground (UIManager.getColor ("MenuItem.foreground"));
  menuItem.setHorizontalAlignment (SwingConstants.LEFT);
  menuItem.setVerticalAlignment (SwingConstants.CENTER);
  menuItem.setBorder (UIManager.getBorder ("MenuItem.border"));
}

代码示例来源:origin: vasl-developers/vasl

l_SelectItem.setBackground(new Color(255,255,255));
m_mnuMainPopup.add(l_SelectItem);
m_mnuMainPopup.addSeparator();

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

static JMenuItem customizeMenuItemAsLabel( final JMenuItem label, final Configuration configuration ) {
  label.setFont( MainFrame.menu_font.deriveFont( Font.BOLD ) );
  if ( !configuration.isUseNativeUI() ) {
    label.setBackground( configuration.getGuiMenuBackgroundColor() );
    label.setForeground( configuration.getGuiMenuTextColor() );
    label.setOpaque( true );
  }
  label.setSelected( false );
  label.setEnabled( false );
  return label;
}

代码示例来源:origin: cytoscape.coreplugins/linkout

source.setBackground(Color.white);
source.setFont(TITLE_FONT);
source.setEnabled(false);

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

item.setBackground( new java.awt.Color( 205, 205, 205 ) );
indices.add( item );
item.setText( index.getAttribute().getName() );
item.setBackground( new java.awt.Color( 205, 205, 205 ) );
indices.add( item );
item.setText( index.getAttribute().getName() );

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

void customizeJMenuItem( final JMenuItem jmi ) {
  if ( jmi != null ) {
    jmi.setFont( MainFrame.menu_font );
    if ( !getConfiguration().isUseNativeUI() ) {
      jmi.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
      jmi.setForeground( getConfiguration().getGuiMenuTextColor() );
    }
    jmi.addActionListener( this );
  }
}

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

JMenuItem customizeJMenuItem( final JMenuItem jmi ) {
  if ( jmi != null ) {
    jmi.setFont( MainFrame.menu_font );
    if ( !getConfiguration().isUseNativeUI() ) {
      jmi.setBackground( getConfiguration().getGuiMenuBackgroundColor() );
      jmi.setForeground( getConfiguration().getGuiMenuTextColor() );
    }
    jmi.addActionListener( this );
  }
  return jmi;
}

代码示例来源:origin: igniterealtime/Spark

JMenuItem header = new JMenuItem(
  Res.getString("group.search.results") + ":");
header.setBackground(UIManager.getColor("List.selectionBackground"));
header.setForeground(Color.red);
popup.add(header);

代码示例来源:origin: matsim-org/matsim

menu1.setBackground(Color.lightGray);
popmen.add( menu1 );
popmen.addSeparator();

代码示例来源:origin: vasl-developers/vasl

l_Toggletoolbar.setBackground(new Color(255,255,255));
m_objASLMap.getPopupMenu().add(l_Toggletoolbar);
m_objASLMap.getPopupMenu().addSeparator();

相关文章

JMenuItem类方法