Java Code Examples for javax.swing.JMenu#setFont()

The following examples show how to use javax.swing.JMenu#setFont() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SettingsAction.java    From tuxguitar with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected void addSoundMenu( JPopupMenu parent ){
	JMenu soundMenu = new JMenu("Sound");
	soundMenu.setFont( TGConfig.FONT_WIDGETS );
	
	JMenuItem soundMixer = new JMenuItem("Open Mixer");
	soundMixer.addActionListener(new TGActionProcessorListener(getContext(), TransportMixerAction.NAME));
	soundMixer.setFont( TGConfig.FONT_WIDGETS );
	soundMenu.add( soundMixer );
	
	JMenuItem soundSetup = new JMenuItem("Sound Settings");
	soundSetup.addActionListener(new TGActionProcessorListener(getContext(), TransportSetupAction.NAME));
	soundSetup.setFont( TGConfig.FONT_WIDGETS );
	soundMenu.add( soundSetup );
	
	parent.add( soundMenu );
}
 
Example 2
Source File: MainWindow.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
private JMenu createMenu(String title) {
	JMenu menu = new JMenu(title);
	// menu.setForeground(ColorResource.getDeepFontColor());
	menu.setFont(FontResource.getBoldFont());
	menu.setBorderPainted(false);
	menu.setBorder(new EmptyBorder(getScaledInt(5), getScaledInt(5), getScaledInt(5), getScaledInt(5)));
	return menu;
}
 
Example 3
Source File: MainWindow.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
private JMenu addSubMenu(String id, JMenu parentMenu, PopupMenuListener popupListener) {
	JMenu menu = new JMenu(StringResource.get(id));
	menu.setName(id);
	menu.setFont(FontResource.getNormalFont());
	// menu.setForeground(ColorResource.getLightFontColor());
	menu.addActionListener(this);
	// menu.setBackground(ColorResource.getDarkerBgColor());
	menu.setBorderPainted(false);
	menu.getPopupMenu().addPopupMenuListener(popupListener);
	parentMenu.add(menu);
	return menu;
}
 
Example 4
Source File: SettingsAction.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void addViewMenu( JPopupMenu parent ){
	int style = TuxGuitar.instance().getTablatureEditor().getTablature().getViewLayout().getStyle();
	
	JMenu showMenu = new JMenu("View");
	showMenu.setFont( TGConfig.FONT_WIDGETS );
	
	JMenuItem showScore = new JCheckBoxMenuItem("Show Score", ( style & TGLayout.DISPLAY_SCORE) != 0 );
	showScore.addActionListener(new TGActionProcessorListener(getContext(), SetScoreEnabledAction.NAME));
	showScore.setFont( TGConfig.FONT_WIDGETS );
	showMenu.add( showScore );
	
	JMenuItem showTablature = new JCheckBoxMenuItem("Show Tablature", ( style & TGLayout.DISPLAY_TABLATURE) != 0 );
	showTablature.addActionListener(new TGActionProcessorListener(getContext(), SetTablatureEnabledAction.NAME));
	showTablature.setFont( TGConfig.FONT_WIDGETS );
	showMenu.add( showTablature );
	
	JMenuItem showChordName = new JCheckBoxMenuItem("Show Chord Names", ( style & TGLayout.DISPLAY_CHORD_NAME) != 0 );
	showChordName.addActionListener(new TGActionProcessorListener(getContext(), SetChordNameEnabledAction.NAME));
	showChordName.setFont( TGConfig.FONT_WIDGETS );
	showMenu.add( showChordName );
	
	JMenuItem showChordDiagram = new JCheckBoxMenuItem("Show Chord Diagrams", ( style & TGLayout.DISPLAY_CHORD_DIAGRAM) != 0 );
	showChordDiagram.addActionListener(new TGActionProcessorListener(getContext(), SetChordDiagramEnabledAction.NAME));
	showChordDiagram.setFont( TGConfig.FONT_WIDGETS );
	showMenu.add( showChordDiagram );
	
	parent.add( showMenu );
}
 
Example 5
Source File: MenuFactory.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
public static JMenu createJMenu(String description, ImageInfoReader imageInfoReader, SoundIdReader soundIdReader) {
	JMenu menu = new TiledImageJMenu(description, imageInfoReader);
	menu.setBackground(ColorPalette.DARK_BACKGROUND_COLOR);
	menu.setForeground(ColorPalette.FOREGROUND_COLOR);
	menu.setFont(Fonts.FONT);
	menu.setCursor(Cursors.CURSOR);
	addRollOverSoundEffect(menu, soundIdReader);
	return menu;
}
 
