Button click handler: isn't invoked

Hi i have a problem with my buttons but i cant see it,
i am trying to close the bet screen when a button is
pressed but it dosen't reach the if statement can
anyone see the problem here is the code(i also have a class main that invokes class roulette):
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class BetScreen extends JFrame {
     private Container container;
     private FlowLayout layout;
     public  JButton oddButton;
       public  JButton evenButton;
       public  JButton redButton;
        public  JButton blackButton;
       public  JButton specifButton;
       public BetScreen()
         super("Bet Screen");
         layout = new FlowLayout();
         container = getContentPane();
         setLayout( layout );
         getContentPane().setBackground(Color.RED);
        layout.layoutContainer( container );
        oddButton = new JButton("Odd");
         add( oddButton );
         oddButton.addActionListener(
        new ActionListener()
      public void actionPerformed(ActionEvent event)
            System.out.println(event.getSource());
        System.out.println(oddButton);
          wager();
    }//end method actionPerformed
    }//end method actionListener
    );//end call to addActionListener
}//end class.....................................................................................................................
(This is in a different class)
.....................................................................................................................import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Roulette extends JFrame {
       private Container container;
       private JButton spinButton;
     private JButton quitButton;
       private FlowLayout layout;
       private JButton placeBetButton;
       public Roulette()
         super("Main Menu");
         layout = new FlowLayout();
         container = getContentPane();
        setLayout( layout );
         placeBetButton = new JButton("Place Bet");
         add( placeBetButton );
         placeBetButton.addActionListener(
    new ActionListener()
        public void actionPerformed( ActionEvent event )
         BetScreen betScreen = new BetScreen();
             betScreen.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      betScreen.setSize(300,100);
      betScreen.setVisible(true);
      System.out.println(event.getSource());
      if(event.getSource() == betScreen.oddButton)
      betScreen.setVisible(false);
      }//end if
    }//end method actionPerformed
    }//end method actionListener
    );//end call to addActionListener
    }//end if

This probably seems like a stupid question but what does a reference to a frame actually mean? JFrame frame1 = new CustomFrame1();
JFrame frame2 = new CustomFrame2( frame1 );
Now you have created frame2 by passing a reference ot frame1 to frame2. So now any code in frame2 has access to trame1, which means you could use the setVisible( false ) method on frame1, from an ActionListener in frame2. Its a terrible design as I don't see why the second frame would close the first frame, but it is possible.

