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


Java JMenuItem.getText方法代码示例

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


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

示例1: actionPerformed

import javax.swing.JMenuItem; //导入方法依赖的package包/类
/** 
 * ActionListener interface implementation
 * This would presumably handle menu selections, but none of them actually
 * do anything now.
 */
public void actionPerformed(ActionEvent e) {
    if ( DEBUG ) {
        JMenuItem source = (JMenuItem)(e.getSource());
        String s = "Action event detected." // NOI18N
        + "\n" // NOI18N
        + "    Event source: " + source.getText() // NOI18N
        + " (an instance of " + getClassName(source) + ")"; // NOI18N
        System.out.println (s + "\n"); // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:QueryBuilderInternalFrame.java

示例2: getItemText

import javax.swing.JMenuItem; //导入方法依赖的package包/类
public static String getItemText(JMenuItem current) {
    String text = current.getText();
    if (text == null || "".equals(text)) {
        return getTextFromIcon(current);
    }
    return text;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:JMenuItemJavaElement.java

示例3: actionPerformed

import javax.swing.JMenuItem; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
    JMenuItem source = (JMenuItem) (e.getSource());
    String s = "Action event detected." + newline + "    Event source: " + source.getText() + " (an instance of "
            + getClassName(source) + ")";
    output.append(s + newline);
    output.setCaretPosition(output.getDocument().getLength());
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:MenuDemo.java

示例4: actionPerformed

import javax.swing.JMenuItem; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
	
	JMenuItem btn = (JMenuItem) e.getSource();
	
	if(btn.getText() == "Github") {
		openSite("https://condolent.github.io/USB3Installer/");
	}
	
	if(btn.getText() == "Exit") {
		System.exit(ABORT);
	}
	
	if(btn.getText() == "About") {
		System.out.println("About clicked.\nCalled popup.");
		openAbout();
	}
	
	if(btn.getText() == "How do I use this?") {
		openSite("https://github.com/condolent/USB3Installer/wiki");
	}
	
	if(btn.getText() == "Report a bug") {
		openSite("https://github.com/condolent/USB3Installer/issues");
	}
	
	/*if(btn.getText() == "Choose Workspace") {
		System.out.println("Choose Workspace clicked.");
		System.err.println("This function isn't finished yet.");
	}*/
	
}
 
开发者ID:condolent,项目名称:USB3Installer,代码行数:33,代码来源:Toolbar.java

示例5: itemStateChanged

import javax.swing.JMenuItem; //导入方法依赖的package包/类
public void itemStateChanged(ItemEvent e) {
    JMenuItem source = (JMenuItem) (e.getSource());
    String s = "Item event detected." + newline + "    Event source: " + source.getText() + " (an instance of "
            + getClassName(source) + ")" + newline + "    New state: "
            + ((e.getStateChange() == ItemEvent.SELECTED) ? "selected" : "unselected");
    output.append(s + newline);
    output.setCaretPosition(output.getDocument().getLength());
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:MenuSelectionManagerDemo.java

示例6: itemStateChanged

import javax.swing.JMenuItem; //导入方法依赖的package包/类
@Override
public void itemStateChanged(ItemEvent e) {
    JMenuItem source = (JMenuItem)(e.getSource());
    String s = "Item event detected."
               + newline
               + "    Event source: " + source.getText()
               + " (an instance of " + getClassName(source) + ")"
               + newline
               + "    New state: "
               + ((e.getStateChange() == ItemEvent.SELECTED) ?
                 "selected":"unselected");
    output.append(s + newline);
    output.setCaretPosition(output.getDocument().getLength());
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:15,代码来源:FreeColMenuTest.java

示例7: itemStateChanged

import javax.swing.JMenuItem; //导入方法依赖的package包/类
public void itemStateChanged(ItemEvent e) {
   JMenuItem source = (JMenuItem)(e.getSource());
   String s = "Item event detected.\n"
              + "    Event source: " + source.getText()
              + " (an instance of " + source.getClass().getName() + ")\n"
              + "    New state: "
              + ((e.getStateChange() == ItemEvent.SELECTED) ?
                "selected":"unselected") + "\n\n";
   System.err.println(s);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:11,代码来源:SchemaVisualization.java

示例8: itemStateChanged

import javax.swing.JMenuItem; //导入方法依赖的package包/类
@Override
public void itemStateChanged(ItemEvent e) {
    JMenuItem source = (JMenuItem)(e.getSource());
    String s = "Item event detected.\n"
               + "    Event source: " + source.getText()
               + " (an instance of " + source.getClass().getName() + ")\n"
               + "    New state: "
               + ((e.getStateChange() == ItemEvent.SELECTED) ?
                 "selected":"unselected") + "\n\n";
    System.err.println(s);
 }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:12,代码来源:AbstractMenuHandler.java

示例9: actionPerformed

import javax.swing.JMenuItem; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent ae) {
    JMenuItem source = (JMenuItem)ae.getSource();
    String s = "Action event detected."
               + newline
               + "    Event source: " + source.getText()
               + " (an instance of " + getClassName(source) + ")";
    output.append(s + newline);
    output.setCaretPosition(output.getDocument().getLength());
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:11,代码来源:FreeColMenuTest.java

示例10: actionPerformed

import javax.swing.JMenuItem; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
	JMenuItem source = (JMenuItem) (e.getSource());
	String s = "Action event detected." + newline + "    Event source: "
			+ source.getText();
	System.out.println(s);
	if (source.getText().equals("new galton-watson tree")) {
		t.clear();
		GeometricTree.galtonWatsonTree(t, 100);
		t.inorderDraw();
		output.repaint();
	} else 	if (source.getText().equals("new complete binary tree")) {
		t.clear();
		GeometricTree.completeBinaryTree(t, 50);
		t.inorderDraw();			
		output.repaint();
	} else if (source.getText().equals("in-order layout")) {
		t.inorderDraw();
		output.repaint();
	} else if (source.getText().equals("leftist layout")) {
		t.leftistDraw();
		output.repaint();
	} else if (source.getText().equals("balanced layout")) {
		t.balancedDraw();
		output.repaint();
	}

}
 
开发者ID:hughxie,项目名称:class-code,代码行数:28,代码来源:GeometricTreeDemo.java

示例11: NbMenu

import javax.swing.JMenuItem; //导入方法依赖的package包/类
NbMenu(JMenuItem menu, List<NbMenu> submenu) {
    name = menu.getText();//getLabel();
    accelerator = (menu.getAccelerator() == null) ? null : menu.getAccelerator().toString();
    mnemo = menu.getMnemonic();
    this.submenu = submenu;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:MenuChecker.java


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