Keyevent used for setMnemonic show in editable jtextarea

I don't know if this has been fix. I notice that if I used the setMnemonic to access a editable jtextarea, that the key I used is inserted into the jtextarea. After searching the web, I found nothing about this problem.
So, I took the program from the java tutorial, MenuDemo.java and reproduct the same problem but setting the jtextarea to editable (output.setEditable(true). It happens everytime. Below is the MenuDemo.java with the change. By selecting t or b in the A Menu menu,then which ever t or b used will show up in the text area after the expected line displays. I am using 1.5 so this problem may have been fix.
If anyone knows if it has or a work around, please let me know.
Thanks
Kevin
import java.awt.*;
import java.awt.event.*;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.ButtonGroup;
import javax.swing.JMenuBar;
import javax.swing.KeyStroke;
import javax.swing.ImageIcon;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.JFrame;
* This class adds event handling to MenuLookDemo.
public class MenuDemo extends JFrame
implements ActionListener, ItemListener {
JTextArea output;
JScrollPane scrollPane;
String newline = "\n";
public MenuDemo() {
JMenuBar menuBar;
JMenu menu, submenu;
JMenuItem menuItem;
JRadioButtonMenuItem rbMenuItem;
JCheckBoxMenuItem cbMenuItem;
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
//Add regular components to the window, using the default BorderLayout.
Container contentPane = getContentPane();
output = new JTextArea(5, 30);
output.setEditable(true);
scrollPane = new JScrollPane(output);
contentPane.add(scrollPane, BorderLayout.CENTER);
//Create the menu bar.
menuBar = new JMenuBar();
setJMenuBar(menuBar);
//Build the first menu.
menu = new JMenu("A Menu");
menu.setMnemonic(KeyEvent.VK_A);
menu.getAccessibleContext().setAccessibleDescription(
"The only menu in this program that has menu items");
menuBar.add(menu);
//a group of JMenuItems
menuItem = new JMenuItem("A text-only menu item",
KeyEvent.VK_T);
//menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead
menuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_1, ActionEvent.ALT_MASK));
menuItem.getAccessibleContext().setAccessibleDescription(
"This doesn't really do anything");
menuItem.addActionListener(this);
menu.add(menuItem);
menuItem = new JMenuItem("Both text and icon",
new ImageIcon("images/middle.gif"));
menuItem.setMnemonic(KeyEvent.VK_B);
menuItem.addActionListener(this);
menu.add(menuItem);
menuItem = new JMenuItem(new ImageIcon("images/middle.gif"));
menuItem.setMnemonic(KeyEvent.VK_D);
menuItem.addActionListener(this);
menu.add(menuItem);
//a group of radio button menu items
menu.addSeparator();
ButtonGroup group = new ButtonGroup();
rbMenuItem = new JRadioButtonMenuItem("A radio button menu item");
rbMenuItem.setSelected(true);
rbMenuItem.setMnemonic(KeyEvent.VK_R);
group.add(rbMenuItem);
rbMenuItem.addActionListener(this);
menu.add(rbMenuItem);
rbMenuItem = new JRadioButtonMenuItem("Another one");
rbMenuItem.setMnemonic(KeyEvent.VK_O);
group.add(rbMenuItem);
rbMenuItem.addActionListener(this);
menu.add(rbMenuItem);
//a group of check box menu items
menu.addSeparator();
cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
cbMenuItem.setMnemonic(KeyEvent.VK_C);
cbMenuItem.addItemListener(this);
menu.add(cbMenuItem);
cbMenuItem = new JCheckBoxMenuItem("Another one");
cbMenuItem.setMnemonic(KeyEvent.VK_H);
cbMenuItem.addItemListener(this);
menu.add(cbMenuItem);
//a submenu
menu.addSeparator();
submenu = new JMenu("A submenu");
submenu.setMnemonic(KeyEvent.VK_S);
menuItem = new JMenuItem("An item in the submenu");
menuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_2, ActionEvent.ALT_MASK));
menuItem.addActionListener(this);
submenu.add(menuItem);
menuItem = new JMenuItem("Another item");
menuItem.addActionListener(this);
submenu.add(menuItem);
menu.add(submenu);
//Build second menu in the menu bar.
menu = new JMenu("Another Menu");
menu.setMnemonic(KeyEvent.VK_N);
menu.getAccessibleContext().setAccessibleDescription(
"This menu does nothing");
menuBar.add(menu);
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);
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);
// Returns just the class name -- no package info.
protected String getClassName(Object o) {
String classString = o.getClass().getName();
int dotIndex = classString.lastIndexOf(".");
return classString.substring(dotIndex+1);
public static void main(String[] args) {
MenuDemo window = new MenuDemo();
window.setTitle("MenuDemo");
window.setSize(450, 260);
window.setVisible(true);

Yes your are correct. I forgot why I went to 1.5 but until better time come along and I can get a new computer, I will have to live with 1.4.2._06. But, it did fit my problem.

Similar Messages

  • Why does the font used for iTunes show as an outline?

    I cannot get the font used for iTunes to change from an outline. I am using Suitcase Fusion and have turned on and off the Office fonts etc.

    Try this: Go to Control Panel, Fonts.
    On the left pane click "Font settings" > uncehck "Hide fonts based on language settings" > Click "Ok" at the bottom. Restart you computer just to be sure the setting went through. See if that helps.

  • IPhoto user looking for a bit more editing ability

    I love iPhoto but I wish I could extract parts of pictures to go on other pics. Then I use a cloning tool to fix. I can't stand Adobe Elements is their any other program out their that people are using for this kind of editing. Aperture?

    matbran
    I don't think that Aperture is what you're looking for. Try Graphic Convertor
    http://www.lemkesoft.com/en/index.htm
    or try searching on http://www.macupdate.com using 'image editor'.
    Regards
    TD

  • Which listener should be used for JTextArea

    Hi,
    I need to add a listener for JTextArea particualy when
    the text in the jtextarea is changed. I don't think
    mouse listener is enough, since the user can use tab to
    get to the jtextarea and edit the text. In this case,
    which listener should I use. Sample code would be
    helpful.
    In addition, I have a problem with the jtextarea that
    when user uses tab to go to different gui components,
    such as jtextfield, jcombobox, jtextarea, jlist, etc, the
    tab stays in the jtextarea and keeps appending to it. It does
    not go to next component, such as jlist. How can I make it
    work?
    Thanks in advance,
    Pin

    It doesn't work. Are you using 1.4 or 1.3? I am using
    1.4.
    In the 1.4 API, it says that isManagingFocus is
    "Deprecated".
    Here is what I have:
    JTextArea descrptArea = new JTextArea() {
    public boolean isManagingFocus() {
    return false;
    descrptArea.setRows(3);
    descrptArea.setLineWrap(true);
    descrptArea.addKeyListener(new KeyAdapter() {
    public void keyTyped(KeyEvent e) {
    // DO SOMETHING
    I found the following code which says it will do it.
    However, I got the exeception:
    java.lang.ClassCastException:
    n: javax.swing.KeyStroke
    at java.util.TreeMap.compare(TreeMap.java:1081)
    at java.util.TreeMap.put(TreeMap.java:459)
    at java.util.TreeSet.add(TreeSet.java:205)
    Set forwardTraversalKeys = new TreeSet();
    forwardTraversalKeys.add(KeyStroke.getKeyStroke('\t'));
    forwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEven
    .VK_TAB,
    InputEvent.CTRL_MASK));
    textArea.setFocusTraversalKeys
    (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
    forwardTraversalKeys);
    Set backwardTraversalKeys = new TreeSet();
    backwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEve
    t.VK_TAB,
    InputEvent.SHIFT_MASK));
    backwardTraversalKeys.add(KeyStroke.getKeyStroke(KeyEve
    t.VK_TAB,
    InputEvent.SHIFT_MASK |InputEvent.CTRL_MASK));
    textArea.setFocusTraversalKeys(
    KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
    backwardTraversalKeys);
    Any idea???
    PinI'm not using 1.4 but the class cast exceptions look like they come from : Set forwardTraversalKeys=new TreeSet() etc
    try : TreeSet forwardTraversalKeys=new TreeSet()
    you cant cast from a Set to a TreeSet because a TreeSet is a Set but a Set is NOT a TreeSet.
    hope this helps.

  • Using downloaded songs for slide show background music

    Maybe I am naive, but I just joined iTunes and downloaded some music to use as background for slide shows of family pics. I am using Microsoft Plus! to put the slide shows together. The iTunes songs downloaded in MPEG-4 and the Plus! code will only recognize MP3. I am also concerned that the copyright protection will make the songs not useable for the slide show compilations. Any ideas? Thanks!

    In iTUnes you can burn the song to CD then reimport it as a MP3. Goto edit>preferences>advanced tab>Import sub tab, and set it from "AAC" to "MP3" then hit OK
    Now burn the songs to CD in itunes. Put the CD back in and hit the "Import" button in the top right corner of itunes

  • Can you use the Vocal Transformer for Live Show?

    Can you use the Vocal Transformer for Live Show? I have automations set up in my vocal track using the vocal transformer and would like my vocals to adjust accordingly while performing live. Is this possible to configure and if so, how do I set it up at the venue?

    Vocal Transformer opens in MainStage. All controls in VT are visible & editable in MS. Don't set it up at the venue. Set it up in one or more patches before you leave your house. You will need up to twelve sliders or knobs plus one or two buttons on your controller to get the most out of it.

  • Editing/adding track info for tv shows and movies in iTunes 12.1 for Mac.  Does anyone know how to do this?

    iTunes 12.1.0.50
    late 2012 iMac running OS X 10.10.2
    I can no longer edit or add the track information for tv shows and movies.  If, for example, there are 26 episodes of a tv show in a season and I want to edit their entries in iTunes to reflect 1 of 26, 2 of 26, 3 of 26, and so on, how do I do that?  With the 12.1 update, they took away the old info box.  Very irritating.

    JNLong2811 wrote:
    The use of the right clicking while holding down the Option key for the "old" info box worked through iTunes 12, but when 12.1 came out, that option went away.
    So edit the info with a proper tag editor (before you even add it to iTunes).
    Use -> MetaZ and/or -> Subler to edit movies/TV shows.

  • Isn't there an easier way for iPhoto to show (Photoshop) edited RAW photos?

    Hi fellow Apple community members, below is a (very) detailed description of my problem>
    Once I'm done shooting with my Canon DSLR i auto-import my pics into iPhoto '11.
    My pics are shot in RAW format.
    I have Photoshop CS6 set as my default image editor via iPhoto.
    Once my image is edited via Photoshop i then save the image with two different methods:
    i use the "save image..." button in the Camera RAW editing window and proceed to save the image in the same location and the same as the original name in the iPhoto directory.
    The second method is to open the image as a non "Smart Object" file then proceed to save the image as a JPEG via "Save As", also in the same the location and file name as the original
    The problem is once i've done the saving of the file. iPhoto doesn't show edits done to the original photo or even show a edited copy.
    I CAN locate the edited images via the route directory within iPhoto's Finder menus.
    So i assumed if i imported those edited copies it would then show in iPhoto but no cigar - A error message pops up: "The following file could not be imported . The file is in the iPhoto Library."
    I then re-locate the edit files to another location, then import it into iPhoto and only then does it shows up in iPhoto - successfully edited.
    So my question would be...isn't there a better or easier way for iPhoto to show your edited photos without having to jump through so many hoops?

    There is no solution to this - and the same problem arises with Aperture too. The question to ask yourself is which Raw processor you want to use and then your Photos go there first.
    As Larry says, iPhoto is pretty much pointed at the shooter with a point and shoot or phone who takes snaps to share with family and friends. Pros or serious hobbyits, people shooting large volumes, people shooting Raw migrate to the more powerful apps sooner or later.
    Going forward, I would suggest that you explore apps like Lightroom and Aperture which make the Raw processing - and many other - element of Photoshop redundant. While iPhoto uses the same processing engine as Aperture it has less fine control. Photoshop for the photographer is on the way out. It's too expensive, most of its features are aimed at graphic artists rather than shooters. The future for Photographers is apps like Aperture, Lightroom with something like Elements for the odd touchups that these apps can't manage.

  • IPad Air iOS8.0.2. I used the photos app to edit my photos and created a new album for them. When I transfer my photos to my PC via cable (not allowed to use cloud services by my boss) i can only transfer the unedited versions. Any tips? Thanks!

    iPad Air iOS8.0.2. I used the photos app to edit my photos and created a new album for them. When I transfer my photos to my PC via cable (not allowed to use cloud services by my boss) I cannot choose this edited album, only transfer the unedited versions. Any tips? Thanks!

    Hi Anjohi,
    Thanks for visiting Apple Support Communities.
    If you've edited photos on your iPad and only see the original version when you import them to your computer, the tips in this article may help:
    iOS: Edited photos show original photo after import or in other apps
    All the best,
    Jeremy

  • What format should I use for new  FCP slide show to DVD project?

    I want to edit a slide show movie. I have all of the high resolution images. I plan on authoring the project to DVD 16:9 anamorphic with DVD SP. Later I would like to author to 1920 x 1080 HD on Blu-Ray. ( I can't afford Adobe BR authoring software at this time, I want to start with the DVD) I am looking for advice. I want the quality of DVD and future Blu-Ray to be best possible quality. I'm thinking there are two options I might use:
    1. Edit the FCP project in HD 1920 x 1080. Use Compressor to convert the sequence to 16:9 anamorphic for DVD SP input. I am thinking I will have the HD sequence ready for the Blu Ray in the future. I like this approach. Is the conversion possible with compressor? What exact format and frame rate should I use for the FCP project?
    2. Edit the FCP project in 16:9 Anamorphic. Compress for DVD SP input. I am not fond of this option. I don't look forward to making rectangular pixel images in Photoshop for one. That will be a lot of work for this project. I won't have an HD sequence ready for Blu Ray in future, I will have to start a new project from scratch to make the HD version.
    Thanks in advance for any advice!

    Edit in a 1920x1080/30p Pro Res sequence settings.
    Export that to a self contained movie current settings, and use which ever SD DVD preset to encode for use in DVD SP.
    The self contained movie can eventually be used in Adobe Encore for blu ray authoring.
    But having "high resolution" images/photos means nothing in video.
    1 dpi is sufficient at 1920x1080 unless you plan to pan and zoom, in which case double the pixel size, not the dpi.
    300 dpi produces no better image than 1 dpi.

  • When I bootup the icon for Elements shows up in orange.  It changes to green only when I've gone to Finder and clicked on Elelments under the Devices list.  This is a recent development.  The icon used to be green upon bootup.  Does anyone know why ?

    When I bootup the icon for Elements shows up in orange.  It changes to green only when I've gone to Finder and clicked on Elelments under the Devices list.  This is a recent development.  The icon used to be green upon bootup.  Does anyone know why ?

    I'm sorry to hear that.
    I'm not affiliated w/ the developer, just a happy user that gave up fighting the apple podcast app a while ago.  I used to have a bunch of smart playlists in itunes for my podcasts, and come home every day and pathologically synced my phone as soon as I walked in the door, and again before I walked out the door in the morning.
    Since my wife was doing this too, we were fighting over who's turn it was to sync their phone.
    Since I've switched to Downcast, I no longer worry about syncing my phone to itunes at all.  I can go weeks between syncs.
    Setup a "playlist" in downcast (ex., "Commute") and add podcasts to that playlist.  Add another playlist ("walk" or "workout") and add different podcasts to that one. 
    Set podcast priorities on a per-feed basis (ex., high priority for some daily news feeds, medium priority for some favorite podcasts, lower priority for other stuff).  Downcast will play the things in the priority you specify, and within that priority, it will play in date order (oldest to newest).
    Allegedly, it will also sync your play status to other devices, although that is not a feature I currently use and can't vouch for.  It uses apple's iCloud APIs, so to some extent may be limited by what Apple's APIs can do.

  • My iPhone 4s keeps showing more space being used for photos than i have - i have deleted cache folders, unselect and reselect in iTunes and nothing appears to work my iPhone still shows 6.5 gig use of photos when i only have the  camera roll listed

    my iPhone 4s keeps showing more space being used for photos than i have -
    i have deleted cache folders, unselect and reselect in iTunes I read one post
    where they said keep syncing and in a couple days it would correct itself, that
    hasnt happened.  I have see others have the same issue but no solution and nothing
    appears to work my iPhone still shows 6.5 gig use of photos when i only have the camera roll listed

    i thought the photo stream only holds 1000 i usuaaly take each month and save them to iphoto but if thats the my ipad should say the same amount and it doesnt - it shows 2.5 gig which is correct for iphoto.  and i havent ever had that much but if for some reason icloud has that much saved how do i delete and again if it does why doesnt ipad show that amount _ HELP!

  • How to make a photo STAY in the assets panel for future use for In browser editing?

    How to make a photo STAY in the assets panel for future use for In browser editing?
    When I delete a photo from a page, it does not stay in the assets panel. My client uses in browser editing daily. Once a week he changes a photo just for a day, then needs the previous photo to replace it. The original photo is not in the asset panel (or folder) for him to choose.
    When you upload a photo, it has an arrow in the asset panel. How do you use this as an asset?

    Sure ... right mouse click on  your page and choose 'Exclude Page from Menus' :-)

  • HT4972 My IPad 2, IPhone 3GS ans iPod  no longer work with apple TV, I have 2 apple TV in my house and for he last 3 weeks the iPod was the only one we could use for appleTV now none of them works, the apple TV icon does not show up any more. Re-startedev

    My IPad 2, IPhone 3GS ans iPod  no longer work with apple TV, I have 2 apple TV in my house and for he last 3 weeks the iPod was the only one we could use for appleTV now none of them works, the apple TV icon does not show up any more. Re-started everything.

    Ok thank you so much, for your timely response.
    RESPONSES:
    1)   When I set up my iMac, I did not transfer any data directly from my windows PC.  I simply used the same iTunes login and account.  I have access to all of the files via the "Purchased" section of the iTunes store.  If I click "Download Previous Purchases"  text, I can download ALL of the purchases I have ever made.
    2)   I have the Apple TV 2, so good news, question answered.  I thought maybe it was the Apple TV 1, but it is the Black model, so bam.  Good response for you.  Well the whole damned reply is an awesome response, just pointing out that one piece of awesome.  I stated that it was an Apple TV 2, and yet you were still good enough to figure I could be mistaken, and provide me with knowleedge just incase.
    QUESTIONS:
    3)   So can my iMac not stream the data directly from itunes, without download?  Apple TV can, but perhaps that is something among many things that maker it unique, and awesome.
    SERIOUSLY.... THANK YOU... 
    I work in the computer support section for the Military.  The only problem is we use Windows , lol.  Well that and i've been gone for nearly 6 months on recover.  I go back next month though I hope.  But working in that field gives me the abilty to judge responses that run inside the same vein.  Your response was so awesome that I half thought I might have written it myself. 

  • I recently moved and had to disconnect my WD My Pro Edition II 2TB external drive I had been using for backup.  Its been several months and now when i try to reconnect the external dire (Use a firewire cable) it does not recognize the drive is there.  I a

    I recently moved and had to disconnect my WD My Pro Edition II 2TB external drive I had been using for backup. 
    Its been several months (many upgrades to the iMac software during this time), and now when I try to reconnect the external dire (Use a firewire cable) it does not recognize the drive is there.  I also tried "reloading" software from the Western Digital site, but after following all the instructions, it looks like my iMac doesn't support this software (I can't even locate it after I follow all the instructions.
    Thnaks,  for anyones ideas on how I can get this working again.....

    First of all, you do not really want to use their software; if you want a bootable clone, use either Carbon Copy Cloner or SuperDuper. If you simply want to drag and drop some files, you don't need software to do that. The important thing on any external drive is that you format/partition it correctly (Mac OS Extended (Journaled) and using GUID partition scheme). 
    Unfortunately, I don't know anything about WD drives or their software, so I don't have any idea what kind of backup you did. Having said that, it should still recognize the external even if it's outdated. Have you tried mounting it manually in Disk Utility? If you can get it to mount, you could (worst case scenario) just drag your stuff off onto your internal and then reformat the external.

Maybe you are looking for