Similar Messages

  • How to move a selected row data from one grid to another grid using button click handler in flex4

    hi friends,
    i am doing flex4 mxml web application,
    i am struck in this concept please help some one.
    i am using two seperated forms and each form having one data grid.
    In first datagrid i am having 5 rows and one button(outside the data grid with lable MOVE). when i am click a row from the datagrid and click the MOVE button means that row should disable from the present datagrid and that row will go and visible in  the second datagrid.
    i dont want drag and drop method, i want this process only using button click handler.
    how to do this?
    any suggession or snippet code are welcome.
    Thanks,
    B.venkatesan.

    Hi,
    You can get an idea from foolowing code and also from the link which i am providing.
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    width="613" height="502" viewSourceURL="../files/DataGridExampleCinco.mxml">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.binding.utils.BindingUtils;
    [Bindable]
    private var allGames:ArrayCollection;
    [Bindable]
    private var selectedGames:ArrayCollection;
    private function initDGAllGames():void
    allGames = new ArrayCollection();
    allGames.addItem({name: "World of Warcraft",
    creator: "Blizzard", publisher: "Blizzard"});
    allGames.addItem({name: "Halo",
    creator: "Bungie", publisher: "Microsoft"});
    allGames.addItem({name: "Gears of War",
    creator: "Epic", publisher: "Microsoft"});
    allGames.addItem({name: "City of Heroes",
    creator: "Cryptic Studios", publisher: "NCSoft"});
    allGames.addItem({name: "Doom",
    creator: "id Software", publisher: "id Software"});
    protected function button1_clickHandler(event:MouseEvent):void
    BindingUtils.bindProperty(dgSelectedGames,"dataProvider" ,dgAllGames ,"selectedItems");
    ]]>
    </mx:Script>
    <mx:Label x="11" y="67" text="All our data"/>
    <mx:Label x="10" y="353" text="Selected Data"/>
    <mx:Form x="144" y="10" height="277">
    <mx:DataGrid id="dgAllGames" width="417" height="173"
    creationComplete="{initDGAllGames()}" dataProvider="{allGames}" editable="false">
    <mx:columns>
    <mx:DataGridColumn headerText="Game Name" dataField="name" width="115"/>
    <mx:DataGridColumn headerText="Creator" dataField="creator"/>
    <mx:DataGridColumn headerText="Publisher" dataField="publisher"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:FormItem label="Label">
    <mx:Button label="Move" click="button1_clickHandler(event)"/>
    </mx:FormItem>
    </mx:Form>
    <mx:Form x="120" y="333">
    <mx:DataGrid id="dgSelectedGames" width="417" height="110" >
    <mx:columns>
    <mx:DataGridColumn headerText="Game Name" dataField="name" width="115"/>
    <mx:DataGridColumn headerText="Creator" dataField="creator"/>
    <mx:DataGridColumn headerText="Publisher" dataField="publisher"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Form>
    </mx:Application>
    Link:
    http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/ae9bee8d-e2ac-43 c5-9b6d-c799d4abb2a3/
    Thanks and Regards,
    Vibhuti Gosavi | [email protected] | www.infocepts.com

  • Button click handler using values through UDPClient

    I am making a BCI system for my master thesis, and I am new to C#, so I would like to know if it is possible to click a button through a value obtained though a fx UDP client.
    What I wloud like to do :
    Acquirer data through MATALB -> send the data to the BCI interface made in Visual Studio WF Application -> the values clicks the button represtented by the specific value, and so forth.
    It is the possibility I am seeking, I have not found any really usable online yet.
    Question:
    Is it possible to click a button using a value instead of mouseclick in Windows forms Application?
    - Andrew have mentioned button.PerformClick()
    Method, could this sovle the problem?
    Thanks for answers.
    Regards 
    Aslak

    Hej Andrew,
    Thanks, I have just had trouble finding a example regarding this. I am allmost new to all in C#, so are there any webpages I could look at that you kow that could help ?
    Regards 
    Aslak
    You're not likely to find a webpage with an example such as you've described, no.
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    namespace CS_WinFormsSnippet
    public partial class Form1 : Form
    public Form1()
    InitializeComponent();
    Button myButton = new Button();
    private void Form1_Load(object sender, EventArgs e)
    myButton.Text = @"It's Christmas at Ground Zero!";
    myButton.Click += new EventHandler(myButton_Click);
    myButton.Dock = DockStyle.Fill;
    this.Controls.Add(myButton);
    System.Threading.ThreadStart ts = new System.Threading.ThreadStart(this.myButton_TimedClicker);
    System.Threading.Thread t = new System.Threading.Thread(ts);
    t.IsBackground = true; // makes the thread die with the process.
    t.Start();
    void myButton_Click(object sender, EventArgs e)
    if (e.GetType().Equals(typeof(ButtonClickEventArgsWithValue)))
    MessageBox.Show(@"... and if the radiation level's okay, I'll go out with YOU to see all the neeeeew muuuutations on New Year's Day!");
    else
    MessageBox.Show(@"The Button has been preeeeessed...");
    // "Christmas At Ground Zero" is a classic holiday tune by Weird Al Yankovic.
    void myButton_TimedClicker()
    do
    System.Threading.Thread.Sleep(20000); // wait 20 seconds.
    this.myButton_Click(null, new ButtonClickEventArgsWithValue(2));
    } while (true); // just keep going until the form is closed. don't worry, it's a background thread.
    // You can still click the button on the form to see the first messagebox without the second. The second messagebox only shows up when you call the click event programmatically, using the specified EventArgs inheritor.
    public class ButtonClickEventArgsWithValue : EventArgs
    public Int32 eventValue = 0;
    public ButtonClickEventArgsWithValue(Int32 value)
    this.eventValue = value;
    Would you like to know more?

  • Launch Internet Explorer using button click

    Hello friends
    I want that on click of a button Internet Explorer opens with an html file. Actually the file which opens is a report which I want to show to the user.
    Please help me in doing this.

    you could try doing something like this in your button click handler
    String command = "c:\\program files\\Internet Explorer\\iexplore.exe c:\yourfile.html"
    Runtime rt = Runtime.getRunTime();
    rt.exec(command);

  • Result handler not getting invoked on button click - URGENT

    Hi Folks,
    We are working on a form submit application where we populate the form and finally click on button to submit the completed form. We are using BlazeDs On button click I call java service and expect a response object back to flex UI. We are getting the java call invoked successfully and the log clearly shows that the appropriate objects are returned from java service, however, the result handler is not getting inviked to capture the result in flex mxml. I am in urgent need of your help on this
    Code snippet:
    <mx:Script>
    <![CDATA[
    protected  
    function Service_resultHandler(event:ResultEvent):void
    Alert.show(
    "event.result.troubleTicketId ::"+event.result.status); 
    var u:URLRequest = new URLRequest("http://www.adobe.com/flex");navigateToURL(u,
    "_blank"); 
    private function faultHandler_exitService(event:FaultEvent):void {Alert.show(event.fault.faultString +
    '\n' + event.fault.faultDetail); 
    var u:URLRequest = new URLRequest("http://www.google.com");navigateToURL(u,
    "_blank"); 
    protected  
    function submit_clickHandler():void
    //Alert.show("1");
    createTicketForm.setCallDetails_callRegion(FlexUI_callDetails_callRegion);
    //Alert.show("2"+FlexUI_callDetails_callRegion);
    createTicketForm.setCallDetails_callRegion2(FlexUI_callDetails_callRegion2);
    exitService.createTroubleTicket(createTicketForm);
    ]]>
     </mx:Script>  
    <mx:RemoteObject id="exitService" destination="ExitService" fault="faultHandler_exitService(event)">
    <mx:method name="createTroubleTicket" result="Service_resultHandler(event)"/>
    </mx:RemoteObject>
    <mx:Button 
    label="submit Ticket" width="65" height="22" textAlign="right" x="904" y="-10" click="submit_clickHandler()" />
    My Java service:
    public  
    class ExitService {  
    public CreateTmsTicketResponse createTroubleTicket(CreateTicketForm createTicketForm){
    return  
    createTmsTicketResponse;}
    remoting-config.xml:
     <destination id="ExitService">  
    <properties>  
    <source>com.qwest.qportal.flex.createTicket.ExitService</source>  
    </properties>
     </destination>

    Please refer to below link, hope it helps:
    http://forums.asp.net/t/1927214.aspx?The+IListSource+does+not+contain+any+data+sources+
    Please ensure that you mark a question as Answered once you receive a satisfactory response.

  • Invoking another form from a button click..

    Hi,...
    I am a beginner in Java Swing Programming using the Netbeans IDE.I want to invoke a form from an existing form thru a button click; thnx...
    Code:
    1st form : NewJFrame.java
    public class NewJFrame extends javax.swing.JFrame {
    /** Creates new form NewJFrame */
    public NewJFrame() {
    initComponents();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
    jButton1 = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    jButton1.setText("jButton1");
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(151, 151, 151)
    .addComponent(jButton1)
    .addContainerGap(176, Short.MAX_VALUE))
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(130, 130, 130)
    .addComponent(jButton1)
    .addContainerGap(147, Short.MAX_VALUE))
    pack();
    }// </editor-fold>
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new NewJFrame().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    // End of variables declaration
    2nd Form:
    public class NewJFrame1 extends javax.swing.JFrame {
    /** Creates new form NewJFrame1 */
    public NewJFrame1() {
    initComponents();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGap(0, 400, Short.MAX_VALUE)
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGap(0, 300, Short.MAX_VALUE)
    pack();
    }// </editor-fold>
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new NewJFrame1().setVisible(true);
    }

    shelton141 wrote:
    using the Netbeans IDE.I want to invoke a form from an existing form thru a button clickNote that, instead of JFrame, we normally use JDialog (either a modal or a non modal) for secondary windows.
    We can add an actionPerformed event to the jButton1 in design mode, or manually like this:
    public NewJFrame() {
        initComponents();
        jButton1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                new NewJFrame1().setVisible(true);
    }

  • Invoke Event Recievers on button click

    Hi all,
    I Have an Event Reciever which updated a column of the list whose name is specified,
    I have an Webpart with ListName(Txt Box) and a Button Control,
    On click of which the Event Reciever that I have created should be invoked on the ListName Given in the Txt Box.
    How can I do this, plz help
    Thanks in advance

    Hi,
    Now If i am correct then you just want to activate an EventReciever on click of button on a Page using Object Model code and you have your Event Reciever already deployed and register in Global Assembly Cache.
    To do this just add this code on the button click event on page.
    using (SPSite site = new SPSite(SPContext.Current.Web.Url))
    using (web = site.OpenWeb())
    SPList list = web.Lists["ListName"];
    if (list != null)
    string className = "YourClassNameSpace.YourClass";
    string asmName = "NameOftheAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken={PublicKeyToken}";
    web.AllowUnsafeUpdates = true;
    //add the added/updated/deleted events to the list.
    list.EventReceivers.Add(SPEventReceiverType.ItemAdded, asmName, className);
    list.EventReceivers.Add(SPEventReceiverType.ItemUpdated, asmName, className);
    list.EventReceivers.Add(SPEventReceiverType.ItemDeleted, asmName, className);
    list.Update();
    Mark as Answer if helped!! To be or Not to Be..The question is this only......

  • Button Event Handler in a JList, Please help.

    Hi everyone,
    I have created a small Java application which has a JList. The JList uses a custom cell renderer I named SmartCellRenderer. The SmartCellRenderer extends JPanel and implements the ListCellRenderer. I have added two buttons on the right side inside the JPanel of the SmartCellRenderer, since I want to buttons for each list item, and I have added mouse/action listeners for both buttons. However, they don't respond. It seems that the JList property overcomes the buttons underneath it. So the buttons never really get clicked because before that happens the JList item is being selected beforehand. I've tried everything. I've put listeners in the Main class, called Editor, which has the JList and also have listeners in the SmartCellRenderer itself and none of them get invoked.
    I also tried a manual solution. Every time the event handler for the JList was invoked (this is the handler for the JList itself and not the buttons), I sent the mouse event object to the SmartCellRenderer to manually check if the point the click happened was on one of the buttons in order to handle it.
    I used:
    // Inside SmartCellRenderer.java
    // e is the mouse event object being passed from the Editor whenever
    // a JList item is selected or clicked on
    Component comp = this.getComponent (e.getX(), e.getY())
    if(!(comp instanceof JButton)) {
              System.out.println("Recoqnized Event, but not a button click...");
              //return;
    } else {
              System.out.println("Recognized Event, IT IS A MOUSE CLICK, PROCESSING...");
              System.out.println("VALUE: "+comp.toString());
    What I realized is that not only this still doesn't work (it never realizes the component as a JButton) it also throws an exception for the last line saying comp is null. Meaning with the passed x,y position the getComponent() returns a null which happens when the coordinates passed to it are outside the range of the Panel. Which is a whole other problem?
    I have yet to find an example on the web, using Google, that demonstrated using buttons inside a JList.
    Can anyone help me with this. Thanks.

    A renderer is not a component, so you can't click on it. A renderer is just used to paint a representation of a component at a certain position in your JList.
    I have yet to find an example on the web, using Google, that demonstrated using buttons inside a JList.Thats probably because this is not a common design. The following two designs are more common:
    a) Create a separate panel for your JButtons. Then when you click on the button it would act on each selected row in the JList
    b) Or maybe like windows explorer. Select the items in the list and then use a JPopupMenu to perform the desired functionality.
    I've never tried to add a clickable button to a panel, but this [url http://forum.java.sun.com/thread.jspa?threadID=573721]posting shows one way to add a clickable JButton as a column in a JTable. You might be able to use some of the concepts to add 2 button to the JPanel or maybe you could use a JTable with 3 columns, one for your data and the last two for your buttons.

  • I am trying to fill in a PDF online- there should be a submit button but it isn't showing. My partner has an identical Mac and can see the button- what do I change in system preferences to resolve?

    I am trying to fill in a PDF form online- there should be a submit button but it isn't showing. My partner has an identical Mac and can see the button when he opens the same page- what do I change in my systen system preferences to resolve this?

    You and your partner might have different browsers, different versions of the same browser, or most likely a fervent version of the PDF plug-in.
    See if just clicking on the Enter key sends the form in.

  • How can I display a new scene in JavaFX 2.2? For example after button click

    how to display new scene after button click in the main window, I want the main window and the new scene are in one stage. thx

    You can change the scene by calling stage.setScene(new Scene(newContentParent));
    I don't think you are quite asking for a complete scene change though as you "want the main window and the scene in one stage". The main window is a stage (as Stage extends Window). And a given stage can only contain one scene at a time (though you can swap it out by calling setScene as described earlier).
    What I think you are really asking for how can you replace some content part of the active Scene on the Stage. To do that you can set a layout manager like a HBox or a BorderPane as the root of your scene, then change out the content of the layout manager. For example:
    final BorderPane layout = new BorderPane();
    layout.setCenter(new Label("Dogbert");
    final Button nav = new Button("Next");
    layout.setLeft(nav);
    nav.setOnAction(new EventHandler<ActionEvent>() {
      @Override public void handle(ActionEvent actionEvent) {
        layout.setCenter(new Label("Dilbert"));       
    });In the above short sample code, if you wanted to change the scene rather than the a pane, then you would call stage.setScene rather than layout.setCenter.
    There is a complete executable example with multiple content panes and some styling here:
    http://stackoverflow.com/questions/13556637/how-to-have-menus-in-java-desktop-application

  • How can I get a List ID information using JScript on ribbon button click - SharePoint2010

    Dear All,
    I want to display the custom list ID column information on ribbon button click using a JScript.
    For This I have added a JScript in Layout folder in VS 2010 empty project solution and I have put
    the following Jscript code. While running and clicking the ribbon button, it seems like JScript is not
    invoking and not producing any result. It is like control is not going to Jscript file. How can I find out
    the issue???? can anyone please help me on anything wrong with my script or is
    it some-other problem which causes the blank result???
    It is a farm sharepoint2010 solution, debugging is not working in Visual Studio & IE!!!!
    Somebody please help, hard to find the error.....
    Please note the JScript Code: RibAlert.js
    <script>
    '//var siteUrl = '/sites/MySiteCollection';
    var siteUrl = 'http://a5-12457/AllItems.aspx';
    function retrieveListItems()
    var clientContext = new SP.ClientContext(siteUrl);
    var oList = clientContext.get_web().get_lists().getByTitle('Custom List');
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
    '<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
    this.collListItem = oList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    function onQuerySucceeded(sender, args)
    var listItemInfo = '';
    var listItemEnumerator = collListItem.getEnumerator();
    while (listItemEnumerator.moveNext())
    var oListItem = listItemEnumerator.get_current();
    listItemInfo += '\nID: ' + oListItem.get_id() +
    '\nTitle: ' + oListItem.get_item('Title') +
    '\nBody: ' + oListItem.get_item('Body');
    alert(listItemInfo.toString());
    function onQueryFailed(sender, args)
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    </script>
    Please note the Elements.xml
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
    Id="CustomRibbonButton"
    Location="CommandUI.Ribbon"
    RegistrationId="100"
    RegistrationType="List">
    <CommandUIExtension>
    <CommandUIDefinitions>
    <CommandUIDefinition
    Location="Ribbon.ListItem.Manage.Controls._children">
    <Button
    Id="Ribbon.ListItem.Manage.Controls.TestButton"
    Command="ShowAlert"
    Image16by16="http://a5-12457/IconLib/ICONBTN.jpg"
    Image32by32="http://a5-12457/IconLib/ICONBTN.jpg"
    LabelText="Comapre alert"
    TemplateAlias="o2"
    Sequence="501" />
    </CommandUIDefinition>
    </CommandUIDefinitions>
    <CommandUIHandlers>
    <!-- <CommandUIHandler Command="AboutButtonCommand" CommandAction="javascript:alert();" EnabledScript="javascript:enable();"/> -->
    <CommandUIHandler Command="ShowAlert" CommandAction="javascript:alert();" EnabledScript="return true;"/>
    </CommandUIHandlers>
    </CommandUIExtension>
    </CustomAction>
    <!-- <CustomAction Id="Ribbon.Library.Actions.Scripts" Location ="ScriptLink" ScriptSrc="/_layouts/DocumentTabTwo/RibButton.js" /> -->
    <CustomAction Id="Ribbon.Library.Actions.Scripts" Location ="ScriptLink" ScriptSrc="/_layouts/RibAlert.js" />
    </Elements>

    Dear All,
    I want to display the custom list ID column information on ribbon button click using a JScript.
    For This I have added a JScript in Layout folder in VS 2010 empty project solution and I have put
    the following Jscript code. While running and clicking the ribbon button, it seems like JScript is not
    invoking and not producing any result. It is like control is not going to Jscript file. How can I find out
    the issue???? can anyone please help me on anything wrong with my script or is
    it some-other problem which causes the blank result???
    It is a farm sharepoint2010 solution, debugging is not working in Visual Studio & IE!!!!
    Somebody please help, hard to find the error.....
    Please note the JScript Code: RibAlert.js
    <script>
    '//var siteUrl = '/sites/MySiteCollection';
    var siteUrl = 'http://a5-12457/AllItems.aspx';
    function retrieveListItems()
    var clientContext = new SP.ClientContext(siteUrl);
    var oList = clientContext.get_web().get_lists().getByTitle('Custom List');
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
    '<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
    this.collListItem = oList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    function onQuerySucceeded(sender, args)
    var listItemInfo = '';
    var listItemEnumerator = collListItem.getEnumerator();
    while (listItemEnumerator.moveNext())
    var oListItem = listItemEnumerator.get_current();
    listItemInfo += '\nID: ' + oListItem.get_id() +
    '\nTitle: ' + oListItem.get_item('Title') +
    '\nBody: ' + oListItem.get_item('Body');
    alert(listItemInfo.toString());
    function onQueryFailed(sender, args)
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    </script>
    Please note the Elements.xml
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
    Id="CustomRibbonButton"
    Location="CommandUI.Ribbon"
    RegistrationId="100"
    RegistrationType="List">
    <CommandUIExtension>
    <CommandUIDefinitions>
    <CommandUIDefinition
    Location="Ribbon.ListItem.Manage.Controls._children">
    <Button
    Id="Ribbon.ListItem.Manage.Controls.TestButton"
    Command="ShowAlert"
    Image16by16="http://a5-12457/IconLib/ICONBTN.jpg"
    Image32by32="http://a5-12457/IconLib/ICONBTN.jpg"
    LabelText="Comapre alert"
    TemplateAlias="o2"
    Sequence="501" />
    </CommandUIDefinition>
    </CommandUIDefinitions>
    <CommandUIHandlers>
    <!-- <CommandUIHandler Command="AboutButtonCommand" CommandAction="javascript:alert();" EnabledScript="javascript:enable();"/> -->
    <CommandUIHandler Command="ShowAlert" CommandAction="javascript:alert();" EnabledScript="return true;"/>
    </CommandUIHandlers>
    </CommandUIExtension>
    </CustomAction>
    <!-- <CustomAction Id="Ribbon.Library.Actions.Scripts" Location ="ScriptLink" ScriptSrc="/_layouts/DocumentTabTwo/RibButton.js" /> -->
    <CustomAction Id="Ribbon.Library.Actions.Scripts" Location ="ScriptLink" ScriptSrc="/_layouts/RibAlert.js" />
    </Elements>

  • How to get a form field valud in delete PL/SQL Button Event Handler

    Hi Friend,
    I have a form. when user clicks delete button. we want to remove system dodelete function
    and add a delete script
    Under delete-top category,
    how can I get value of form EVENT_NUMBER field in form at delete PL/SQL Button Event Handler?
    DELETE FROM PTEAPP.PTE_EVENTS WHERE eventnumber = EVENT_number
    But when I try to save this form and get message as
    1721/15 PLS-00201: identifier 'EVENT_NUMBER' must be declared
    Thanks for any help!
    newuser

    I did something similar but wasn't using a stored procedure. Couldn't you set a flag variable once you know you're not doing the insert and in the "before displaying the form" section put an IF to check if your flag was set, and if so do an HTP.Print('You are overpaid buddy!');
    Then just reset your flag.

  • Call Web Dynpro application on a button Click.

    Hi,
    I have 2 web dynpro components.(COMP1 and COMP2). I wants to call  the application of COMP2  from a button click  from COMP1.
    1. In COMP1  view i have a button. I have  created an outbound plug 'TO_APP'  with parameter 'URL' type string.
    2.  Inside the event handler method for the button i have  written the code as given below.
      data str_url type string.
      CALL METHOD cl_wd_utilities=>construct_wd_url
        EXPORTING
          application_name              = 'COMP2_APP'
        IMPORTING
          out_absolute_url              = str_url
      wd_this->fire_to_app_plg(
        url =                               str_url
    When i click the button it wont navigate to COMP2. Is there any other step required ?
    Please helps me to solve this issue...
    Regards,
    Shaira.

    Hi,
       To call URL in same window first create an outbound plug in your current window(ex: EXIT_PLUG ),mark this
       EXIT_PLUG as interface and plug type EXIT. Now use the following code in your button action.
    data : lr_view_cont TYPE REF TO if_wd_view_controller.
    data : lr_win_cont TYPE REF TO if_wd_window_controller.
    data : lt_parameter_list type wdr_event_parameter_list.
    data : ls_parameter type wdr_event_parameter.
    data : lr_val type ref to data.
    data : lr_comusg type ref to if_wd_component_usage.
    field-SYMBOLS : <fs> type any.
    lr_view_cont = wd_this->wd_get_api( ).
    CALL METHOD LR_VIEW_CONT->GET_EMBEDDING_WINDOW_CTLR
      RECEIVING
        RESULT = lr_win_cont
    ls_parameter-name = 'URL'.
    create data lr_val type string.
    assign lr_val->* to <fs>.
    <fs> = 'HTTP://APPLICATION URL' .                                       "PASS YOUR URL HERE
    ls_parameter-value = lr_val.
    insert ls_parameter into TABLE lt_parameter_list.
    lr_win_cont->if_wd_view_controller~fire_plug(
    exporting
        plug_name = 'EXIT_PLUG'
        parameters = lt_parameter_list ).

  • Resizing JFrame on button click to show an image on the JFrame

    Dear All,
    I have a JFrame which has an empty label. On button click I want to set an icon for the label and want the JFrame to be resized to show that icon. I am using frame.pack() and I am not using any other sizing function. The code that I have right now, prints the image on the panel, but does not resize the frame to show the image. Pleae could someone help.package gui;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ItemEvent;
    import java.awt.event.ItemListener;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    public class ComponentDemo extends JPanel implements ActionListener,
    ItemListener, MouseListener, KeyListener {
         private JTextArea textarea;
         private JButton button;
         private final static String newline = "\n";
         private JLabel imageIcon;
         public ComponentDemo() {
              button = new JButton("JButton welcomes you  to CO2001");
              button.addActionListener(this);
              add(button);
              textarea = new JTextArea(10, 50);
              textarea.setEditable(false);
              addMouseListener(this);
              textarea.addKeyListener(this);
              JScrollPane scrollPane = new JScrollPane(textarea);
              add(scrollPane);
              imageIcon = new JLabel();
              add(imageIcon);
              setBackground(Color.pink);
              new JScrollPane(this);
          * Create the GUI and show it. For thread safety, this method should be
          * invoked from the event-dispatching thread.
         private static void createAndShowGUI() {
              // Create and set up the window.
              JFrame frame = new JFrame("Simple FrameDemo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              frame.setLocation(700, 200);
              // get the content pane and set the background colour;
              frame.add(new ComponentDemo());
         //     frame.setSize(screenSize);
              // frame.getContentPane().setBackground(Color.cyan);
              // Display the window.
              frame.pack();
              frame.setVisible(true);
              frame.setResizable(true);
         public static void main(String[] args) {
              // Schedule a job for the event-dispatching thread:
              // creating and showing this application's GUI.
              javax.swing.SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        createAndShowGUI();
         @Override
         public void actionPerformed(ActionEvent e) {
              // TODO Auto-generated method stub
              if (e.getSource() instanceof JButton) {
                   // System.out.println(e.getSource());
                   String text = ((JButton) e.getSource()).getText();
                   textarea.append(text + newline);
                   textarea.setBackground(Color.cyan);
                   textarea.setForeground(Color.BLUE);
                   textarea.setCaretPosition(textarea.getDocument().getLength());
                   imageIcon.setIcon(createImageIcon("SwingingDuke.png",
                   "Image to be displayed"));
         @Override
         public void itemStateChanged(ItemEvent arg0) {
              // TODO Auto-generated method stub
         @Override
         public void mouseClicked(MouseEvent arg0) {
              textarea.append("A Mouse click welcomes you to CO2001" + newline);
              textarea.setBackground(Color.green);
              textarea.setCaretPosition(textarea.getDocument().getLength());
         @Override
         public void mouseEntered(MouseEvent arg0) {
              // TODO Auto-generated method stub
         @Override
         public void mouseExited(MouseEvent arg0) {
              // TODO Auto-generated method stub
         @Override
         public void mousePressed(MouseEvent arg0) {
              // TODO Auto-generated method stub
         @Override
         public void mouseReleased(MouseEvent arg0) {
              // TODO Auto-generated method stub
         @Override
         public void keyPressed(KeyEvent e) {
              System.out.println(e.getKeyChar());
              textarea.append("The key " + e.getKeyChar()
                        + " click welcomes you to CO2001" + newline);
              textarea.setBackground(Color.YELLOW);
              textarea.setFont(new Font("Arial", Font.ITALIC, 16));
              textarea.setCaretPosition(textarea.getDocument().getLength());
         @Override
         public void keyReleased(KeyEvent e) {
              System.out.println(e.getKeyChar());
              // textarea.append("The key "+
              // e.getKeyChar()+" click welcomes you to CO2001" + newline);
              // textarea.setBackground(Color.green);
              // textarea.setCaretPosition(textarea.getDocument().getLength());
         @Override
         public void keyTyped(KeyEvent e) {
              // TODO Auto-generated method stub
              System.out.println(e.getKeyChar());
              // textarea.append("The key "+
              // e.getKeyChar()+" click welcomes you to CO2001" + newline);
              // textarea.setBackground(Color.blue);
              // textarea.setCaretPosition(textarea.getDocument().getLength());
         /** Returns an ImageIcon, or null if the path was invalid. */
         protected ImageIcon createImageIcon(String path, String description) {
              java.net.URL imgURL = getClass().getResource(path);
              if (imgURL != null) {
                   System.out.println("found");
                   return new ImageIcon(imgURL, description);
              } else {
                   System.err.println("Couldn't find file: " + path);
                   return null;
    }

    myJPanel.setPerferredSize(new Dimension(new_width, new_hight));
    myJFrame.pack();

  • Please HELP on Button Click. URGENT Folks.!!!

    Folks,
    I need some very URGENT help.
    When I click a Button,how do I associate this Button clicked with a particular Key?
    I am reading data from a Hashtable in the foll.format
    Monday Data [ More Info]
    Tuesday Data [ More Info]
    where :
    Data to display is a Label
    [More Info] is a JButton.
    But I am unable to associate the button clicked with that particular Data.
    ie I am unable to link the button clicked with the Key its associated to.
    So when I click the 2nd More Info Button,I must be associated with Tuesday Data.
    I am not being able to link Button Clicked to its Key Value.
    Any one can help me to get the Key Value please?
    Or is displayng thru Hashtable not right? Do I need to use some
    other collection.
    My code is:
    public class JPanelDemo extends JFrame{
    private JPanel JButtonPanel;
    private Hashtable ht = new Hashtable();
    Enumeration enum;
    String str;
    public JPanelDemo() {
    JButtonPanel = new JPanel();
    Container c = getContentPane();
    // Put Data into Table.
    ht.put("Monday ", new JButton("More Info"));
    ht.put("Tuesday ", new JButton("More Info"));
    ht.put("Wednesday ", new JButton("More Info"));
    ht.put("Thursday ", new JButton("More Info"));
    JButtonPanel.setLayout(new GridLayout(ht.size(),ht.size()) ) ;
    // Instantiate ButtonHandler.
    ButtonHandler handler = new ButtonHandler();
    // Enumerate thru Keys.
    enum = ht.keys();
    while(enum.hasMoreElements()){
    str = (String) enum.nextElement();
    JButtonPanel.add(new JLabel(str)); // Key
    JButton jB = (JButton)ht.get(str); // Value
    JButtonPanel.add(jB);
    jB.addActionListener(handler);
    c.add(JButtonPanel,BorderLayout.NORTH);
    show();
    public static void main(String[] args) {
    JPanelDemo JPanelDemo1 = new JPanelDemo();
    // Inner Class for BUTTON handling.
    private class ButtonHandler implements ActionListener {
    public void actionPerformed(ActionEvent e) {
    JOptionPane.showMessageDialog(null,
    "You Pressed " + e.getActionCommand(),
    "I NEED THE KEY VALUE HERE", /* key VALUE required ie Monday,Tuesday..*?
    0);
    } // End ButtonHandler.
    } // End of class

    Hi,
    i have modified your program to produce the intended results..
    Hope this helps!
    josh
    public class JPanelDemo extends JFrame{
    private JPanel JButtonPanel;
    private Hashtable ht = new Hashtable();
    Enumeration enum;
    String str;
    public JPanelDemo() {
    JButtonPanel = new JPanel();
    Container c = getContentPane();
    // Put Data into Table.
    ht.put("Monday ", new JButton("More Info"));
    ht.put("Tuesday ", new JButton("More Info"));
    ht.put("Wednesday ", new JButton("More Info"));
    ht.put("Thursday ", new JButton("More Info"));
    JButtonPanel.setLayout(new GridLayout(ht.size(),ht.size()) ) ;
    // Instantiate ButtonHandler.
    ButtonHandler handler = new ButtonHandler();
    // Enumerate thru Keys.
    enum = ht.keys();
    while(enum.hasMoreElements()){
    str = (String) enum.nextElement();
    JButtonPanel.add(new JLabel(str)); // Key
    JButton jB = (JButton)ht.get(str); // Value
    JButtonPanel.add(jB);
    jB.addActionListener(handler);
    c.add(JButtonPanel,BorderLayout.NORTH);
    show();
    public static void main(String[] args) {
    JPanelDemo JPanelDemo1 = new JPanelDemo();
    public String compare(JButton b){
    int i = ht.size();
    Enumeration enum1 = ht.keys();
    while(enum1.hasMoreElements()){
    String str = (String) enum1.nextElement();
    JButton jB = (JButton)ht.get(str); // Value
    if( jB.equals(b) ){
    return str;
    return null;
    // Inner Class for BUTTON handling.
    private class ButtonHandler implements ActionListener {
    public void actionPerformed(ActionEvent e) {
    JButton b = (JButton)e.getSource();
    String s = compare(b);
    JOptionPane.showMessageDialog(null,
    "You Pressed " + s,
    "I NEED THE KEY VALUE HERE",0);
    } // End of class

Maybe you are looking for

  • Need Help in Breaking a big view into multiple small views or tuning the vw

    Hi I have the following view can some one help me in breaking the view in small views or any recommendations for tuning it. CODE CREATE OR REPLACE FORCE VIEW "CRUVPD"."PX16_CHK_VW_SUMMARY_VW" ("CIDN", "BATCH_NUMBER", "BUSINESS_UNIT", "CHECK_VOUCHER_N

  • How do you duplicate a page inside a PDF?

    I have a multipage PDF and ive never been able to figure out how to duplicate a page I have inside without duplicating the file and pulling a page out and dragging into the other file.  Just a long way of doing this for something that seems so simple

  • New pdf window

    i have a button on my flash 8 site which opens a new window by getting a url of a pdf i have in the same folder as the index.swf but when it opens the pdf it opens it with all the trimmings... ie. toolbar, buttons etc. how would you set it to open it

  • Where to look for time preordering starts

    Where should we look to get the exact time that the pre-ordering of the iphone 5 will begin from the verizon wireless website on the 14th?

  • What can I do if my iMac 2010 27" harddisk broken?

    Dear all expert, Hi!i came from Hong Kong. I am not covered by Apple Care and have a few queries on this issues: 1. What is the estimated cost of repairing or replacing the harddisk in Apple store? 2. Can Apple replace a new harddisk which brought fr