Program generated button click

How can I make my program "click" one of the JButtons in the user interface?
I have a menu item and a JButton, both created with a subclassed AbstractAction.
Somewhere in my program I want to trigger the same sequence of events which would occur if the end user clicked on the button or the menu item.

Yes, I'm new to forums. I thought, in retrospect, that this was a better place to post this question.
By the way, do you have an answer to the question?

Similar Messages

  • How do I make this program generate a new problem once the button is hit

    Here is the code... appreciate any help given
    How do I make this program generate a new set of problem when the "NEXT" button is clicked and continue until the END button is hit
    package javaapplication3;
    import java.awt.GridLayout;
    import java.awt.Window;
    import javax.swing.*;
    import java.awt.event.*;
    * @author Sylvester Saulabiu
    class Grid extends JFrame{
        final int score = 0;
        final int total = 0;
        Grid(){
            //Set Layout of Flashcard
            setLayout(new GridLayout(4, 4, 2 , 2));
            //Create Panels
            JPanel p2 = new JPanel();
            JPanel p3 = new JPanel();
            final JPanel p1 = new JPanel();
            //Create Radio buttons & group them
            ButtonGroup group = new ButtonGroup();
            final JRadioButton ADD = new JRadioButton("Addition");
            final JRadioButton SUB = new JRadioButton("Subtraction");
            final JRadioButton MUL = new JRadioButton("Multiplication");
            final JRadioButton DIV = new JRadioButton("Division");
            p2.add(ADD);
            p2.add(SUB);
            group.add(ADD);
            group.add(SUB);
            group.add(MUL);
            group.add(DIV);
            p2.add(ADD);
            p2.add(SUB);
            p2.add(DIV);
            p2.add(MUL);
            //Create buttons
            JButton NEXT = new JButton("NEXT");
            JButton END = new JButton("End");
            //Create Labels
            JLabel l1 = new JLabel("First num");
            JLabel l2 = new JLabel("Second num");
            JLabel l3 = new JLabel("Answer:");
            JLabel l4 = new JLabel("Score:");
            final JLabel l5 = new JLabel("");
            JLabel l6 = new JLabel("/");
            final JLabel l7 = new JLabel("");
            //Create Textfields
            final JTextField number = new JTextField(Generator1());
            final JTextField number2 = new JTextField(Generator1());
            final JTextField answer = new JTextField(5);
            //Add to panels
            p1.add(l1);
            p1.add(number);
            p1.add(l2);
            p1.add(number2);
            p1.add(l3);
            p1.add(answer);
            p1.add(l4);
            p1.add(l5);
            p1.add(l6);
            p1.add(l7);
            p3.add(NEXT);
            p3.add(END);
            //Add panels
            add(p2);
            add(p1);
            add(p3);
            //Create Listners
      NEXT.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
             int answer1 = 0;
             //Grab the numbers entered
             int numm1 = Integer.parseInt(number.getText());
             int numm2 = Integer.parseInt(number2.getText());
             int nummsanswer = Integer.parseInt(answer.getText());
             //Set the score and total into new variabls
             int nummscore = score;
             int nummtotal = total;
             //Check if the add radio button is selected if so add
             if (ADD.isSelected() == true){
                 answer1 = numm1 + numm2;
             //otherwise check if the subtract button is selected if so subtract
             else if (SUB.isSelected() == true){
                 answer1 = numm1 - numm2;
             //check if the multiplication button is selected if so multiply
             else if (MUL.isSelected() == true){
                 answer1 = numm1 * numm2;
             //check if the division button is selected if so divide
             else if (DIV.isSelected() == true){
                 answer1 = numm1 / numm2;
             //If the answer user entered is the same with th true answer
             if (nummsanswer == answer1){
                 //add to the total and score
                 nummtotal += 1;
                 nummscore += 1;
                 //Convert the input back to String
                 String newscore = String.valueOf(nummscore);
                 String newtotal = String.valueOf(nummtotal);
                 //Set the text
                 l5.setText(newscore);
                 l7.setText(newtotal);
             //Otherwise just increase the total counter
             else {
                 nummtotal += 1;
                 String newtotal = String.valueOf(nummtotal);
                 l7.setText(newtotal);
      //Create End listener
    END.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // get the root window and call dispose on it
            Window win = SwingUtilities.getWindowAncestor(p1);
            win.dispose();
    String Generator1(){
         int randomnum;
         randomnum = (1 + (int)(Math.random() * 20));
         String randomnumm = String.valueOf(randomnum);
         return randomnumm;
    public class Main {
         * @param args the command line arguments
        public static void main(String[] args) {
            // TODO code application logic here
            JFrame frame = new Grid();
            frame.setTitle("Flashcard Testing");
            frame.setSize(500, 200);
            frame.setLocationRelativeTo(null);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
    }Edited by: SirSaula on Dec 5, 2009 4:39 PM

    Extract code into methods, so that when an action is performed a method is called. That way you can reuse the method for purposes such as resetting textfields to their default values, scores to default values, etc.
    You can go one step further and seperate the GUI layer from the processing layer, by deriving classes that for example maintain and calculate a score.
    Mel

  • How to generate barcode on button click event in PDF using adobe livecycle?

    I already created form in PDF file which is validate completely .But , I required generate a barcode of all field of form using custom script on button click event.
    Please give me right way for doing it .
    Thanks in Advance,
    Jaydeep Solanki.

    Hi vijay,
    What project are you doing? Is it Asp.Net project? If so, you'll need to post it in the dedicated ASP.Net Forum
    http://forums.asp.net  for more efficient responses, where you can contact ASP.NET experts.
    Have a nice day!
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to generate .xls file on a button click in Forms 10g

    Hi
    I am using forms 10g.
    On a button click I want to generate a .csv or .xls file (data in these file should be fetched form database).
    Could you please tell me how can I do this?
    Regards

    Hello 576726,
    where do you want to store the file?
    On the client? If it uses Windows as OS and has Excel installed you can use CLIENT_OLE2, otherwise you can write files using CLIENT_TEXT_IO.
    On the server? You can use utl_file or a package that allowes to write formatted/multiple worksheets like
    https://xml-spreadsheet.samplecode.oracle.com/ or
    https://exceldocumenttype.samplecode.oracle.com/
    Another solution by Friedhold Matz is linked at Re: Gride in Oracle Formns 6i
    Regards
    Marcus
    Edited by: Marwim on 17.11.2010 07:18

  • Conversion program generated with errors

    in lsmw idoc method at the step 11 convert data iam getting error as conversion program generated with errors can some body help me .i assigned port ,partnertype and partner number and activated inbound processing but still getting this error.somebody pls help me its urgent.

    Hi Mamidi,
    Go to the LSMW you have choosen and if it is Recording Method you are getting this error.
    Select Goto-->Recordings.
    Select the Recording you have choosen in the Edit Mode.
    Click on the Defaults All Button and save the recording.
    Now go to the option Convert Data and check .
    You will receive a message ..Conversion program successfully generated.
    Thanks,
    Sri

  • 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);
    }

  • Generate button

    Hello guys..
    What is the importance of 'generate' button while making condition tables in a condition technique?
    Explaine how to create or maintain condition tables in condtion technique in step by step manner.
    And also explain the importance of each step.
    Thanks in advance
    regards
    vamshi

    A condition table is a work bench request because you are creating a database table in the backend.
    When a workbench transport is created, just saving the object will not activate it. Whenever we create or change a workbench object, we need to generate it. Even while creating programs, we need to generate them .Only during generation, the relevant objects will be made active.
    So during condition table creation, after doing all the configuration, we have to click this Generate button. If we just save it, then the condition tables will not be activated.
    Hope this helps you
    Pls reward if this helps you

  • What html code will start an EXE (program) with a click on a webpage link?

    The code in bold below worked. After I switched my browser from IE 11 to Firefox to get the hover on hotspots to work, the program gave me this error message. I moved the EXE file to my local file folder and tried it as shown below. Still no success. Any suggestions?
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Family Tree Charts</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><style type="text/css">
    <!--
    body,td,th {
        color: #000;
    -->
    </style></head>
    <body link=blue vlink=blue>
    <table width="100%" height="25" border="0" cellpadding="4" cellspacing="0">
      <tr>
        <td width="93%" height="27" bgcolor="#EFEFEF"> <div align="center"><font color="#999999">
        <b>This Software Allows You To Review Neat Charts of Your Family Tree </b></font></div></td>
        <td width="7%" bgcolor="#CCFFFF"> <div align="center"><A href="Mementos_Menu.html"><font size="2">Back</font></a></div></td>
      </tr>
    </table><BR><center>
    <br>
    <FONT color=#ff00ff><strong>Click the link below to download a special software program for your PC.</strong></FONT><br>
    <br>
    <a href="http://jdmcox.com/"><strong>Cox Website</strong></a><br><br>
    <strong>ITEM 1</strong> (AT THIS  WEBSITE) IS  THE <strong>FAMILY TREE CHART</strong> PROGRAM.<br>
    It is called <strong>Simple Family Tree</strong><br>
    <table width="80%" border="2" cellspacing="2" cellpadding="2">
      <tr>
        <td width="49%" align="left" valign="top"><FONT color=#ff00ff><strong>Click the link below to use this special software program after you download and install the program.</strong></FONT><br>
    <br>
    <!--<a href="C:\Program Files (x86)\Simple Family Tree\Simple Family Tree.exe"><strong>Family Tree Charts Program by Doug Cox</strong></a><br><FONT color=#ff00ff>
    -->
    <a href="C:\Users\Tom and Polly\Documents\Genealogy CD\Simple Family Tree\Simple Family Tree.exe"><b>Family Tree Charts Program</b></a><br><br>
    <FONT color=#ff00ff><strong>Click  the &quot;run&quot; button for both warning messages.<br>
    Click the &quot;READ THIS!&quot; menu option when the program opens.<br>
    Click  "X" in the upper right to close the program.<br><br>
    You can update the family data in future years with this program too.</strong></FONT>
    <br></td>
        <td width="51%" align="left" valign="top"><FONT color=#ff00ff><strong>NOTE 1: Be sure your HTML code for this webpage has a proper line to link to the location where the software was installed. You can use NOTEPAD to make HTML code changes. My existing line is: </strong></FONT><br>
          "c:\<u>program files (x86)</u>\simple family tree\simple family tree.exe"<br><br>
          <FONT color=#ff00ff><strong>The underlined portion will need to agree with where the program was installed. Just change the directory (see underlined sample above). Good luck. If I am still living, call me.<br><br>
          NOTE 2: After you download, install, and try to use the program, you may get an error message window that looks like this -&quot;0 FAMS @F191 @ FAM&quot;. This means you have an individual record in your GEDCOM file that does not have a parent. Be sure all GEDCOM records have at least one parent even if you must name the parent UNKNOWN.</strong></FONT></td>
      </tr>
    </table>
    <br></center> 
    <table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="#CCCCCC">
        <tr>
          <td bgcolor="#EFEFEF"> <font size="2">&copy;2002 Sales and People</font></td>
        </tr>
    </table></body>
    </html>

    Herbert:
    Here is my latest code attempt, but I get messages about the lines in BOLD that I do not understand.
    Perhaps you will see what I need to fix. Sure appreciate what you have found and shared with such a neophyte (aka dumbo).
    Tom
    <!--
    body,td,th
    -->
    function RunExe(path) {
    try {
    var ua = navigator.userAgent.toLowerCase();
    if (ua.indexOf("msie") != -1) {
    MyObject = new ActiveXObject("WScript.Shell")
    MyObject.Run(path);
    } else {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    var exe = window.Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
    exe.initWithPath(path);
    var run = window.Components.classes['@mozilla.org/process/util;1'].createInstance(Components.inteinterfaces.nsIProcess);
    run.init(exe);
    var parameters = ["/c start Simple Family Tree.exe"];
    run.run(false, parameters, parameters.length);
    } catch (ex) {
    alert(ex.toString());
    This Software Allows You To Review Neat Charts of Your Family Tree
    Back
    Click the link below to download a special software program for your PC and your GED file.
    *Cox Website*
    ITEM 1 (AT HIS  WEBSITE) IS  HIS FAMILY TREE CHART PROGRAM.
    It is called Simple Family Tree
    Click the link below to look at my GEDCOM file contents.<br>Instructions are provided in the READ THIS menu option at the top of the window.
      *Show Yarnall Chart*
    *Return to this webpage by clicking on the backarrow after looking at the chart.
    You can update the family data in future years with this program too.*
    ©2002 Sales and People
    Date: Thu, 2 Jan 2014 02:09:18 -0800
    From: [email protected]
    To: [email protected]
    Subject: What html code will start an EXE (program) with a click on a webpage link?
        Re: What html code will start an EXE (program) with a click on a webpage link?
        created by Herbert2001 in Dreamweaver support forum - View the full discussion
    Perhaps this might be helpful:
    https://addons.mozilla.org/en-US/firefox/addon/opendownload-10902/
    It allows executables in Firefox to be run - it is an extenstion, though, so it must be installed in Firefox before your page will work.
    Another option is this solution, but it will still require a manual change in Firefox:
    http://forums.mozillazine.org/viewtopic.php?f=19&t=803615
    Or this: http://stackoverflow.com/questions/6472435/running-exe-in-firefox-why- do-i-get-an-error
    However, you will still have problems with getting it to work cross-browser. Honestly, browsers are not supposed to have access like that to the client side file system, which absolutely makes sense for the web.
    That is why you may have to approach the solution from a different angle - perhaps create a server side cloud version of your application(s) which can be easily accessed and run by your family members. I believe you used C to develop the applications? Although I have no experience with this framework, Wt might be a solution to convert your projects to server side applications:
    http://www.webtoolkit.eu/wt
    Good luck!
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5972893#5972893
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5972893#5972893
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5972893#5972893. In the Actions box on the right, click the Stop Email Notifications link.
               Start a new discussion in Dreamweaver support forum at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • Problem setting a hidden item value when button clicked with dynamic action or pl/sql process

    Apex 4.1
    Oracle 11g
    I have a page that consists of a main region and several sub regions.  I have a pl/sql process in After Header SET_DISPLAY(:P400_DISPLAY :='MAIN';)
    Three subregions have a contional display where P400_DISPLAY = STORE.  This works in hiding the sub regions.
    Now I want to change the P400_DISPLAY value to STORE to show the subregions when I hit a button.
    I tried creating a dynamic action for on click of the add button but get the following error:
    The selected button uses a 'Button Template' that does not contain the #BUTTON_ID# substitution string
    I went to the templates and found:
    Substitution Strings
    Substitution strings are used within sub templates to reference component values. This report details substitution string usage for this template.
    Substitution String
    Referenced
    From
    Description
    #LINK#
    Yes
    Template
    To be used in an "href" attribute
    #JAVASCRIPT#
    No
    To be used in an "onclick" attribute
    #LABEL#
    Yes
    Template
    Button Label
    #BUTTON_ATTRIBUTES#
    No
    Button Attributes
    #BUTTON_ID#
    No
    Generated button ID will be either the button's Static ID if defined, or if not will be an internally generated ID in the format 'B' || [Internal Button ID]
    I then tried creating a page process, pl/sql, :P400_DISPLAY :='STORE'; when the appropriate button is pressed.  The button action is submit page. However, it does not change the P400_DISPLAY value and the subregions stay hidden.
    Suggestions please on how to fix the template or change the P400_DISPLAY value?

    The root issue is that, although you change the value of your page item, it isn't visible to other areas of the page until it is in the session. So, any other action based on the value of your page item; the visibility of a control, a report based on the item's value, etc. will all be unaffected by changing the value of the page item until it has been changed in the session. Even after this the items are stored in the session, you must thereafter do something to cause the value to be reevaluated. To see the effect of this, observe that your page loads and evaluates the value of your page item, it sees that is "MAIN" and hides the regions. However, it doesn't reevaluate them after this.
    So; your choices to get this value set in the session are to either Submit the page, or use JavaScript to set the value in the session. If you use the latter of these, you'll have to do some further work to cause the visibility tests to be re-run, So, let's stick with with the submit method.
    What you've done above sounds correct for this but, there are a lot of decisions you could have made that might have caused things not to happen in the correct sequence.
    Firstly, let's confirm that what I describe above is your problem. From the development environment, load the page, click the button to change the value and submit. Now, click the link labelled Session. Is it still set to MAIN? If so; this is your issue.
    Let's start with the your After Header computation. Did you set it to *only* run if the current value of your page item is NULL??? If not, that's your problem.
    Load Page -> Item set to 'Main' by Computation -> Click Button -> Item set to STORE -> Submit -> Load Page -> Item set to 'Main' by Computation
    See the problem?
    Assuming this isn't the issue, you created a Branch to the same page, right? What is your process point for the Branch? Is it *After* Validation, Computation etc? Because if not, you aren't changing the value before the submit happens.
    I bet it is the first issue but, take a look at these.
    Cheers,
    -Joe

  • How to call elem. Search help on Button click event in WD appilcation

    Hello All,
    i have requirement to call elem. search help on button click event in WD application. currently i am calling FM  F4IF_START_VALUE_REQUEST but getting the short dump as below,
    The following error text was processed in the system X31 : Screen output without connection to user.
    The error occurred on the application server saps_X31_31 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    SYSTEM-EXIT of program SAPLSDH4
    Function: F4_PRESEL_WITH_TABSTRIP of program SAPLSDH4
    Form: F4PROZ_STEP_PRESEL of program SAPLSDSD
    Function: DD_SHLP_SINGLE_STEP of program SAPLSDSD
    Form: F4PROZ_LOOP of program SAPLSDSD
    Form: F4PROZ of program SAPLSDSD
    Function: F4IF_START_VALUE_REQUEST of program SAPLSDHI
    Method: ONACTIONSEARCH_CUSTOMER of program /1BCWDY/50TU5ZEXF3K0IWCWE153==CP
    Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/50TU5ZEXF3K0IWCWE153==CP
    Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP
    is there any way to achieve the required behaviour.
    please let me know.
    Regards,
    Chandra

    Hi Friends,
    I have the similar kind of requirement. Upon click on a Button on screen i need to call a search help, and collect one or more selected material numbers.
    The search help is working fine and i am getting the entries with the following code.
    The problem is i am finding extra popup on screen.
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
    tabname         =  space
    fieldname       =  space
    SEARCHHELP      =  'MAT1'
    MULTIPLE_CHOICE =  'X'
    STEPL           =  0
    value           = 'MATNR'
    *dynpprog        =  progname
    *dynpnr          =  dynnum
    *dynprofield     = 'CARRIER'
    CALLBACK_PROGRAM          = 'ZTEST_1_PRA'
    CALLBACK_FORM             = 'F4CALLBACK'
    TABLES
    RETURN_TAB                = RETURN_TAB
    EXCEPTIONS
    FIELD_NOT_FOUND           = 1
    NO_HELP_FOR_FIELD         = 2
    INCONSISTENT_HELP         = 3
    NO_VALUES_FOUND           = 4
    OTHERS                    = 5.

  • Urgent: Flash Player 10, record audio - save locally on button click?

    Hi there,
    I am wondering if Flash Player 10 will allow a Flex app or a Flash app the ability for the user, inside of a web-page, to record some audio with their microphone then click a button to activate the OS's Save File dialog? The user would then just save the audio on their local filesystem.
    I was thinking this had to be done with a Java app, but I am seeing that v10 allows saving if the user initiates the action (button click)... i cannot a definitive answer or example that shows recording audio without it going to FMS or Red5.  The requirements of this app prohibit a media server so I am not sure if this can be done with Flash Player 10?
    Is this possible?  If so are there any examples of this flow?
    Any help would be greatly appreciated.  Thanks!

    Hi, everyone,
    If we can record audio from Flash Player 10 inside of a webpage and save audio files onto our local places by the use of mic applications, it will be very convenient. In fact, we can turn to use other available programs to record audio from flash and save locally by clicking buttons. It is possible to use recorders to record audio on flash or any other media players.
    I don't know whether my guess is what you are thinking or not, perhaps you need to search for more information.
    Regards.

  • 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();

  • To launch Internet Explorer on button click.

    Hello friends
    I want to open Internet Explorer with a html file on button click. The html file will contain some report data in html format which I want to show to the user on button click.
    Please help me in doing this.

    Maybe you're looking for a faster solution than Joni's thread. I just made this for an Info Screen, maybe it helps:
    // lunch the Browser and view the HTML file
    public void openBrowserWith (String aHtmlLocation) {
         try {
              Runtime.getRuntime().exec(getExplorerPath() + " " + aHtmlLocation);
         catch (Exception e) {}
    // this method should return the program path of your own browser; it needn't be as hard-coded as I did:
    public String getExplorerPath() {
         return "c:\\program files\\plus!\\Microsoft Internet\\iexplore.exe"
    // I think you know how to add a JButton and a ActionListener to your application; thus, we only need to implement the actionPerformed method:
    public void actionPerformed(ActionEvent e) {
         String command = e.getActionCommand();
         if ("OK".equals(command))
              openBrowserWith(getHtmlLocation());
    public String getHtmlLocation {
         return "http://" or "file://" and "the path where your HTML file is";
    }

  • Problem in refreshing JTree inside Jscrollpane on Button click

    hi sir,
    i have problem in refreshing JTree on Button click inside JscrollPane
    Actually I am removing scrollPane from panel and then again creating tree inside scrollpane and adding it to Jpanel but the tree is not shown inside scrollpane. here is the dummy code.
    please help me.
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.tree.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    public class Test
    public static void main(String[] args)
         JFrame jf=new TestTreeRefresh();
         jf.addWindowListener( new
         WindowAdapter()
         public void windowClosing(WindowEvent e )
         System.exit(0);
         jf.setVisible(true);
    class TestTreeRefresh extends JFrame
         DefaultMutableTreeNode top;
    JTree tree;
         JScrollPane treeView;
         JPanel jp=new JPanel();
         JButton jb= new JButton("Refresh");
    TestTreeRefresh()
    setTitle("TestTree");
    setSize(500,500);
    getContentPane().setLayout(null);
    jp.setBounds(new Rectangle(1,1,490,490));
    jp.setLayout(null);
    top =new DefaultMutableTreeNode("The Java Series");
    createNodes(top);
    tree = new JTree(top);
    treeView = new JScrollPane(tree);
    treeView.setBounds(new Rectangle(50,50,200,200));
    jb.setBounds(new Rectangle(50,300,100,50));
    jb.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
              jp.remove(treeView);
              top =new DefaultMutableTreeNode("The Java ");
    createNodes(top);
              tree = new JTree(top);
                   treeView = new JScrollPane(tree);
                   treeView.setBounds(new Rectangle(50,50,200,200));
                   jp.add(treeView);     
                   jp.repaint();     
    jp.add(jb);     
    jp.add(treeView);
    getContentPane().add(jp);
    private void createNodes(DefaultMutableTreeNode top) {
    DefaultMutableTreeNode category = null;
    DefaultMutableTreeNode book = null;
    category = new DefaultMutableTreeNode("Books for Java Programmers");
    top.add(category);
    book = new DefaultMutableTreeNode("The Java Tutorial: A Short Course on the Basics");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Tutorial Continued: The Rest of the JDK");
    category.add(book);
    book = new DefaultMutableTreeNode("The JFC Swing Tutorial: A Guide to Constructing GUIs");
    category.add(book);
    book = new DefaultMutableTreeNode("Effective Java Programming Language Guide");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Programming Language");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Developers Almanac");
    category.add(book);
    category = new DefaultMutableTreeNode("Books for Java Implementers");
    top.add(category);
    book = new DefaultMutableTreeNode("The Java Virtual Machine Specification");
    category.add(book);
    book = new DefaultMutableTreeNode("The Java Language Specification");
    category.add(book);
    }

    hi sir ,
    thaks for u'r suggession.Its working fine but the
    properties of the previous tree were not working
    after setModel() property .like action at leaf node
    is not working,I'm sorry but I don't understand. I think you are saying that the problem is solved but I can read it to mean that you still have a problem.
    If you still have a problem then please post some code (using the [code] tags of course).

  • 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

  • Dbms_random package

    hallo, i would like to know how DBMS_RANDOM package can be implemented. can you please explain with example. is there any other means of performimg random sampling? thank you regards, rao

  • Unknown router granted dynamic ARP, now what?

    I have discovered that the Cisco ASA5505 we are using for a firewall is granting a dynamic arp to an SMC router on the outside interface which has access to the internet. The IP address is not that of the single IP granted for the outside interface t

  • Hot to disabled the "Block Diagram to show" for other users?

    Hi, I am doing a LabVIEW program that other persons may use. I need them NOT to be able to access the "LabVIEW Block Diagram" (by doing e.g: Ctrl + E). How can I do this? Kind regards, Amaloa S.

  • SQL 2008 R2 error: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

    after some year work with SQL server 2005,i decide change to  SQL server 2008 R2. When i completed install SQL 2008 R2,i can't connected to SQL server due to this following error A network-related or instance-specific error occurred while establishin

  • Keyboard / Mouse Issues MacBook Pro

    After charging my MacBook Pro overnight, I turned my computer on to find that it no longer reads the keyboard and trackpad. Any help?