Example 6
Source File: JPlagCreator.java    From jplag with GNU General Public License v3.0 5 votes vote down vote up
public static JMenu createMenu(String text) {
	JMenu optionsMenu = new JMenu();
	optionsMenu.setText(text);
	optionsMenu.setBackground(JPlagCreator.SYSTEMCOLOR);
	optionsMenu.setFont(SYSTEM_FONT);
	return optionsMenu;
}
 
Example 7
Source File: FontSizer.java    From osp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the menu font.
 *
 * @param m a menu
 * @param font the font
 */
private static void setMenuFont(JMenu m, Font font) {
  m.setFont(font);
  for(int i = 0; i<m.getMenuComponentCount(); i++) {
    m.getMenuComponent(i).setFont(font);
    if(m.getMenuComponent(i) instanceof JMenu) {
      setMenuFont((JMenu) m.getMenuComponent(i), font);
    }
  }
}
 
Example 8
Source File: AppMenuBar.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 4 votes vote down vote up
private JMenu changeFont(JMenu menu) {
    menu.setFont(new Font("Default", Font.BOLD, 11));
    return menu;
}
 
Example 9
Source File: ZooFrame.java    From JavaMainRepo with Apache License 2.0 4 votes vote down vote up
public void setClock(JMenuBar panel) {

		JMenu clockMenu = new JMenu();

		// List of possible GMT
		JButton[] timeZones = new JButton[24];
		timeZones[0] = new JButton("GMT-12");
		timeZones[1] = new JButton("GMT-11");
		timeZones[2] = new JButton("GMT-10");
		timeZones[3] = new JButton("GMT-9");
		timeZones[4] = new JButton("GMT-8");
		timeZones[5] = new JButton("GMT-7");
		timeZones[6] = new JButton("GMT-6");
		timeZones[7] = new JButton("GMT-5");
		timeZones[8] = new JButton("GMT-4");
		timeZones[9] = new JButton("GMT-3");
		timeZones[10] = new JButton("GMT-2");
		timeZones[11] = new JButton("GMT-1");
		timeZones[12] = new JButton("GMT");
		timeZones[13] = new JButton("GMT+1");
		timeZones[14] = new JButton("GMT+2");
		timeZones[15] = new JButton("GMT+3");
		timeZones[16] = new JButton("GMT+4");
		timeZones[17] = new JButton("GMT+5");
		timeZones[18] = new JButton("GMT+6");
		timeZones[19] = new JButton("GMT+7");
		timeZones[20] = new JButton("GMT+8");
		timeZones[21] = new JButton("GMT+9");
		timeZones[22] = new JButton("GMT+10");
		timeZones[23] = new JButton("GMT+11");

		clockMenu.setFont(new Font(clockMenu.getFont().getName(), Font.PLAIN, 28));

		panel.add(clockMenu, BorderLayout.LINE_END);

		// Every button will have the same listener
		ClockController listener = new ClockController();

		for (int i = 0; i < timeZones.length; i++) {
			timeZones[i].addActionListener(listener);
			timeZones[i].setMargin(new Insets(0, 0, 0, 0));
			timeZones[i].setContentAreaFilled(false);
			timeZones[i].setBorderPainted(false);
			timeZones[i].setOpaque(false);
			clockMenu.add(timeZones[i]);
		}

		Thread clock = new Thread() {

			public void run() {
				String GMT;
				for (;;) {
					GMT = listener.getButtonPressedText();
					Calendar cal;
					if (GMT == null) {
						cal = Calendar.getInstance();
					} else {
						cal = Calendar.getInstance(TimeZone.getTimeZone(GMT));
					}
					int second = cal.get(Calendar.SECOND);
					int minute = cal.get(Calendar.MINUTE);
					int hours = cal.get(Calendar.HOUR_OF_DAY);

					clockMenu.setText(hours + ":" + minute + ":" + second);

					try {
						sleep(100);
					} catch (InterruptedException e) {

					}
				}
			}

		};
		clock.start();
	}
 
Example 10
Source File: UI.java    From arcgis-runtime-demo-java with Apache License 2.0 4 votes vote down vote up
public static JMenu createMenu(String label) {
  JMenu subMenu = new JMenu(label);
  subMenu.setForeground(UI.FOREGROUND);
  subMenu.setFont(UI.FONT);
  return subMenu;
}
 
Example 11
Source File: UI.java    From arcgis-runtime-demo-java with Apache License 2.0 4 votes vote down vote up
public static JMenu createMenu(String label) {
  JMenu subMenu = new JMenu(label);
  subMenu.setForeground(UI.FOREGROUND);
  subMenu.setFont(UI.FONT);
  return subMenu;
}