Here you can find the source of makeMenuItem(String s, ActionListener listener)
public static JMenuItem makeMenuItem(String s, ActionListener listener)
//package com.java2s; /*/*from w w w. j av a 2s.c o m*/ * Copyright (c) 2015 IBM Corporation and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; public class Main { public static final Font MEDIUM = new Font("Inconsolata, Arial", Font.PLAIN, 12); public static final Color BLUE3 = new Color(0, 178, 239); public static final Color BLUE8 = new Color(0, 25, 52); public static JMenuItem makeMenuItem(String s, ActionListener listener) { final JMenuItem item = new JMenuItem(s); item.setBackground(BLUE8); item.setForeground(BLUE3); item.setFont(MEDIUM); item.addActionListener(listener); return item; } }