Getting the name of a menu from the menu item
Hi everybody,
I'm trying to get the name of the menu that a particular menu item is classified under, and thus far I can't figure out how. Can anyone give me a hand with this, please? I have a SSCCE that describes my efforts so far:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
public class MenuTester {
public MenuTester() {
JMenuItem item = new JMenuItem( "zzz" );
item.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
System.out.println( ((JPopupMenu)((JMenuItem)e.getSource()).getParent()).getLabel() );
System.out.println( ((JPopupMenu)((JMenuItem)e.getSource()).getParent()).getName() );
JMenu menu = new JMenu( "test" );
menu.setName( "test" );
menu.add( item );
JMenuBar bar = new JMenuBar();
bar.add( menu );
JFrame frame = new JFrame();
frame.setJMenuBar( bar );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setSize( 300, 300 );
frame.setVisible( true );
public static void main( String args[] ) { new MenuTester(); }
}I've tried the JPopupMenu method getLabel, and the generic Component method getName, but neither of them seem to work, even when I explicitly set the name. The result of both calls is "null", not "test" as it should be. There must be something small that I'm missing, but I'm not sure what, can anyone please tell me what it is?
Thanks,
Jezzica85
JMenuItem mi = (JMenuItem)e.getSource();
JPopupMenu popup = (JPopupMenu)mi.getParent();
JMenu menu = (JMenu)popup.getInvoker();
System.out.println( menu.getText() );
Similar Messages
-
Urgent: How to get the names of all menu items
I have a .mmb menu module.
There are many menus and submenus in it.
Now I want to get the names of all menu items available in the module using sql or pl/sql.
Actually I need to store these names in another table as it is. That is why I want get them programmatically.
Any solution please.... bit urgent
ThanksWhen I needed the same, I wrote my own application using
Forms API (Windows,Forms 6.0,6i). Perhaps it will help
you.
Let me know your e-mail and I'll send it. -
How to get the selected items from listbox
Regarding listbox i have two questions
1) I want to get the selected items as per the order in which ihave selected.Presently i'm getting in the ascending order.For example after selcting the 1,2,6 if i select 3 then its giving 1,2,3,6.But i want it in the order 1,2,6,3
2)I want to select items from a single list box to many other listboxes.(ie) my first selection should goto first,second one to the second listbox and like this.How should i write the logic.
please give me a suggestion.In order to have the selected items line up in accordance to the selection order, please do it one at a time. (That's the limit for that VI)
If you need more than that (i.e. to regconize which item clicked first and which one comes later), you may have to figure it out ya
Wish you good luck. Perhaps, someone else has a already made vi.
Cheers!
ian.f
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010
依恩与LabVIEW
LVVILIB.blogspot.com -
I recently bought this 27 " iMac used and he restored and whipped everything off of it. So i went to buy some stuff from apple store and it asked me to created apple id which i did. when i went to get the ilife items such as garage band iphot iMovie the button said accept. when i clicked it. it said the following ..
These apps were already assigned to another Apple ID, and they will be available in that Apple ID's Purchases list. If you don't have access to that Apple ID and want to receive future updates, you will need to purchase the applications.
Please let me know what to do to fix this issue and be able to purchase ilife 11 for this computerHi Lance ...
You can only re download the iLife apps using the same Apple ID they were purchased with.
See: Restoring iLife applications after Internet Restore of OS X Lion
here > Lion Recovery -
How to get the mail item opened window?
Hi,
I need to get the window of the opened mail.
Within the mailItem.Open() event tried to get the Application.ActiveExplorer() but it returns the main outlook window.
From the load of the addin tried as follows, but hwndSource always returns null.
activeWindow = _mailItem.Application.ActiveWindow()
((Microsoft.Office.Interop.Outlook.ExplorerEvents_10_Event)activeWindow).Deactivate += MyEvent
public void MyEvent()
System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcesses();
foreach (System.Diagnostics.Process process in processes)
if (process.MainWindowTitle.StartsWith (_mailItem.Subject))
IntPtr handle = process.MainWindowHandle;
System.Windows.Interop.HwndSource hwndSource = System.Windows.Interop.HwndSource.FromHwnd(handle);
System.Windows.Window window = hwndSource.RootVisual as System.Windows.Window;
Any suggestions to get the mail item opened window? Please help.
VS2010 C# with Outlook 2007.Hi Damian,
When the Open event is fired, the Inspector object
is initialized but not yet displayed.
You can handle the
NewInspector event of the Inspectors class which is fired whenever a new inspector window is
opened, either as a result of user action or through program code. Then the
Activate event of the Inspector class is fired, when an inspector becomes the active window,
either as a result of user action or through program code. -
FMs to get the order items list for an order template
Hello everyone,
I'm looking for sap FMs (or tables) to get the order items list for a given order template in CRM backend. Any advice/suggestions?
Thanks, JinHello Jin,
Function module CRM_ORDER_READ with either the Header GUID will give you everything about the order and you can optimize the call by limiting the sets you want to get in the export tables.
The item list (administration data) can be from ET_ORDERADM_I and the details about the products can be found from ET_PRODUCT_I
FYI, this will work for any transaction - Order, Quotation and of course Order Templates too.
Easwar Ram
http://www.parxlns.com -
Is there any report to get the header/item text at GR stage together?
Hi gurus,
Is there any report to get the header/item text at GR stage together with a date range?
at the point of goods receipt? Or a report that could be run to search for header/item text at GR stage together with a date range?
Text that was entered at the point of goods receipt?Hi
Check MB51 report with posting dates for materials/vendors and use the display variant document header text (which is GR header text). I hope this is the one you are looking for.
Thanks -
How to get the Clicked Item of a ListBox?
I need to get the clicked item of a listbox.
The item can be at first selected, when I click it again, it
automatically gets de-selected, but I want to get that item
whenever I click it. Any idea how to do this?
This line does not work, because it gets the selected item.
var pattern:String = event.currentTarget.selectedItem.myname;
This one must work,but something is missing.
Anyone can help me with this?
marks is my ArrayCollection;
var pattern:String =marks.getItemAt[??].myname;Here is my code. Am using this function in the itemclick
event of the ListBox.
My ListBox is a multi-select listbox. So am selecting several
items by pressing "Ctrl" key and selecting each item using click.
Say I have selected 4 items, when I press "Ctrl" and
de-select one of the items, I want to get the itemname of the
deselected item.
public function createMarksList(event:ListEvent):void{
// Alert.show(new
String(event.currentTarget.selectedItem.myname));
// var pattern:String =
event.currentTarget.selectedItem.myname;
// pattern = pattern += "," + pattern;
// text1.text = pattern;
<mx:List x="9" y="46" width="121" height="121"
id="lstMarks" allowMultipleSelection="true"
itemClick="createMarksList(event)"></mx:List>
So, your help is required here buddy.
I sitll can't figure out.
Thx -
I keep getting the "some items could not be found" error.
I keep getting the some items could not be found error for some podcasts I downloaded then deleted. Unfortunately, now, I can't get rid of the error message. So I'm trying to search for said podcast to re-delete the entry. And it's not there. And I can't find it anywhere else. How can I fix this?
Another user named Springbk posted a fix that worked for me as I was having the same problem today:
I Changed my DNS settings to OpenDNS
On a Mac go to SYSTEM PREFERENCES>NETWORK>ADVACED>DNS
change DNS by adding ( + )
208.67.222.222
then
208.67.220.220
click okay/apply after. then try the update. after the update, just delete the two open DNS server numbers. should revert back to your old one. -
Get the first item value of previous record in a multi record block
Hai,
I have a multi record block with four items.I should get the first item value of the previous record so that I can increment its value in the current record.
Thanks.........If you want a distinct value in each row or to be able to retrieve the records in the same order they were written then you should use a sequence.
If you want to retrieve the records in the same order they were created in the block then you will need a diffferent solution to the one you outline here since a user could enter a new record between two others.
I posted this a while back in response to someone who was using a sort_key item and resetting it for each row when a new record was inserted:
If you make the sort_key bigger then you have much more room to insert new rows in between existing rows without having to reset all the sort_keys.
Eg. you have rows with sort_keys of 129282000000000000 and 129283000000000000 (you can have more zeros if you want) and you want to insert a row in between. if you're using oracle forms then the user would have to click on the first of these rows and then do 'insert'. in your insert process you would store the sort keys of the current record and the one below, create a blank record in between and set the sort_key of that record to the average of the other two. you will be able to insert many new rows in between the original 2 before running out of space in the sort_key field.
the method above is not sufficient, there are some other cases to consider:
1) when the user is on the last record of the block then you will just create a new record with sort_key set to a greater number than the row before. you can have the sort_key defined as number(38) and to safely allow you to enter 1000 rows each new row would normally be 10E33 greater than the previous one.
2) when the user is entering the first record then just set the sort_key to 10E33.
3) on the off-chance that you do insert a great number of records and cannot insert another in between then you would need to alert the user, process the records so that the sort_keys are evenly spaced and requery the block. this processing could be scheduled nightly to make this eventuality even less likely.
4) make sure the user cannot run the default 'clear_record' procedure. this would break my method as well as yours!
James. -
Get the selected item in a dropdown
please how can in get the selected item in a dropdown ?
I am using t"his.selectedIndex" but it gives me just de index of the previous selected item, I am using the CHANGE event with javascriptI found the solution with xpa.event.newText
-
How can I get the checked item from a list that is generated automatically?
I am still pretty new a CF and could really use some help. I am trying to get each item that is checked from a page that generates the list automatically from a query and get the associated textbox text with it. For example:
<!--- Start Get Data Hierarchy List--->
<cfquery datasource="MyDatasource" name="qry_GetData">
SELECT C.taxonomy_id, C.lvl, C.taxonomy_name, C.taxonomy_tree, C.taxonomy_guid, C.taxonomy_standard_name
FROM dbo.taxonomy AS P
JOIN dbo.taxonomy AS C
ON P.taxonomy_id = 21
AND C.hid.IsDescendantOf(P.hid) = 1
AND C.lvl = 3
</cfquery>
<!--- Start Get Data Hierarchy List--->
<cfloop query="qry_GetData">
<input type="checkbox" name="cbox_PE_SelTax#taxonomy_id#" value="#taxonomy_name#"><font size="4" color="3399FF"> #taxonomy_name#</font>
<br />
- Details of experience with #taxonomy_name#:<input name="tbox_PE_SelTax#taxonomy_id#" id="tbox_PE_SelTax#taxonomy_id#" size="50%">
<br />
<br />
</cfloop>Dave,
Thank you for your help so far. I must not be asking the right question. Here is the whole breakdown. I am writing this page to collect the users information, Name, Title, Company, and technologies they are familiar with. I then want that information emailed to me upon submission. The point I am running into a problem (even with your last post) is how to write the action part of it that will email the checked items to me. I cannot figure out if I need to use CFLOOP (if so, how) or what the best method is. I am a very visual lerner and can understand how code works easily, but I have not found any examples for my situation. Again, I really appriciate all of your help thus far.
Thank you! -
So, I am making an application in which binds data from a WebClient to a ListBox. Thus, it is needed to understand that I did not create this data, it is from a Web API. So my goal is to be able to click on any of the items in the list box(which are binded
from a web API) and open a pop-up to display more data binded from that specific area.
Example:
The data has been loaded and I click on the 2nd item, well this item is a Metallica concert located in Russia blah blah.. ok, so I press it, it opens a pop up with more info like the date, location, etc...
Info:
I am binding the things in the lost box from and "events" statement, and I want the data in the list box in the pop up to display the selected child item, "event".
Zack BowlingSo are you storing that 'more info data' along with main data(i.e. that metallica concert etc.) somewhere in a List/observableCollection/database etc, if yes then probably it can be fetched directly from that collection.
e.g.
private void listBox_Tap(object sender, System.Windows.Input.GestureEventArgs e)
var Itemobj = (listboxname.SelectedItem) as ObjectClassname; string datevalue = Itemobj.date; string location = Itemobj.location;
//so using Itemobj you can fetch the properties you want as stored in ObjectClassname.
// Here ObjectClassname is the name of class storing the properties(setter-getter) for the parsed data.
http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8 -
How to get alias name of stored certificate from iKey token 2032
Hi All,
Below is my code woks well to use the same keypair for both encrypt/decryprt-SunPKCS#11 in SDK1.5. In my code i hard coded alias name of certificate, kindly tell me how to read alias name of certificate from iKey token 2032??
import java.io.*;
import java.util.*;
import java.lang.*;
import java.sql.*;
import java.text.*;
import java.math.*;
import java.security.*;
import java.security.cert.*;
import java.security.interfaces.*;
import javax.crypto.interfaces.*;
import javax.net.ssl.*;
import javax.crypto.*;
import javax.crypto.spec.DESKeySpec;
import java.security.KeyStore.*;
public class Encrypt
public Encrypt(){}
public void loginToken() {
Provider p = new sun.security.pkcs11.SunPKCS11(MQConfig.getvalue("SecurityPropertyPath"));
String myAlias = "349eefd1-845b-4ba4-9f88-06e9f5cb82f6";
/** to view alias name
keytool -list -v -keystore NONE -storetype PKCS11 -storepass PASSWORD
Security.addProvider(p);
KeyStore ks = null;
PrivateKey privKey = null;
PublicKey pubKey = null;
try{
String password = General.ReadFiles(MQConfig.getvalue("logFilePath"),"Simple");
password = password.trim();
char pin[] = password.toCharArray();
ks = KeyStore.getInstance("pkcs11");
ks.load(null,pin);
java.security.cert.Certificate cert = ks.getCertificate(myAlias);
Key key = ks.getKey(myAlias, pin);
if(PrivateKey.class.isInstance(key)) {
privKey = (PrivateKey)key;
pubKey = cert.getPublicKey();
FileInputStream in = new FileInputStream("C:\\ReportDBBE.properties");
FileOutputStream out = new FileOutputStream("C:\\ReportDBAE.properties");
Cipher cp=Cipher.getInstance("RSA/ECB/PKCS1Padding", p);
cp.init(cp.ENCRYPT_MODE,pubKey);
CipherOutputStream cout=new CipherOutputStream(out,cp);
byte[] input=new byte[8];
int byteread=in.read(input);
while(byteread!=-1){
cout.write(input,0,byteread);
byteread=in.read(input);
cout.flush();
in.close();
cout.close();
catch(NoSuchAlgorithmException nsae)
System.out.println("No Such Algorithm Exception " + nsae.getMessage());
catch(NoSuchPaddingException nspe)
System.out.println("No Such Padding Exception " + nspe.getMessage());
catch(InvalidKeyException ike)
System.out.println("Invalid Key Exception " + ike.getMessage());
ike.printStackTrace();
catch(IllegalStateException ise)
System.out.println("Illegal State Exception " + ise.getMessage());
catch(KeyStoreException kse)
System.out.println("Key Store Exception " + kse.getMessage());
catch(CertificateException ce)
System.out.println("Certificate Exception " + ce.getMessage());
catch(IOException ioe)
System.out.println("IO Exception " + ioe.getMessage());
catch(UnrecoverableKeyException unrke)
System.out.println("Unrecoverable Key Exception " + unrke.getMessage());
public static void main (String args[]) throws Exception {
try{
Encrypt tl = new Encrypt();
tl.loginToken();
}catch(Exception e){
e.printStackTrace();
Your help is very much appreciated!!!!Hi All,
Now i managed to get alias name.
char pin[] = password.toCharArray();
ks = KeyStore.getInstance("pkcs11");
ks.load(null,pin);
Enumeration ea = ks.aliases();
while(ea.hasMoreElements()) {
myAlias = (String)ea.nextElement();
} -
Getting host name and port number from application
Does anyone know how I would be able to get the host name
and port number from an application launched by java webstart ?
This is the host and port of the URL that this application is launched from.A couple of suggestions:
-The note is about 6.40. Doesn't fit for your server
-Don't!
-Reinstall!
Regards,
Benny -
Getting host name and port number from an application
Does anyone know how I would be able to get the host name
and port number from an application launched by java webstart ?
This is the host and port of the URL that this application is launched from.A couple of suggestions:
-The note is about 6.40. Doesn't fit for your server
-Don't!
-Reinstall!
Regards,
Benny
Maybe you are looking for
-
Service Desk: error in Sent to SAP configuration
Hi All, I am trying to confugure Send to SAP option in service desk solution manger 7.0 SPS 17. I am following SAP Note 1247502 for the same. But at the 3rd step i stucked as i am not getting method AISDK_SP_SEND_SAP in our solution manager system. 3
-
ISA user admin in CRM Productivity BP
Hello, We have deployed the Business Productivity Package for CRM on EP 6.0 S09 and am having some trouble connecting some of the iViews to our backend SAP CRM 4.0 instance. ISA is also installed on the same J2EE as the Portal as per an SAP note. I
-
Putting resultset Data into sql server 2000
hello, I have some trouble with putting my Date into the sql server. I'm very confused about this and gives me a lot of headage! This is my code: public void GenerateAlarms(StringBuffer alarmsLeft) throws Exception try statement = conn.createStatemen
-
HT4993 After updating to iOS 6.1.3 my mail apps will not open. Help!
My mail apps will not open the update. I have tried deleting my mail accounts and reinstalling, but still no luck.
-
Javax.smartcardio problem on linux SuSE
HI, i am trying to develop a simple applet in java, which should read data from a smartcard... But when i want to read the terminals: CardTerminal terminal = (CardTerminal)factory.terminals().get(0); the full method: CardTerminal terminal = (CardTerm