当前位置: 首页>>代码示例>>Java>>正文


Java JRadioButtonMenuItem.isSelected方法代码示例

本文整理汇总了Java中javax.swing.JRadioButtonMenuItem.isSelected方法的典型用法代码示例。如果您正苦于以下问题:Java JRadioButtonMenuItem.isSelected方法的具体用法?Java JRadioButtonMenuItem.isSelected怎么用?Java JRadioButtonMenuItem.isSelected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JRadioButtonMenuItem的用法示例。


在下文中一共展示了JRadioButtonMenuItem.isSelected方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: persist

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
public static void persist(JMenu menu, String tag) {
   int rb = 0;
   boolean inRb = false;
   for (int j = 0; j < menu.getItemCount(); ++j) {
      if (menu.getItem(j) instanceof JRadioButtonMenuItem) {
         if (!inRb) {
            inRb = true;
            ++rb;
         }
         JRadioButtonMenuItem rbItem = (JRadioButtonMenuItem)menu.getItem(j);
         if (rbItem.isSelected()) {
            Persist.set("#." + tag + menu.getText() + "." + rb, Persist.toTag("#." + rb + "." + rbItem.getActionCommand()));
         }
      } else {
         inRb = false;
         if (menu.getItem(j) instanceof JCheckBoxMenuItem) {
            JCheckBoxMenuItem cbItem = (JCheckBoxMenuItem)menu.getItem(j);
            Persist.set("#." + tag + menu.getText() + ' ' + cbItem.getText(), cbItem.getState() ? "true" : "false");
         } else
         if (menu.getItem(j) instanceof JMenu) {
            persist((JMenu)menu.getItem(j), tag);
         }
      }
   }
}
 
开发者ID:pushkarkp,项目名称:twidlit,代码行数:26,代码来源:PersistentMenuBar.java

示例2: getSelectedLanguage

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
/***************************************Source compilation****************************************************/

	protected Language getSelectedLanguage() {
		for (JRadioButtonMenuItem rbmi : main.rbmiSelection.keySet()) {
			if (rbmi.isSelected()) {
				return main.rbmiSelection.get(rbmi);
			}
		}

		throw new IllegalStateException("Undefined state. No language selected.");
	}
 
开发者ID:repeats,项目名称:Repeat,代码行数:12,代码来源:MainBackEndHolder.java

示例3: paintIcon

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
/**
 * Paints the icon.
 *
 * @param c  the component.
 * @param g  the graphics device.
 * @param x  the x-coordinate.
 * @param y  the y-coordinate.
 */
public void paintIcon(Component c, Graphics g, int x, int y)
{
  Color savedColor = g.getColor();
  JRadioButtonMenuItem item = (JRadioButtonMenuItem) c;
  g.setColor(MetalLookAndFeel.getBlack());
  g.drawLine(x + 2, y, x + 6, y);
  g.drawLine(x + 7, y + 1, x + 7, y + 1);
  g.drawLine(x + 8, y + 2, x + 8, y + 6);
  g.drawLine(x + 7, y + 7, x + 7, y + 7);
  g.drawLine(x + 2, y + 8, x + 6, y + 8);
  g.drawLine(x + 1, y + 7, x + 1, y + 7);
  g.drawLine(x, y + 2, x, y + 6);
  g.drawLine(x + 1, y + 1, x + 1, y + 1);

  if (item.isSelected())
    {
      g.drawLine(x + 3, y + 2, x + 5, y + 2);
      g.fillRect(x + 2, y + 3, 5, 3);
      g.drawLine(x + 3, y + 6, x + 5, y + 6);
    }

  // highlight
  g.setColor(MetalLookAndFeel.getControlHighlight());
  g.drawLine(x + 3, y + 1, x + 6, y + 1);
  g.drawLine(x + 8, y + 1, x + 8, y + 1);
  g.drawLine(x + 9, y + 2, x + 9, y + 7);
  g.drawLine(x + 8, y + 8, x + 8, y + 8);
  g.drawLine(x + 2, y + 9, x + 7, y + 9);
  g.drawLine(x + 1, y + 8, x + 1, y + 8);
  g.drawLine(x + 1, y + 3, x + 1, y + 6);
  g.drawLine(x + 2, y + 2, x + 2, y + 2);
  g.setColor(savedColor);
}
 
开发者ID:vilie,项目名称:javify,代码行数:42,代码来源:MetalIconFactory.java

示例4: paintIcon

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
/**
 * Paints the icon.
 * 
 * @param c  the component.
 * @param g  the graphics device.
 * @param x  the x-coordinate.
 * @param y  the y-coordinate.
 */
public void paintIcon(Component c, Graphics g, int x, int y) 
{
  Color savedColor = g.getColor();
  JRadioButtonMenuItem item = (JRadioButtonMenuItem) c;
  g.setColor(MetalLookAndFeel.getBlack());
  g.drawLine(x + 2, y, x + 6, y);
  g.drawLine(x + 7, y + 1, x + 7, y + 1);
  g.drawLine(x + 8, y + 2, x + 8, y + 6);
  g.drawLine(x + 7, y + 7, x + 7, y + 7);
  g.drawLine(x + 2, y + 8, x + 6, y + 8);
  g.drawLine(x + 1, y + 7, x + 1, y + 7);
  g.drawLine(x, y + 2, x, y + 6);
  g.drawLine(x + 1, y + 1, x + 1, y + 1);
  
  if (item.isSelected())
    {
      g.drawLine(x + 3, y + 2, x + 5, y + 2);
      g.fillRect(x + 2, y + 3, 5, 3);
      g.drawLine(x + 3, y + 6, x + 5, y + 6);
    }

  // highlight
  g.setColor(MetalLookAndFeel.getControlHighlight());
  g.drawLine(x + 3, y + 1, x + 6, y + 1);
  g.drawLine(x + 8, y + 1, x + 8, y + 1);
  g.drawLine(x + 9, y + 2, x + 9, y + 7);
  g.drawLine(x + 8, y + 8, x + 8, y + 8);
  g.drawLine(x + 2, y + 9, x + 7, y + 9);
  g.drawLine(x + 1, y + 8, x + 1, y + 8);
  g.drawLine(x + 1, y + 3, x + 1, y + 6);
  g.drawLine(x + 2, y + 2, x + 2, y + 2);
  g.setColor(savedColor);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:42,代码来源:MetalIconFactory.java

示例5: getFromDropDown

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
private String getFromDropDown(JMenu menu) {
    Component[] modes = menu.getMenuComponents();
    String selection = "";
    for (Component mode : modes) {
        JRadioButtonMenuItem modeButton = (JRadioButtonMenuItem) mode;
        if (modeButton.isSelected()) {
            selection = modeButton.getText();
            //System.out.println(selection);
            return selection;
        }
    }
    return selection;
}
 
开发者ID:Impro-Visor,项目名称:Impro-Visor,代码行数:14,代码来源:ActiveTradingDialog.java

示例6: buildSorter

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
Comparator<? super Drawable> buildSorter()
{
  Comparator<? super Drawable> sorter = null;
  
  for (int i = 0; i < sortCriteria.length; ++i)
  {
    JRadioButtonMenuItem criteria = sortCriteria[i];
    
    if (criteria.isSelected())
      sorter = sorters.get(i);
  }
  
  return sorter != null && reverseSortOrder.isSelected() ? sorter.reversed() : sorter;
}
 
开发者ID:Jakz,项目名称:rom-manager,代码行数:15,代码来源:ViewMenu.java


注:本文中的javax.swing.JRadioButtonMenuItem.isSelected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。