當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。