JMenu ACCELERATOR_KEY "control I"

I'm adding some accelerators to my application and I've spent ages trying to make it work
only to find that the problem seems to be my choice of accelerator !
"control O" works.
"control I" shows up in the menu but doesn't actually do anything.
It's not related to the strings I used because
KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK );fails too !
Can anyone shed some light on this ?

Believe it or not I did try searching on various different flavours of keywords but I didn't find
the article that you did !
Thanks for your help - perhaps if you can give me the exact string you searched for it might
help me in the future !?!?

Similar Messages

  • JCheckBox to JMenu (no ACCELERATOR_KEY shown)

    Hi,
    i have a ActionClass created with this value:
    putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('S', Event.CTRL_MASK, false));If i add this action to JMenu, the accelerator info is shown in the menu and can be used:
    boardMenu.add(showSolutionAction);But if create a JCheckbox with my ActionClass, the accelerator isn't shown and isn't working.
    JCheckBox solutionCheckbox = new JCheckBox(showSolutionAction);
    boardMenu.add(solutionCheckbox);I'm working with Java6b2, but i think it's the same with Java5.
    I think it's an unwanted behavior. What do you think?
    Does someone knows a workaround?
    Cheers,
    Ingo

    I think it's an unwanted behavior. What do you think? I think its desireable behaviour.
    When using a JCheckBox the user already has a visible clue on how to invoke the button if you use a mnemonic. There is no visual clue if you set an accelerator, so how does the user know what the accelerator is.
    Does someone knows a workaround?Two solutions:
    a) JMenuItem overrides the configurePropertiesFromAction() method to specifically set the accelerator. So you can extend JCheckBox to add the same logic:
        protected void configurePropertiesFromAction(Action a) {
            super.configurePropertiesFromAction(a);
            KeyStroke ks = (a==null) ? null :
                (KeyStroke)a.getValue(Action.ACCELERATOR_KEY);
            setAccelerator(ks==null ? null : ks);
        }b) Set the accelerator yourself when you create the check box:
    JCheckBox checkbox = new JCheckBox(action);
    checkbox.setAccelerator(  (KeyStroke)action.getValue(Action.ACCELERATOR_KEY) );

  • How to set JMenu/JMenuItem.accelerator property in Inspector

    How do you set an accelerator key through the accelerator
    property in the inspector for a JMenu or JMenuItem object? The
    list box contains one item, "<none>". Does one have to create
    some special keyboard shotcut objects that then will be added to
    the list?
    Where can one find documentation for the Swing classes, as far
    as I can see it's not included?
    Thanks.
    Finn Ellebaek Nielsen
    ChangeGroup ApS
    null

    I know how to do it in the code but it must be possible to do it
    from the Inspector since the property is listed there?
    Thanks.
    Finn
    JDeveloper Team (guest) wrote:
    : Finn,
    : I would check the Swing documentation available from the
    Javasoft
    : website for more information on these controls.
    : -L
    : Finn Ellebaek Nielsen (guest) wrote:
    : : How do you set an accelerator key through the accelerator
    : : property in the inspector for a JMenu or JMenuItem object?
    The
    : : list box contains one item, "<none>". Does one have to
    create
    : : some special keyboard shotcut objects that then will be
    added
    : to
    : : the list?
    : : Where can one find documentation for the Swing classes, as
    far
    : : as I can see it's not included?
    : : Thanks.
    : : Finn Ellebaek Nielsen
    : : ChangeGroup ApS
    null

  • JMenu Mnemonic in  JApplet not working

    Hi,
    Here is a code in my JApplet, but some how the Mnemonic is not working,
    why??
    I m using jdk1.4.1
    Ashish
    import javax.swing.text.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.text.*;
    import java.awt.*;
    import java.math.*;
    import javax.accessibility.*;
    public class TestMenuApplet extends JApplet
         public void init()
    buildMenu();
         private void buildMenu()
         JMenuBar menuBar = new JMenuBar();
    JMenu file = new JMenu("File", true);
    JMenu format = new JMenu("Format", true);     
    file.setMnemonic(KeyEvent.VK_F);
    format.setMnemonic(KeyEvent.VK_O);
    JMenuItem back = new JMenuItem("Back");
    JMenuItem close = new JMenuItem("Close");
    JRadioButtonMenuItem single =
    new JRadioButtonMenuItem("Single");
    JRadioButtonMenuItem multi =
    new JRadioButtonMenuItem("Multiple", true);
         ButtonGroup row = new ButtonGroup();
         row.add(single);
         row.add(multi);
    JMenu monthly = new JMenu("Monthly");
    JMenuItem one = new JMenuItem("One", KeyEvent.VK_O);
    JMenuItem two = new JMenuItem("Two");
    JMenuItem test = new JMenuItem("Test");
    menuBar.add(file);
    menuBar.add(format);
    file.add(back);
    file.add(close);
    format.add(single);
    format.add(multi);
    format.addSeparator();
    format.add(monthly);
    format.add(test);
    monthly.add(one);
    monthly.add(two);
    this.setJMenuBar(menuBar);
    My HTML
    <html>
    <HEAD>
    <TITLE>test</title>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="-1">
    </HEAD>
    <BODY >
    This is testing of applet
    <br>
    <!--"CONVERTED_APPLET"-->
    <!-- HTML CONVERTER -->
    <OBJECT
    classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = "300" HEIGHT = "300"
    codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-win.cab#Version=1,4,0,0">
    <PARAM NAME = CODE VALUE = "TestMenuApplet.class" >
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">
    <PARAM NAME="scriptable" VALUE="false">
    <COMMENT>
         <EMBED
    type="application/x-java-applet;version=1.4"
    CODE = "TestMenuApplet.class"
    WIDTH = "300"
    HEIGHT = "300"
    scriptable=false
         pluginspage="http://java.sun.com/products/plugin/index.html#download">
         <NOEMBED>
              </NOEMBED>
         </EMBED>
    </COMMENT>
    </OBJECT>
    <!--
    <APPLET CODE = "TestMenuApplet.class"
    WIDTH = "300"
    HEIGHT = "300"
    </APPLET>
    -->
    <!--"END_CONVERTED_APPLET"-->
    </BODY>
    </html>

    Did you convert your html code to call the sun VM instead of the default browser VM ?
    Use the HtmlConverter.exe to do this passing the html file in argument.
    Denis

  • How do I force JMenu not to open but to forward the click

    Hi!
    I'm working on a swing application. To control it I use a JMenuBar as a container which contains several JMenu items. I do not use JMenuItems at all!
    When I click on such a JMenu the click is forwarded using a MenuListener - that all works without any problem.
    When I click on one of those items it is activated just like I would use a submenu with it. Just like clicking on "File" at regular applications and moving the mouse in a horizontal way I can just by moving the mouse using the other JMenu's. I don't want that, I just want to click them without them to become marked or activated in a way!
    How can I change that?
    Thank you in advance!

    Just like
    clicking on "File" at regular applications and moving
    the mouse in a horizontal way I can just by moving
    the mouse using the other JMenu's. I'm not sure I understand just exactly what you mean by this. Do you mean that when you click on the File menu,
    and by moving the mouse across the menu bar, the other menus are activated (focus given to the menu over
    which the mouse hovers)?
    Is this what you are referring to?
    Reformer!

  • Adding ActionListener to JMenu

    Is it possible to add actionListener to Jmenu object
    for example File, Format, Exit these are Menus added in the menuBar not menu items
    on clicking the Exit the frame shuld get closed.
    For detecting the action clicked on the Menu shall i use actionListener?
    I have tried using MenuListener its getting invoked on selection
    I dont want it on selection , I want the frame to be displayed only on clicking that menu.

    Alas, whilst a JMenu is-a JMenuItem (the Composite Pattern at work), it doesn't function entriely like on,
    and registering ActionListeners with a JMenu doesn't work. Try MenuListener:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class ActionExample {
        public static void main(String[] args) {
            Action sample = new SampleAction();
            JMenu menu = new JMenu("Menu");
            menu.setMnemonic(KeyEvent.VK_M);
            menu.add(sample);
            menu.addMenuListener(new SampleMenuListener());
            JToolBar tb = new JToolBar();
            tb.add(sample);
            JTextField field = new JTextField(10);
            field.setAction(sample);
            JFrame f = new JFrame("ActionExample");
            JMenuBar mb = new JMenuBar();
            mb.add(menu);
            f.setJMenuBar(mb);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(tb, BorderLayout.NORTH);
            f.getContentPane().add(field, BorderLayout.SOUTH);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    class SampleMenuListener implements MenuListener {
        public void menuSelected(MenuEvent e) {
            System.out.println("menuSelected");
        public void menuDeselected(MenuEvent e) {
            System.out.println("menuDeelected");
        public void menuCanceled(MenuEvent e) {
            System.out.println("menuCanceled");
    class SampleAction extends AbstractAction {
        public SampleAction() {
            super("Sample");
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("alt S"));
            putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_S));
            putValue(SHORT_DESCRIPTION, "Just a sample action");
        public void actionPerformed(ActionEvent evt) {
            System.out.println("sample...");
    }

  • JMenu, passing mnemonic/ keyevent

    Hi
    Im building a JMenu but as it has many items im using a function to make each JMenuItem. The function calls the JMenu constructor with the text and the image to be used. I want to pass the mnemonic but can't work out how to do it.
    //example of function call
    menu1.add(add("myText","myPic.gif"));
    //what i need to send to function
    menuItem.setMnemonic(KeyEvent.VK_T);also is it possible to do the same with accelerators, ie pass this info to the function
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.ALT_MASK));thanks

    Okay, it's still not clear to me what you're trying it write, but is it a method like the following?
    import java.awt.event.*;
    import java.net.*;
    import javax.swing.*;
    public class Blank implements ActionListener {
        static JMenuItem add(JMenu menu, ActionListener al, String text, int mnemonic, String keyStoke, String iconURL) {
            JMenuItem item = new JMenuItem(text);
            if (al != null)
                item.addActionListener(al);
            if (mnemonic != 0)
                item.setMnemonic(mnemonic);
            if (keyStoke != null)
                item.setAccelerator(KeyStroke.getKeyStroke(keyStoke));
            try {
                if (iconURL != null)
                    item.setIcon(new ImageIcon(new URL(iconURL)));
            } catch (MalformedURLException e) {
                e.printStackTrace();
            return menu.add(item);
        public void actionPerformed(ActionEvent evt) {
            System.out.println("your code here");
        public static void main(String[] args) {
            JMenuBar mb = new JMenuBar();
            JMenu menu = new JMenu("menu");
            add(menu, new Blank(), "blank", KeyEvent.VK_K, "control B", "http://forum.java.sun.com/im/ic_eye.gif");
            add(menu, null, "zip", 0, null, null);
            mb.add(menu);
            final JFrame f = new JFrame("Blank");
            f.setJMenuBar(mb);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.pack();
            SwingUtilities.invokeLater(new Runnable(){
                public void run() {
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }

  • JMenu.setDelay()

    Has anyone used JMenu.setDelay() ?
    The documentation says: "Sets the suggested delay before the menu's PopupMenu is popped up or down." and then goes on to talk about different UI implementations. We are using a derivitive of the metal look & feel on Windows 2000 and XP.
    I was hoping that this control would also slow down the opening and closing of submenus. I do seem to get an open delay when I move the mouse down the parent menu (although I don't appear to be able to set the duration of that delay), but the submenu closes immediately my mouse passes beyond the current parent item.

    I was hoping that this control would also slow down the opening and closing of submenus.When the documentation says "pop up or down" it means that when the menu is displayed it will normally "pop down", but if there is not enough room at the bottom of the frame then it will "pop up". It is not referring to the closing of the menu. Therefore the behaviour is working according to the documentation when I tested it.
    I do seem to get an open delay when I move the mouse down the
    parent menu (although I don't appear to be able to set the duration of that delay), The delay worked fine for me.
    I tested using JDK1.4.2 on XP.

  • JMenu Disappearing  into Background

    Hi there,
    I just have a problem with my JMenu Disappearing into the background after I load an image using JAI. The Menu is there to begin with, but after I open a picture it disappears behind the picture and I cannot seem to find a way to get it to be at the front for further usage.
    Here is my code for the simple application
    import javax.media.jai.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import javax.media.jai.widget.ScrollingImagePanel;
    @SuppressWarnings("deprecation")
    public class ImageViewer implements ActionListener {
         // Core GUI items
         private JFrame f = new JFrame();
         private JPanel topPanel = new JPanel();
         private JPanel imagePanel = new JPanel();
         private JPanel buttonPanel = new JPanel();
         private JButton zIn = new JButton("Zoom In");
         private JButton zOut = new JButton("Zoom Out");
         // JAI Items
         private File mediaFile;
         private PlanarImage img;
         // Constructor for ImageViewer
         public ImageViewer() {
              // Attributes of the Main JFrame
              f.setTitle("JAI ImageViewer");
              // f.setLocation(100,100);
              Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
              f.setSize(dim.width, dim.height - 40);
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // Add the JPanels
              f.add(topPanel, BorderLayout.NORTH);
              f.add(imagePanel, BorderLayout.CENTER);
              f.add(buttonPanel, BorderLayout.SOUTH);
              // Just a simple label for the middle bit
              imagePanel.add(new JLabel(
                        "Please select an Image to open from the File Menu"),
                        BorderLayout.CENTER);
              // Method to create the menu bar
              createMenuBar();
              // Method to create the bottom panel
              createBottomBar();
              f.setVisible(true);
         // Method to create the top menu bar
         private void createMenuBar() {
              // Menu Bar holder
              JMenuBar bar = new JMenuBar();
              // File Menu Items
              JMenu file = new JMenu("File");
              JMenuItem fileOpen = new JMenuItem("Open");
              JMenuItem fileExit = new JMenuItem("Exit");
              file.add(fileOpen);
              file.addSeparator();
              file.add(fileExit);
              bar.add(file);
              // ActionListeners for the File menu
              fileExit.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        f.dispose();
              // Choose a file
              fileOpen.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        JFileChooser fc = new JFileChooser();
                        int returnVal = fc.showOpenDialog(imagePanel);
                        if (returnVal == 0) {
                             mediaFile = fc.getSelectedFile();
                             String testType = mediaFile.toString();
                             // Test for type
                             boolean isCorrectType = false;
                             if (testType.endsWith("jpg") || testType.endsWith("gif"))
                                  isCorrectType = true;
                             if (!isCorrectType) {
                                  JOptionPane
                                            .showMessageDialog(
                                                      null,
                                                      "That is an unsupported File Type\nPlease choose another",
                                                      "Error", JOptionPane.ERROR_MESSAGE);
                                  return;
                        createImageDisplay();
              // Add a Control Panel Menu
              JMenu controlPanel = new JMenu("Control Panel");
              JMenuItem zoomIn = new JMenuItem("Zoom In");
              JMenuItem zoomOut = new JMenuItem("Zoom Out");
              controlPanel.add(zoomIn);
              controlPanel.add(zoomOut);
              zoomIn.addActionListener(this);
              zoomOut.addActionListener(this);
              bar.add(controlPanel);
              topPanel.setLayout(new GridLayout(1, 1));
              topPanel.add(bar);
         // Method to create the bottom panel
         private void createBottomBar() {
              buttonPanel.setLayout(new FlowLayout());
              buttonPanel.add(zIn);
              buttonPanel.add(zOut);
              zIn.addActionListener(this);
              zOut.addActionListener(this);
         // Create Image Display after file is chosen
         private void createImageDisplay() {
              try {
                   img = JAI.create("fileload", mediaFile.toString());
              } catch (Exception e) {
                   JOptionPane.showMessageDialog(null, "Exception", "Error",
                             JOptionPane.ERROR_MESSAGE);
                   e.printStackTrace();
              imagePanel.add(new ScrollingImagePanel(img, imagePanel.getWidth(),
                        imagePanel.getHeight()));
         // ActionListener just for the Zoom in / Zoom out buttons
         public void actionPerformed(ActionEvent e) {
              if (e.getActionCommand().equals("Zoom In")) {
                   JOptionPane.showMessageDialog(null, "Zoom In");
              if (e.getActionCommand().equals("Zoom Out")) {
                   JOptionPane.showMessageDialog(null, "Zoom Out");
         // Start of the application
         public static void main(String args[]) {
              new ImageViewer();
    }Any help would be great as this is just annoying the pants off me.
    Thanks
    Tyson

    Mixing heavy and light components
    db

  • JMenu hidden unde JPanel

    Hi,
    I write same simple application, and I have problem with a JMenu. When I make simple JMenu, and add it to this application, menu this will be hiden under JPanel and other controls...
    Here id code:
    Hi,
    I write same simple application, and I have problem with a JMenu. When I make simple JMenu, and add it to this application, menu this will be hiden under JPanel and other controls...
    Here id code:
    package pl.staniszczak.JFakturka.GUI;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.GridLayout;
    import java.awt.Panel;
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFormattedTextField;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JScrollPane;
    import javax.swing.JSpinner;
    import javax.swing.JTable;
    import javax.swing.JTextField;
    import pl.staniszczak.JFakturka.GUI.Actions.DrukujFaktureAction;
    import pl.staniszczak.JFakturka.GUI.Models.TowaryATModel;
    * @author Administrator
    public class MainFrame extends JFrame {
         private JTextField jtfNrFaktury;
         private JFormattedTextField jftfDataSprzedazy;
         private JFormattedTextField jftfDataFaktury;
         private JComboBox jcbPlatnosc;
         private JSpinner jsTerminPlatnosci;
         private JTextField jtfUwagi;
         private JTable jtTowary;
         private JButton jbDodajTowar;
         private JButton jbUsunTowar;
         public MainFrame() {
              setTitle("JFakturka 1.0");
              setResizable(false);
              setSize(450,400);
           * Menus
            JMenu menuFaktura = new JMenu("Faktura");
            JMenuItem drukuj = menuFaktura.add(new DrukujFaktureAction("Drukuj"));
            JMenuBar menuBar = new JMenuBar();
            setJMenuBar(menuBar);
            menuBar.add(menuFaktura);
             * Uk&#322;ad komponent�w
              //g&#322;�wny layout
              GridLayout gridLayout = new GridLayout(2,1);
              getContentPane().setLayout(gridLayout);
              //layout na kompionenty tekstowe
              Panel pnlText = new Panel();
              GridBagLayout gblLayout = new GridBagLayout();
            GridBagConstraints constraints = new GridBagConstraints();
            constraints.anchor = GridBagConstraints.WEST;
              pnlText.setLayout(gblLayout);
              add(pnlText);
            * Komponenty
              //Numer faktury
            JLabel jlblNrFaktury = new JLabel("Numer Faktury");
            buildConstraints(constraints, 0,0,1,1,100,100);
            gblLayout.setConstraints(jlblNrFaktury, constraints);
            pnlText.add(jlblNrFaktury);
            jtfNrFaktury = new JTextField(25);
            buildConstraints(constraints, 1,0,3,1,100,100);
            gblLayout.setConstraints(jtfNrFaktury, constraints);
            pnlText.add(jtfNrFaktury);
            //Data sprzeda&#380;y
            JLabel jlblDataSprzedazy = new JLabel("Data sprzeda&#380;y");
            buildConstraints(constraints, 0,2,1,1,100,100);
            gblLayout.setConstraints(jlblDataSprzedazy, constraints);
            pnlText.add(jlblDataSprzedazy);
            jftfDataSprzedazy = new JFormattedTextField();
            buildConstraints(constraints, 1,2,1,1,100,100);
            gblLayout.setConstraints(jftfDataSprzedazy, constraints);
            pnlText.add(jftfDataSprzedazy);
            //Data faktury
            JLabel jlblDataFaktury = new JLabel("Data faktury");
            buildConstraints(constraints, 2,2,1,1,100,100);
            gblLayout.setConstraints(jlblDataFaktury, constraints);
            pnlText.add(jlblDataFaktury);
            jftfDataFaktury = new JFormattedTextField();
            buildConstraints(constraints, 3,2,1,1,100,100);
            gblLayout.setConstraints(jftfDataFaktury, constraints);
            pnlText.add(jftfDataFaktury);
            //P&#322;atno&#347;&#263;
            JLabel jlblPlatnosc = new JLabel("P&#322;atno&#347;&#263;");
            buildConstraints(constraints, 0,3,1,1,100,100);
            gblLayout.setConstraints(jlblPlatnosc, constraints);
            pnlText.add(jlblPlatnosc);
            jcbPlatnosc = new JComboBox(new String[]{"Got�wka", "Przelew", "Inna"});
            buildConstraints(constraints, 1,3,1,1,100,100);
            gblLayout.setConstraints(jcbPlatnosc, constraints);
            pnlText.add(jcbPlatnosc);
            //Termin p&#322;atno&#347;ci
            JLabel jlblTerminPlatnosc = new JLabel("Termin");
            buildConstraints(constraints, 2,3,1,1,100,100);
            gblLayout.setConstraints(jlblTerminPlatnosc, constraints);
            pnlText.add(jlblTerminPlatnosc);
            jsTerminPlatnosci = new JSpinner();
            buildConstraints(constraints, 3,3,1,1,100,100);
            gblLayout.setConstraints(jsTerminPlatnosci, constraints);
            pnlText.add(jsTerminPlatnosci);
            //Uwagi
            JLabel jlblUwagi = new JLabel("Uwagi");
            buildConstraints(constraints, 0,4,1,1,100,100);
            gblLayout.setConstraints(jlblUwagi, constraints);
            pnlText.add(jlblUwagi);
            jtfUwagi = new JTextField(25);
            buildConstraints(constraints, 1,4,3,1,100,100);
            gblLayout.setConstraints(jtfUwagi, constraints);
            pnlText.add(jtfUwagi);
            //Dodaj towar
              jbDodajTowar = new JButton("Dodaj towar");
            buildConstraints(constraints, 0,5,4,1,100,100);
            gblLayout.setConstraints(jbDodajTowar, constraints);
            pnlText.add(jbDodajTowar);
            //Usu&#324; towar
              jbUsunTowar = new JButton("Usun towar");
            buildConstraints(constraints, 1,5,4,1,100,100);
            gblLayout.setConstraints(jbUsunTowar, constraints);
            pnlText.add(jbUsunTowar);
            //Towary
            TowaryATModel towaryModel = new TowaryATModel();
            jtTowary = new JTable(towaryModel);
            add(new JScrollPane(jtTowary));
         public void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx, int wy) {
              gbc.gridx = gx;
              gbc.gridy = gy;
              gbc.gridwidth = gw;
              gbc.gridheight = gh;
              gbc.weightx = wx;
              gbc.weighty = wy;
    }

    It's my bug - I use Panel from AWT. When I replace it by JPanel, it's start work:-)

  • Enable/Disable JMenu in JFrame on click of button in JInternalFrame

    Hello there. Could anybody help me out of the situation?
    I am trying to enable/disable JMenu of JFrame on click of a button which is in JInternalFrame.
    I want to set JMenu(this is in JFrame).setEnable(true) in ActionPerformed() of JInternalFrame, but JFrame and JInternalFrame are the different classes and I do not know how I can access JMenu in main frame.
    How should I write something like mainframe.menu.setEnabled(true) from internal frame?
    For JInternalFrame window action, there is JInternalFrameListener, but this is not relevant for my situation because I am trying to control on click of a button.
    Can anybody suggest a solution?

    // Main Frame
    public class MainFrame extends JFrame
         public MainFrame()
              InternalFrame l_int = new InternalFrame(this);
                    //try to initiate internal frame like this
         public void activateMenu()
              menuBar.setEnabled(true);
         public static void main(String args[])
              MainFrame mainframe = new MainFrame();
    // Internal Frame
    public class InternalFrame extends JInternalFrame
         private MainFrame m_mainFrm = null;
         public InternalFrame(MainFrame a_objMainFrame)
              //your own code
              m_mainFrm = a_objMainFrame;
         public void actionPerformed(ActionEvent a_objevent)
    if(m_mainFrm != null)
              m_mainFrm.activateMenu();
    }try this.. hope this will help you
    :)

  • JMenu inner: how I can?

    Hello!
    I have a little trouble with inner JMenu.
    I must to do a JMenu that contains a few of JMenu that haves a lot of JMenuItem; all components are created at run-time.
    For example, the first JMenu (called "FIRST") contains the JMenu 1,2,3,4..
    All 1,2,3 use their name as paramether for have a ResultSet that is used for building JMenuItem associated to JMenu 1,2,3...
    in picture
    FIRST------->1--->JMenuItem 0
    |
    |--->2--->JMenuItem 1
    | |
    | -->JMenuItem 1
    |
    --->3--->etc...
    There's the code:
    /*connection to db*/
    JMenu first=new JMenu();
    JMenu second=new JMenu();
    ResultSet rs_class=st.executeQuery(...);
    /*i have the voices for the first jmenu*/
    while(rs_class.next()){
    name_class=rs.class.getString(1);
    }/*end while for class*/
    /*i create the JMenu first using the arraylist classi for remember the element's name*/
    for(int i=0;i<classi.size();i++){
    name_class=classi.get(i);
    first=new JMenu(name_class);
    ResultSet rs_metodo=st.executeQuery(...);
    while(rs_metodo.next()){
    name_method=rs_metodo.getString(1);
    metodo.add(name_metodo);
    }/*end while JMenu second*/
    for(int j=0;j<metodo.size();j++){
    nome_metodo=metodo.get(j);
    second=new JMenu(name_method);
    ResultSet rs_param=st.executeQuery(...);
    /*i create the jmenuitem for jmenu second*/
    while(rs_param.next()){
    String p1=rs_param.getString(1);
    JMenuItem mi= new JMenuItem(p1);
    second.add(mi);
    }/*end while param*/
    first.add(second);
    }/*end method*/
    this.add(first);
    }/*end for of class*/
    }/*end method for JMenu-Jmenu-JMenuItem*/My problem is that second is not reset on the change of step but in all step him add the new JMenuItem() and him memorize all old JMenuItem.
    I want that, in all step, second take only JMenuItem generated in the step and only in this step.
    How must I code for have the reset of second JMenu?
    Thanks for every feed-back

    When a 430EX II is used wirelessly via E-TTL, it can only work in the "slave" mode (it can be an off-camera remote flash, but if it is used on-camera, it cannot work as a "master" to control the "slaves".)  Alsok the 430EX II has no radio, so it can only work in "optical" mode.
    The 600EX-RT is the flagship flash... it can be "master" or a "slave".  It can also work via "radio" or "optical".  
    So while the 600EX II is versatile, the 430EX II is more restrictive.  That means you have to use 430 off-camera and the 600 on-camera as the master.
    The ST-E3-RT is _only_ a radio trigger... it cannot trigger a flash optically.   The ST-E2 can trigger optically (but not radio).  
    The 5D III has no built-in trigger.  That means if you want to control both the 430 and 600 off-camera, you'd need an ST-E2 to do it.  
    When I bought my 5D III, I had a 430EX II and a 580EX II.  I've since bought a pair of 600EX-RT units and then finally added the ST-E3-RT controller.  I no longer use my 430EX II or 580EX II (those are "on loan" to friends.  I say "on loan" because I realize I don't need them anymore and so there's really no reason for them to ever return them.  At this point, I might as well just call them "gifts".)
    Tim Campbell
    5D II, 5D III, 60Da

  • Issue in creation of control cycle

    Dear Gurus,
    During creation of control cycle (LPK1), the fields for source information is not appearing in my system.
    I compared control cycle in a different ECC system where source information is appearing.
    How can make the screen appear in my ECC system.
    Please find the screenshots.
    Any pointers will be highly appreciated.
    This thread is further to the threads in Production Planning and LE/WM Forum. I could not resolve the issue with the threads.
    Hope that I will get any pointer in EWM forum.
    http://scn.sap.com/thread/3609441
    http://scn.sap.com/thread/3610822
    With Regards,
    Malay

    Hello Malay,
    Can first contact your ABAPer and ensure the bottom screen is not an Screen Enhancement?
    If it is a some custom development, your ABAPer can help you on the logic behind it.
    Else, Let us know.
    Regards,
    Sathish

  • IF-statement in Personas that is checking if control is inactive?

    Hi,
    I have this simple script in screen personas that is clicking the option: "Attachment list". Everything is working great if there is attachments.
    If there are no attachments the option is "inactive" or "greyed out". This will result in a script error.
    I thought this was going to be an easy fix by adding IF statement to the the script. But howerver I specify the critera for the IF statement the script will always try to click the Attachment list. The condition will simply always be TRUE.
    Am I missing something here or is it not possible at this time to script an IF statement that is checking if the control is inactive or similar?
    Best Regards,
    Oskar Söderlund

    There is another way, but it will get a little tricky.
    Outside of the transaction IE03 you can check for the existence of attachments for a piece of equipment by looking in table SRGBTBREL. Field TYPEID_A will be "EQUI" and field INSTID_A will be the equipment number, zero-padded on the left to 18 characters long. Use SE16 to look in the table and you'll get the idea.
    You could wrap this test in an RFC-enabled ABAP function and call that from your Personas script button. Use the return value from that RFC to decide if attachments exist or not and how the script should respond. Details for how to write such an RFC and call it from a Personas script are in this blog: Calling RFCs from a Personas script.
    Like I said, this isn't straightforward and perhaps Personas scripting should include an active/inactive test in addition to the exists/doesn't exist test. Until then, however, there is a way if you don't mind a bit of ABAP programming.

  • ANY SY-INDEX REFLECT CHANGES WHEN CONTROL BREAK STATEMENT PROCESS

    Dear Guru's,
                     I have a requirement where i have to move the values to variable when control break (AT END OF) process. So i want to move the values according to the end of Vendor so for that  i want to know is there any sy-index available which reflects changes when Control break (AT end of) process.
    LIKE Sy-subrc = 0 when select statement fetches record or sy-tabix is like counter for loop.
    Hope to get reply soon.
    Regards,
    Himanshu Rangappa

    Hi,
    There is no system Fields for it.
    But your requirement can be done with 'AT NEW' and 'AT END' statement.
    Refer this sample example,
    loop at otab.
        at new module.
          move otab-module to otab2-module.
        ENDAT.
          at END OF effort.
          sum.               "Do your calculations here
          move otab-count to otab2-count.
          append otab2.
        endat.
      endloop.

Maybe you are looking for

  • Can't import songs from computer to itunes!

    I am unable to add music files to my itunes library. If I click the 'add file to folder', i get the message that the file is not in the wma format and will be converted by itunes. but nothing happens, and the file isn't added. i've alternatively trie

  • Error Mail Merge Aborted due to error in creating the Mail Merge DataSource

    Dear All, please help me with this problem (Oracle release 12.0.4.) 1. PROBLEM: When attempting to extract data, using Web ADI in HRMS, Word is selected as the viewer, but an Excel spreadsheet is generated rather than a MS Word document containing th

  • Regarding BOR's in HR ABAP

    Hi Friends, I am new to work flow , I need to understand the BOR in HR ABAP. Can any one please help in understnad the BOR in HR ABAP and How to identify the HR related BOR. It will be helpfull if you have explain with an Business scenaraio (For Exam

  • Queue not queueing

    I have a producer / consumer architecture - data are being read (from a TCP read) in the producer loop and placed on a queue. The consumer is reading the queue and doing lots of modelling, analysis and display. This architecture was chosen because th

  • UI Loader Component causing delay in preloader

    Hi All- I would really appreciate if you could help me with this issue. I have a preloader in the first scene. In the next scene is my main movie, in which I have a UI Loader Component. I've unchecked "export in first frame" in the linkage options fo