Create button to implement windowClosed event

I am wondering if it is possible to create a button on a forum that would act the same as the X button in the window.
or if there is another way that i can let my parent frame, that created this new frame, know that the child frame has been closed so that the parent frame can carry on as normal until the next child frame is created.

ok, i don't think i made my issue clear, but i might be designing this a poor way so let me know.
my parent frame creates another frame, and listens for it to close
        JFrame edit;
        if ( frame not open ) {
            edit = new Edit_Applicator("Edit Applicator",380, 500, true);
            edit.setAlwaysOnTop(true);
            edit.addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosed(WindowEvent winEvt) {
                    do thing;
        }then when i close the child i want it to be able to tell the parent that it has closed. if they click on the X my current method works perfect. however, i want to create an exit button on the child frame that will let the parent frame know it has closed as well.
i have created the button and the actionlistener for the button, but i'm not sure how to get the button to close the same way that the X button closes the frame, and have the windowlistener in the parent "hear" that the child closed.

Similar Messages

  • Creating button event

    Hi there,
    1) I have button and I want to create WhenClikMouse event occurs when click on it from the forms. I'm trying to create button event in PJC, ANYBODY can help?!,,
    2) and where should I save the JavaBean class to call it successfuly from the forms (I'm working on oracle 9i and Jdeveloper 9.2).

    Hi there,
    1) I have button and I want to create WhenClikMouse
    event occurs when click on it from the forms. I'm
    trying to create button event in PJC, ANYBODY can
    help?!,,
    2) and where should I save the JavaBean class to call
    it successfuly from the forms (I'm working on oracle
    9i and Jdeveloper 9.2).Hi - I'd post this to the "Forms" forum on OTN since this is a question about Pluggable Java Components which are a specific (and mighty cool) feature of forms.
    There's also some viewlets and documentation from the Forms section on OTN (http://otn.oracle.com/products/forms) and the how-to debug PJC technical note (http://otn.oracle.com/products/forms/htdocs/howto_debug_pjc.html).
    -steve-

  • Calling a JDialog in the windowClosing Event of a JFrame

    hi
    As we had seen in many applications when u try to close the application a Dialog box will appear and it will ask whether we have to save it.I want to implement the same thing in my windowClosing Event of the Frame.I tried doing this by calling the Dialog i have created by using the show method in the window closing event of the Frame,but what happens is when i close the frame the Dialog box flickers and disappears.What should i do to avoid this flickering and Disppearing of the Dialog box.I want the Dialog box to stay on the screen.What should i do? any ideas?
    thanks

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class WindowClosingTest extends JFrame {
         public WindowClosingTest() {
              try {
                   setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
                   JButton button = new JButton("Close");
                   button.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent ae) { performClose(); }
                   addWindowListener(new WindowAdapter() {
                        public void windowClosing(WindowEvent we) { performClose(); }
                   getContentPane().add(button);
                   pack();
                   setLocationRelativeTo(null);
                   setVisible(true);
              } catch (Exception e) { e.printStackTrace(); }
         private void performClose() {
              int n = JOptionPane.showConfirmDialog(null, "Close?", "Confirm", JOptionPane.YES_NO_OPTION);
              if (n != 1) { System.exit(0); }
         public static void main(String[] args) { new WindowClosingTest(); }
    }

  • Scroll bars & creating buttons problem

    I am trying to create a basic photo browser. The upper area is the enlarged view of the image. The lower portion is a scrollable view of the thumbnails in the directory chosen. I have most of it working...except that the scrollable view doesn't scroll, and the buttons that I created don't cause the image to show up in the main view port.
    There is the main window, divided into two parts: upper and lower. The upper part is the main view, as described above. The lower part is a panel. That lower panel contains two things, another panel and a button. This panel inside the lower section contains the scrollable window; this scrollable window is a viewport onto another panel that contains the dynamically created buttons (which are thumbnails of the images in the directory).
    I was trying to force the scrollbar policy to always show the horizontal bar (that is the only one I want visible) but that wasn't working either; I would get compiler errors when that was included. I have tried adjusting sizes of things, and the order that things are added to the main JFrame.
    Any suggestions would be appreciated.
    Here is the code:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.File;
    import java.io.FileFilter;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.border.EtchedBorder;
    import javax.swing.filechooser.FileNameExtensionFilter;
    * PhotoGUI Browse
    * Description:  Generate a GUI interface for viewing a large view of an image and previews of thumbnails
    * in a directory.  There are two parts to the GUI:  large upper section for main viewing, and a short lower
    * section for viewing the thumbnail previews.  The lower section is also split into two parts:  the left part
    * is a scrollable pane where the thumbnails will be previewed, and then a small section to the right where
    * a button for changing directories will be present.  (I wanted the button to always be visible so didn't
    * put it in the scrollable area.)
    public class PhotoGUI extends JFrame {
         final int SIZE = 75;     //scaling size for images in thumbnail browser
         boolean firstRunThrough = true;               //Changes behavior of directory requester
         private JPanel thumbs;
         private JPanel pickNThumbs;
         private ImagePanel bigView ;
         private JScrollPane scroller;
         private JButton pickDirButton;
         private thumbSelectedListener thumbPicksNose;
         public PhotoGUI () {
              this.setDefaultCloseOperation (EXIT_ON_CLOSE);
              this.setSize(600,600);       //Starting size of the overall container.
              this.setTitle("Eye Photo photo browser");
              //The upper portion of the GUI, where the large view of the image will be held
              bigView = new ImagePanel();       
              //bigView.setSize (600,500);
              //The bottom section of the GUI; will hold the thumbnail previews
              //(in a scrollable panel) and a button for changing directories.
              pickNThumbs = new JPanel();             
              pickNThumbs.setBackground(Color.WHITE);
              pickNThumbs.setSize(600,100);
              pickDirButton = new JButton("Pick directory...");
              //pickDirButton.setSize(75,150);
              dirPickListener dirButton = new dirPickListener ();
              pickDirButton.addActionListener(dirButton);
              thumbs = new JPanel();              //The panel that will hold the thumbnail previews
              scroller = new JScrollPane(thumbs);       //Setting the scroll bar pane to view the thumbnail panel
              //scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
              //scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
              // scroller.setSize(525,100);          
              scroller.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
              pickNThumbs.add(scroller);
              pickNThumbs.add(pickDirButton);
              this.add(bigView);
              this.add(pickNThumbs, BorderLayout.SOUTH);
              String pickedDir = pickDir();               //Setting up the while loop so it will keep requesting
              if (pickedDir.equals("-1")) {
                   if (firstRunThrough)   System.exit(0);          //End program if they don't pick a dir the first time through.
              }else {
                   thumbsUp(pickedDir);                  //They picked good Dir; populate thumbnails
                   firstRunThrough = false;
         public String pickDir () {          
              // This is the file chooser method. 
              JFileChooser dirPicker = new JFileChooser();
              dirPicker.setDialogTitle("Pick a directory");
              dirPicker.setApproveButtonText("Open directory");
              dirPicker.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
              int x = dirPicker.showOpenDialog(getParent());   //maybe I don't need this?
              if (x == JFileChooser.APPROVE_OPTION) {
                   return dirPicker.getSelectedFile().getAbsolutePath();
              } else return "-1";              //Just to cover all possible conditions
         public void thumbsUp (String chosenDir) {
              // Thumb populater method.  It adds each thumb-button to the scroller panel
              thumbs.removeAll();         //Need to remove old directory's buttons
              File selectedDir = new File(chosenDir);
             FileNameExtensionFilter filter = new FileNameExtensionFilter("JPG/GIF/BMP/PNG Images", "bmp", "jpg", "jpeg", "gif", "png");
              File [] dirEntries = selectedDir.listFiles();
              for (File tempFile : dirEntries) {    
                   if (filter.accept(tempFile) && tempFile.isFile()) {       //That way I only get certain types
                        JButton howToNameMultipleButtons = new JButton();
                        howToNameMultipleButtons.setActionCommand(tempFile.getAbsolutePath());
    //                    System.out.println(tempFile.getAbsolutePath());
    //                    System.out.println(howToNameMultipleButtons.getActionCommand());
                        howToNameMultipleButtons.setIcon(new ScaledIcon(tempFile.getAbsolutePath(), SIZE));
                        howToNameMultipleButtons.addActionListener(thumbPicksNose);
                        thumbs.add(howToNameMultipleButtons);
              this.setVisible(true);   //Down here so first run through program opens Dialog before showing
         public class dirPickListener implements ActionListener {
              public void actionPerformed (ActionEvent ae) {
                   thumbsUp(pickDir());     //Opens Dir selection dialog and feeds the thumbnail populater
         public class thumbSelectedListener implements ActionListener {
              public void actionPerformed (ActionEvent ae) {
                   String thumbPicked = ae.getActionCommand();    //Should return path string of thumbButton clicked
                   // System.out.println(ae.getActionCommand());    //TSing step; to see if this bit even fires off.
                   bigView.setImage(thumbPicked);
                   bigView.setToolTipText(thumbPicked);
                   //  bigView.setBackground(Color.GREEN);
    }

    Ah! I got some of it figured out at least...
    Setting the preferred size parameter has caused the scroll bars to display! :) Thanks for the hint on that.
    But I get an error when I try and use the scrollbar policy settings. Here are the results:
    Exception in thread "main" java.lang.IllegalArgumentException: invalid verticalScrollBarPolicy
         at javax.swing.JScrollPane.setVerticalScrollBarPolicy(Unknown Source)
         at javax.swing.JScrollPane.<init>(Unknown Source)
         at PhotoGUI.<init>(PhotoGUI.java:70)
         at PhotoBrowser.main(PhotoBrowser.java:15)And the code I used:
    scroller = new JScrollPane(thumbs,
                        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS,
                        ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);       //Setting the scroll bar pane to view the thumbnail panel
              Edited by: Mole_Hunter on Feb 1, 2010 9:57 AM

  • Another JTable/buttons in cells query - event forwarding

    Hi Everyone.
    Apologies in advance for yet another thread on this subject. I realise this has been discussed a number of times but I can't find what seems like a definitive solution.
    I understand what the fundamental issue is with putting JComponents in table cells - i.e. that the cells are rendered essentially as static visual entities, that they're not "components" as such and will not receive events.
    I'd like to implement JButtons in table cells so that they behave as "normally" as possible - i.e. handle their own roll-over appearance, handle their own pressed appearance, and fire action events when pressed, with as little manual intervention in these mechanisms (e.g. in mouse listener code) as possible. I'm trying to do this by forwarding mouse events from the table to the button, but this doesn't seem to work as I'd hoped and I have various questions...
    (Background: I have implemented JButton objects in the data model, and the getTableCellRendererComponent() method returns *(JButton)value*.)
    My first question concerns the interception of mouse events. The usual technique would be to add a mouse listener and/or mouse motion listener to the table, and implement mouseClicked(), mousePressed() etc. However, can I override the table's processMouseEvent() and processMouseMotionEvent() methods instead, and from here forward events to buttons where appropriate, or process normally with super.processMouseEvent()? My motivation for doing this would be specifically not to invoke the super methods where events were forwarded to buttons - effectively consuming the event. Is this correct technique?
    My second question concerns attempts to reproduce button roll-over appearances. The JTable is of course considered a single entity as far as mouse events are concerned, and MOUSE_ENTERED and MOUSE_EXITED events aren't generated as the pointer moves from cell to cell. Merely forwarding mouse events to buttons - which will mostly be MOUSE_MOVED events - seems to be insufficient and presumably the roll-over appearance change relies upon ENTERED and EXITED events occurring at the proper times.
    I mimicked this behaviour in my override of processMouseMotionEvent() by calculating the value (i.e. JButton reference) of the cell under the mouse pointer, and if it wasn't the same as for the previous event, manually creating a MOUSE_ENTERED event and forwarding it to the new button. This seemed to work - the rollovers were happening (provided a table repaint() was performed), but it seemed to work without needing to explicitly sending a MOUSE_EXITED to the previous button before sending MOUSE_ENTERED to the new. I'm unclear why this is so - I was half-expecting both buttons to acquire the roll-over state, and they didn't.
    Also, I had assumed that having taken care of this, I should forward MOUSE_MOVED events occurring within the confines of a cell's area to the button verbatim, but this seems to instantly cancel out any roll-over (visually the button would briefly flash a roll-over appearance as the pointer moved into its cell bounds). Why might this be so?
    My last question is about the actual pressing of the button. I had hoped that forwarding MOUSE_CLICKED, MOUSE_PRESSED and MOUSE_RELEASED would cause the button to (a) acquire the button-pressed state, and (b) fire an action event to its action listeners. Neither of these things occur, and I don't understand why not.
    In summary, is interception and forwarding of events like this a viable technique for implementing table cell buttons? The various solutions that a Google trawl throws up all reproduce button-pressing mechanics in varying degrees, some just detecting a click and calling some user function, others manually manipulating the button model in the mouse handler etc. If possible I'd like to avoid this, and leave as much processing as possible to the button's native code.
    Thanks in advance for any suggestions received.
    Regards,
    A.

    try to look on this
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender

  • How to Create Buttons With some operation

    Hello friends How can create button so that when i click that button it should open another new window so that i can select some options in that new window and do some calculations.
    Kindly help me .
    byee

    Hi JN,
    I have created a Frame which has some checkboxes , a button and text field. when i check some checkboxes and press the Button (ie in my program Metrics level Button ) it should display the result as number of checkboxes that are checked divided by total number of chechboxes. ie if i check some 6 check boxes and press the Metrics level button it should display 6 divided by 12 ie 0.5 in the Result Textfield.
    I am sending the code i have written.
    Thanks in advance.
    public class Frame extends java.awt.Frame {
    /** Creates new form Frame */
    public Frame() {
    initComponents();
    setSize(800, 800);
    private void initComponents() {
    label1 = new java.awt.Label();
    checkbox1 = new java.awt.Checkbox();
    checkbox2 = new java.awt.Checkbox();
    checkbox3 = new java.awt.Checkbox();
    checkbox4 = new java.awt.Checkbox();
    checkbox5 = new java.awt.Checkbox();
    checkbox6 = new java.awt.Checkbox();
    checkbox7 = new java.awt.Checkbox();
    checkbox8 = new java.awt.Checkbox();
    checkbox9 = new java.awt.Checkbox();
    checkbox10 = new java.awt.Checkbox();
    checkbox11 = new java.awt.Checkbox();
    checkbox12 = new java.awt.Checkbox();
    button1 = new java.awt.Button();
    textField1 = new java.awt.TextField();
    setLayout(null);
    addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(java.awt.event.WindowEvent evt) {
    exitForm(evt);
    label1.setText("Select the Metrics below");
    add(label1);
    label1.setBounds(320, 20, 136, 20);
    checkbox1.setLabel("Architecture Metrics");
    add(checkbox1);
    checkbox1.setBounds(240, 80, 84, 20);
    checkbox2.setLabel("Runtime Metrics");
    add(checkbox2);
    checkbox2.setBounds(240, 200, 115, 20);
    checkbox3.setLabel("Documentation Metrics");
    add(checkbox3);
    checkbox3.setBounds(240, 320, 152, 20);
    checkbox4.setLabel("Size");
    add(checkbox4);
    checkbox4.setBounds(280, 110, 49, 20);
    checkbox5.setLabel("Structure");
    add(checkbox5);
    checkbox5.setBounds(280, 130, 75, 20);
    checkbox6.setLabel("Complexity");
    add(checkbox6);
    checkbox6.setBounds(280, 150, 86, 20);
    checkbox7.setLabel("Size");
    add(checkbox7);
    checkbox7.setBounds(290, 230, 49, 20);
    checkbox8.setLabel("Structure");
    add(checkbox8);
    checkbox8.setBounds(290, 250, 75, 20);
    checkbox9.setLabel("Complexity");
    add(checkbox9);
    checkbox9.setBounds(290, 270, 86, 20);
    checkbox10.setLabel("Size");
    add(checkbox10);
    checkbox10.setBounds(300, 350, 49, 20);
    checkbox11.setLabel("Structure");
    add(checkbox11);
    checkbox11.setBounds(300, 370, 75, 20);
    checkbox12.setLabel("Complexity");
    add(checkbox12);
    checkbox12.setBounds(300, 390, 86, 20);
    button1.setLabel("Metrics level");
    add(button1);
    button1.setBounds(290, 470, 83, 24);
    textField1.setText("Result");
    textField1.setName("Result");
    add(textField1);
    textField1.setBounds(400, 470, 60, 20);
    pack();
    public void actionPerformed(ActionEvent e) {
    ****** I think code should be added here for the button pressed event*******
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {
    System.exit(0);
    * @param args the command line arguments
    public static void main(String args[]) {
    new Frame().show();
    // Variables declaration - do not modify
    private java.awt.Button button1;
    private java.awt.Checkbox checkbox1;
    private java.awt.Checkbox checkbox10;
    private java.awt.Checkbox checkbox11;
    private java.awt.Checkbox checkbox12;
    private java.awt.Checkbox checkbox2;
    private java.awt.Checkbox checkbox3;
    private java.awt.Checkbox checkbox4;
    private java.awt.Checkbox checkbox5;
    private java.awt.Checkbox checkbox6;
    private java.awt.Checkbox checkbox7;
    private java.awt.Checkbox checkbox8;
    private java.awt.Checkbox checkbox9;
    private java.awt.Label label1;
    private java.awt.TextField textField1;
    // End of variables declaration
    this is the output when i execute the program

  • Creating buttons on the fly and setting button properties

    If I have a view and want to add buttons to it "on the fly" from values in an array, is that something straightforward to do?
    I have an array of UIImageVIew objects and would like to create buttons from them (showing the image on the buttons) and associate those buttons with a method in my implementation file. That would be a lot more general and flexible than creating the buttons in the Interface Builder I would imagine.
    And one more question - can I freely set button properties while doing that? Or in Objective-C can I only set properties that are already pre-defined for that class?
    Thanks!
    doug

    Thanks for your reply.
    That.... works! Thanks!
    And I can generate the button and click on it and it calls my other method and that works too. Cool!
    The syntax is still very mysterious to me, but I suppose eventually I'll understand what it all means.
    Breaking it down to see what it means:
    [button1 addTarget:self action:@selector(selectedHandler1:) forControlEvents:UIControlEventTouchUpInside];
    * button1 is the object I created (I'm going to try to do this in a loop next.)
    * addTarget is a message I am sending to button1 and the content of the message is "self", which refers to - this button? I'm not sure why such a message would be necessary.
    * action is another message sent to button1 and the contents of that message are a little harder to parse. I see the result, and can mimic the syntax now that I've seen it, but I don't really understand what the @ is for, or the : after the method name or why this wouldn't just be "action: selectedHandler". I'm sure the language designers have a logical reason for all that, but I don't quite "grok" those extra symbols yet.
    * forControlEvents is another message sent to button1 and the event message itself is clear in its meaning.
    Anyway, that is working and I can refer more to the UIButton class reference now and try to set more stuff, like position it better, etc.
    Thanks very much!
    doug

  • How to trap WindowClose event?

    I would like to trap the WindowClose event such that when my closing condition is not satisfied, the window would not close.
    Right now everytime i click the X button at the upper right of the window, the window closes automatically. I would like to know how to trap that event so I can control the closing of the window.
    tnx!

    For that you have to implement java.awt.event.WindowListener and override the windowClosing or windowClosed method according to your requirement. Put your code inside that method. But before doing that you have to set the default close operation.
    setDefaultCloseOperation(0);
    Hope this would work.
    Anirban

  • I need to create Buttons dynamically Please Help

    I am currently developing a card game. I represent my cards as buttons. But as the player draws more cards from the deck I have to generate buttons dynamically at run-time. I could use arrays of buttons and store new buttons inside that arrays of buttons. But the only problem is I need ActionListener for each of my buttons. How do you create ActionListener for each different dynamically created buttons? Please Help.

    Here is my code. I just do not understand how to create those functions dynamically that functions different each time.
    Here is my code please take a look.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class run108{
    JButton setbutton;
    JButton ButtonUp;
    JButton ButtonDeal;     
    JButton slot1;
    JButton slot2;
    JButton slot3;
    JButton slot4;
    JButton slot5;
    JButton slot6;
    JButton slot7;
    cards[] card = new cards[55];
    public static void main(String[] argv)
         run108 startgui = new run108();
         startgui.createframe();     
    void createframe()
         //Standard of way of creating Frame
         JFrame frame = new JFrame("108");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.setLocation(300,200);// Tells the startup position;
         //Adding Panels to the framework
         JPanel panelA = new JPanel();
         panelA.setBackground(Color.white);
         panelA.setLayout(new BoxLayout(panelA,BoxLayout.Y_AXIS));
         JPanel panelB = new JPanel();
         JPanel panelC = new JPanel();
         //Adding buttons with card images
         JLabel label1 = new JLabel("       Set of Cards");
         panelA.add(label1);
         ImageIcon pic1 = new ImageIcon("cards/backd.png");
         setbutton = new JButton(pic1);          
        panelA.add(setbutton);
        ImageIcon picdeal = new ImageIcon("cards/deal.png");
         ButtonDeal = new JButton(picdeal);
         panelA.add(BorderLayout.CENTER, ButtonDeal);
        ButtonDeal.addActionListener(new DealListener());
         JLabel label2 = new JLabel("       Your Target");
         panelA.add(label2);
         ButtonUp = new JButton(pic1);          
        panelA.add(BorderLayout.CENTER, ButtonUp);
        frame.add(BorderLayout.WEST,panelA);
        // Adds 7 initial card slots.
         ImageIcon pic2 = new ImageIcon("cards/backc.png");
         slot1 = new JButton(pic2);
        panelB.add(slot1);          
        slot1.addActionListener(new Slot1Listener());
        slot2 = new JButton(pic2);
        panelB.add(slot2);
        slot2.addActionListener(new Slot2Listener());
         slot3 = new JButton(pic2);
        panelB.add(slot3);
        slot3.addActionListener(new Slot3Listener());
         slot4 = new JButton(pic2);
        panelB.add(slot4);
        slot4.addActionListener(new Slot4Listener());
         slot5 = new JButton(pic2);
        panelB.add(slot5);
        slot5.addActionListener(new Slot5Listener());
         slot6 = new JButton(pic2);
        panelB.add(slot6);
        slot6.addActionListener(new Slot6Listener());
         slot7 = new JButton(pic2);
        panelB.add(slot7);
        slot7.addActionListener(new Slot7Listener());
        frame.add(BorderLayout.CENTER,panelB);
        // This has to be added @ the end to show the components
        //that were added after on. If it is placed before the components
        //the components shall not appear since they sit on the frame
         frame.setSize(600,500);
         frame.setVisible(true);
    class DealListener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot1Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot2Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot3Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot4Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot5Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot6Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot7Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    }

  • To Disable 'CREATE' button

    Hi i have a requirement like to disable one CREATE Button(Creating of Business Partner IS-FS-CM) which is in standard ALV report.I can eliminate that button from PF status of that screen but we are not supposed to change the existing code.But that screen is BDT implemented.
    Can you please help out me how to disable that button w/o changing the standard SAP code

    Hi Krishna,
    For example say your PF sataus name is 'STATUS-100' and function code for create is 'CREATE'.
    then in your part of code use the following syntax,
    SET PF-STATUS 'STATUS-100'  EXCLUDING 'CREATE'.
    I hope this will help you.
    Regards,
    Manoj Kumar P

  • For loop and xml - how to point the right content in a XML file with a dynamically created button?

    Hi Everybody,
    as my first experience in AS3 I'm bulding a photo multigallery. In that gallery I have some buttons, each one pointing to its respective set of images.
    Each button is created with the for loop, that picks the information from a XML file. From this XML I get the text of the button, the position etc. What I did with some sucess. But there is a scary problem: I don't know how to make each button load the respective and unique set of images.
    I've tryied several different methods, with no effect, to make each loop to give to each button an unique identity to load the respective set of images.
    I imagine that the solution pass by the use of arrays. I wrote some code, and I guess that I'm almost there (but not sure). Here is my AS3 code until now:
    // CREATE MENU CONTAINER //
    var menuContainer:MovieClip = new MovieClip();
    menuContainer.x=10;
    menuContainer.y=300;
    addChild(menuContainer);
    // CREATE IMAGES CONTAINER //
    var imagesContainer:MovieClip = new MovieClip();
    imagesContainer.x=10;
    imagesContainer.y=10;
    addChild(imagesContainer);
    //// LOAD XML ////
    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.addEventListener(Event.COMPLETE, whenLoaded);
    xmlLoader.load(new URLRequest("XML/roiaXML.xml"));
    var xml:XML;
    function whenLoaded(evt:Event):void {
         xml=new XML(evt.target.data);
         var mySetsList:XMLList=xml.children();
         //// MENU BUTTONS ////
         // CREATE ARRAYS //
         var totalArray:Array = new Array();
         var setNodesArray:Array = new Array();
         var setNamesArray:Array = new Array();
         // POSITIONING BUTTONS INSIDE MENU CONTAINER//
         var rowsQuantity:Number=3;
         var columnsQuantity:Number=Math.ceil(mySetsList.length()/rowsQuantity);
         var cellWidth:Number=160;
         // CREATE BUTTONS //
         for (var i:int=0; i< mySetsList.length(); i++) {
              var newSetButtonMC:setButtonMC=new setButtonMC();
              //what do I do here to make it works? To give each button created a unique id.
              setNodesArray.push(i);
              //trace(setNodesArray);
              var imageNodesArray:Array = new Array();
              for (var j:int=0; j<mySetsList[i].IMAGE.length(); j++) {
                   imageNodesArray.push(mySetsList[i].IMAGE[j].attribute("imageTitle"));
              totalArray.push(imageNodesArray);
              newSetButtonMC.setButtonText.text=mySetsList.attribute("galeriaTitle")[i];
              newSetButtonMC.setButtonText.autoSize=TextFieldAutoSize.LEFT;
              var cellX:Number=Math.floor(i/rowsQuantity);
              var cellY:Number=i%rowsQuantity;
              newSetButtonMC.x=cellX*cellWidth;
              newSetButtonMC.y=cellY*(newSetButtonMC.height+10);
              newSetButtonMC.addEventListener(MouseEvent.CLICK, onClick);
              menuContainer.addChild(newSetButtonMC);
         totalArray.push(setNodesArray);
         //// MENU BUTTONS ACTIONS ////
         function onClick(mevt:MouseEvent):void {
              trace(totalArray [0][0]);
              trace(totalArray [0][0]);
              // in the line above I achieved some success loading a specific info from XML.
              // but I don't know what to do with it.
              //what do I do here? To make each button to load its own node from XML.
    Here is my XML:
    <GALERIA galeriaTitle="galeria 01">
      <IMAGE imageTitle="imageTitle01">feio.jpg</IMAGE>
      <IMAGE imageTitle="imageTitle02">muitofeio.jpg</IMAGE>
      <IMAGE imageTitle="imageTitle03">aindamaisfeio.jpg</IMAGE>
    </GALERIA>
    <GALERIA galeriaTitle="galeria 02">
      <IMAGE imageTitle="imageTitle01">estranho.jpg</IMAGE>
      <IMAGE imageTitle="imageTitle02">maisestranho.jpg</IMAGE>
      <IMAGE imageTitle="imageTitle03">aindamaisestranho.jpg</IMAGE>
    </GALERIA>
    Thanks everyone . ABSTRATO

    you can assign each newSetButtonMC and ivar property that points to its i value or, even easier:
    // CREATE MENU CONTAINER //
    var menuContainer:MovieClip = new MovieClip();
    menuContainer.x=10;
    menuContainer.y=300;
    addChild(menuContainer);
    // CREATE IMAGES CONTAINER //
    var imagesContainer:MovieClip = new MovieClip();
    imagesContainer.x=10;
    imagesContainer.y=10;
    addChild(imagesContainer);
    //// LOAD XML ////
    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.addEventListener(Event.COMPLETE, whenLoaded);
    xmlLoader.load(new URLRequest("XML/roiaXML.xml"));
    var xml:XML;
    function whenLoaded(evt:Event):void {
         xml=new XML(evt.target.data);
         var mySetsList:XMLList=xml.children();
         //// MENU BUTTONS ////
         // CREATE ARRAYS //
         var totalArray:Array = new Array();
         var setNodesArray:Array = new Array();
         var setNamesArray:Array = new Array();
         // POSITIONING BUTTONS INSIDE MENU CONTAINER//
         var rowsQuantity:Number=3;
         var columnsQuantity:Number=Math.ceil(mySetsList.length()/rowsQuantity);
         var cellWidth:Number=160;
         // CREATE BUTTONS //
         for (var i:int=0; i< mySetsList.length(); i++) {
              var newSetButtonMC:setButtonMC=new setButtonMC();
              //what do I do here to make it works? To give each button created a unique id.
              setNodesArray.push(i);
              //trace(setNodesArray);
              var imageNodesArray:Array = new Array();
              for (var j:int=0; j<mySetsList[i].IMAGE.length(); j++) {
                   imageNodesArray.push(mySetsList[i].IMAGE[j].attribute("imageTitle"));
             nextSetButtonMC.imageArray = imageNodesArray;
              //totalArray.push(imageNodesArray);
              newSetButtonMC.setButtonText.text=mySetsList.attribute("galeriaTitle")[i];
              newSetButtonMC.setButtonText.autoSize=TextFieldAutoSize.LEFT;
              var cellX:Number=Math.floor(i/rowsQuantity);
              var cellY:Number=i%rowsQuantity;
              newSetButtonMC.x=cellX*cellWidth;
              newSetButtonMC.y=cellY*(newSetButtonMC.height+10);
              newSetButtonMC.addEventListener(MouseEvent.CLICK, onClick);
              menuContainer.addChild(newSetButtonMC);
         totalArray.push(setNodesArray);
         //// MENU BUTTONS ACTIONS ////
         function onClick(mevt:MouseEvent):void {
              var mc:setButtonMC=setButtonMC(mevt.currentTarget);
    for(i=0;i<mc.imageArray.length;i++){
    trace(mc.imageArray[i]);
    Here is my XML:
    <GALERIA galeriaTitle="galeria 01">
      <IMAGE imageTitle="imageTitle01">feio.jpg</IMAGE>
      <IMAGE imageTitle="imageTitle02">muitofeio.jpg</IMAGE>
      <IMAGE imageTitle="imageTitle03">aindamaisfeio.jpg</IMAGE>
    </GALERIA>
    <GALERIA galeriaTitle="galeria 02">
      <IMAGE imageTitle="imageTitle01">estranho.jpg</IMAGE>
      <IMAGE imageTitle="imageTitle02">maisestranho.jpg</IMAGE>
      <IMAGE imageTitle="imageTitle03">aindamaisestranho.jpg</IMAGE>
    </GALERIA>
    Thanks everyone . ABSTRATO

  • Create Button  in Abap Program

    Hi anybody,
      I want to use click event button inside abap programe.
    how to use click events of button.
    anybody tell me.
    thanks
    s.muthu

    hiii
    use following code.it will create button
    START-OF-SELECTION.
      SET PF-STATUS 'STATUS'.
      PERFORM get_data_kna1.
    END-OF-SELECTION.
    Now write following code for performing task on clicking that button.
    CASE sy-ucomm.
      WHEN 'CUSTOMER'.
       SELECT SINGLE kunnr
          FROM kna1
          INTO w_kna1
          WHERE kunnr = w_kunnr.
          IF sy-subrc <> 0.
             MESSAGE e015(zmsg9).
           ENDIF.
    WHEN 'ORDER'.
               SELECT SINGLE vbeln
          FROM vbak
          INTO w_vbak
          WHERE vbeln = w_vbeln.
          IF sy-subrc <> 0.
           MESSAGE e015(zmsg9).
          ENDIF.
      ENDCASE.
    reward if useful
    thx
    twinkal

  • Report to Mintenance CREATE Button

    We created the tutural application where a Report TAB(P1) is linked to the maintenance Page(P2). When this is done the "ID" is passed from the report page to the maintence page. The CREATE button disapears because the pages are linked and there is a CREATE BUTTON test to see if the ID is set. If we Click on the Minatence TAB one of two things happens.
    A) if the is the first time using the application in the session then we get an Error as the P2_ID is not set.
    B) the last ID used will be displayed.
    How can we change the application so the when the mainence TAB is press it Clears the ID and runs with a CREATE Button, but if navigated from the report page if shows the row to be changed?

    if your tabs are Parent Tabs, you could easily set the URL target of your tab to clear the cache for page 2. you'd do that from your Edit Parent Tab screen. you can't do that with a standard tab, though, so you might want to consider clearing your cache on page 2 in an HTML DB process that fires after your current last process on that page. this way your value for P2_ID is consistently cleared after users leave that page. when a user comes back into that page w/o providing a P2_ID value, your create buttons and such should show.
    hope this helps,
    raj
    [Edited by: rmattama on Dec 22, 2003 9:28 AM]
    i wanted to post this part of my answer originally, but i wasn't sure about a specific point. anyhow:
    as a third option, you can consider using the value of :REQUEST to conditionally fire a process or computation that clears P2_ID. if you pay attention to the way your tabs are working, you'll see that clicking on them either submits your current page to then branch to the next or that they're simply links to your other pages. if your current page has no form fields on it, then html db implements your tabs as the simple links to their associated pages. if the current page does have form fields on it, you'll notice that clicking a standard tab submits the page with the value of :REQUEST being equal to the name of the tab. it's that value of :REQUEST that you can use to conditionally fire a process or computation to clear P2_ID. a conditionally fired after_submit computation on page 1 would do it, for instance.
    hope this helps, too,
    raj

  • Create button in F4

    How to create an f4 help which includes create button in that screen.
    So that i can create a record that does not exist in source table

    Ruby,
    The method that the IC webclient uses is the following:
    1.  Create a "blank transaction in the background".  Retrieve the object key(GUID) of that transaction.
    2.  Call the PCUI application with the parameters &BORKEY=<object key>
    &BORTYPE=<doctype>
    I am not sure how you could implement this into the plain PCUI.  You could possibly redefine the "new" button and put your custom logic behind it, but the SAP standard does require a user to choose a document type.
    If you only deal with one document for that business object, you can restrict the list via security and the user should be able to just hit create to select the new document.
    As this really modifies the standard SAP process flow, you may run into several issues.
    Good luck,
    Stephen

  • Futureproof and dynamically created button

    I have been looking solution how to make buttons dynamically so that I can fetch dynamically values for buttons:
    - value,onclick,class,type,request
    This excellent page has very closely what I am looking: http://www.laureston.ca/2012/04/20/simple-workflow-implementation-in-apex/
    but I have challenges getting the escaped special characters to work especially for the apex.submit - part.
    Maybe that is just because 'copy-pasting' the plsql-region code from www-page didn't work out of the box
    Application Express 4.2.3.00.08
    Because dealing with the escape chars make the page easily break and there are now the new dynamic actions, I need to check what would be futureproof way of dynamically creating the buttons.
    If this is anyway the most practical way to proceed, then where I should look for further information about htp.p(....) button creation examples with rich escapes?
    Made small test page, where you can see one of my trials trying to get the escapes right.
    user test
    pass test
    http://apex.oracle.com/pls/apex/f?p=1403:2
    rgrds paavo
    --below the code for dynamic plsql region -- very likely the escape chars are not copypasted and shown correctly:
    DECLARE
    --PL/SQL Dynamic Region
    --thisworks too??
      v_showme varchar2(3000);
    BEGIN
      for c in (select sysdate||'asdasd;asdasas'  as button_label
                , 'PIMREQUEST'  as button_request
                , 'button-gray' as button_class
                , 'button'      as button_type
                , 'P38_XPIMPOM' as button_setme
                , 'JUUSTOA'     as button_setme_value
                from dual) loop
    htp.p('<button value='''||c.button_label||''' onclick=\"apex.submit('''||c.button_request||''');'' class='''||c.button_class||''' type='''||c.button_type||'''>
    <span>'||c.button_label||'</span>
    </button>');
      end loop;
    END;

    Hi Paavo,
    Your right about the button_id. It's value comes from an input parameter. The button won't show up in the "When button pressed"-list_of_values. This is not only because you write the id yourself, but more because the entire button is created on the fly. The button isn't stored internal in an apex table, that's why it won't show up in a list of values.
    If you want to trigger a dynamic action with the button, you can use a jQuery selector as triggering element. Here you can refer to the button_id using the '#' as jQuery marker for ID, e.g. '#myButton'.
    What the button that you render does, depends on what you put in the p_link parameter. A normal save button would submit the page with condition 'SAVE', you can do that by setting p_link to 'apex.submit("SAVE")'. If the button should do a page redirect, you set p_link to 'http://www.page2go.com', or whatever url you wish to redirect to.
    The text you put in the button attributes is added as HTML element definition, so if you set p_attrs to 'alt="alternate text"', that will be added to the html of your button.
    An example for a conditional button call could be:
          if p_order_id is null
          then
            create_button
              ( p_id        => 'newOrder'
              , p_link    => 'javascript:apex.submit("CREATE"');'
              , p_label     => 'New Order'
              , p_css       => 'customButton'
          else
            create_button
              ( p_id        => 'updateOrder'
              , p_link    => 'javascript:apex.submit("SAVE"');'
              , p_label     => 'Update Order'
              , p_css       => 'customButton'
          end if;     
    This would create a 'CREATE' button for a new order (p_order_id is null), or a 'SAVE' button for an existing order.
    Regarding your ps: if you mean can you conditionaly create a button using dynamic actions? Then the answer would be yes. Yes you can use the create_button procedure in a dynamic action, however by writing it as stored procedure in the database, or in a database package, you can easily reuse your code and still have only one version of your procedure that you need to maintain.
    Regards,
    Vincent
    http://vincentdeelen.blogspot.com

Maybe you are looking for

  • Why is RV082 PPTP no longer working with Windows 7 clients?

    RV082 Firmware Version 2.0.2.01-tmRV082 Firmware Version 2.0.2.01-tm I have successfully used the built-in Windows 7 VPN (PPTP) to connection to an RV082 (Firmware 2.0.2.01-tm) many times in the past. The Windows 7 client stopped working recently, n

  • Should I update my iPad to ios6

    Well in the setting Iam confuse, should I update it and if I update it are all app that I install will deleted or unistall itself some how?

  • Crystal Report with subreports breaks when running on different databases.

    HI there I have a report with 5 subreports on that only works on the database I am designing it on. As soon as I run the report through my application on a database different to the one I design on, it seems to have lost all the parameter fields I cr

  • Movement Types in PP

    Hello SDN Team, I would like to know what are the Movement types used in PP Module.. Regards Vijay

  • System prefernces Messed up

    Hi I recently noticed that All the icons inside my system preferences are gone and that I have to search in the search bar if I want to find something. This is really annoying because It wastes time when I'm at school and it is really hard to find ev