Actions and buttons

Hi
I got a button with 3 types of icons. pressed,normal and disabled.
I have created an action for the button and i would like to use this action to detrmin if the button is enabled or not
(like explianed in: http://java.sun.com/docs/books/tutorial/uiswing/misc/example-1dot4/index.html#ActionDemo)
My problem is that icon is not fully dispalyed - I know the button icon should be effected by the action icon but - the action can only have one icon...
any ideas?
editModeHandler = new EditModeHandler(this, TagsLoader.getEditModeTag());
        btnEditMode = new StandardButton(TagsLoader.getEditModeTag());
        btnEditMode.setIcon(GeneralConstants.EditModeIcon);
        btnEditMode.setDisabledIcon(GeneralConstants.EditModeDisabledIcon);
        btnEditMode.setPressedIcon(GeneralConstants.EditModePressedIcon);
btnEditMode.setAction(editModeHandler );Regards,
Liat

Here you go (see how the same action is added to a JMenu, a JToolbar and a regular JButton with different icons shown) :import javax.swing.*;
import javax.swing.plaf.basic.BasicButtonUI;
import java.net.URL;
import java.net.MalformedURLException;
import java.awt.event.ActionEvent;
import java.awt.*;
import java.beans.PropertyChangeListener;
public class MultiIconButtonTest {
     private static final String ICON_BIG = "bigIcon";
     private static final String ICON_BIG_DISABLED = "bigDisabledIcon";
     private static final String ICON_BIG_PRESSED = "bigPressedIcon";
     private static class MultiIconAction extends AbstractAction {
          public MultiIconAction(String aName, Icon aSmallIcon, Icon aBigIcon, Icon aBigDisabledIcon, Icon aBigPressedIcon) {
               super(aName, aSmallIcon);
               putValue(ICON_BIG, aBigIcon);
               putValue(ICON_BIG_DISABLED, aBigDisabledIcon);
               putValue(ICON_BIG_PRESSED, aBigPressedIcon);
          public void actionPerformed(ActionEvent e) {
               System.out.println("And...... ACTION!!!");
     private static class MultiIconButton extends JButton {
          public MultiIconButton(Action anAction) {
               super(anAction);
          protected void configurePropertiesFromAction(Action a) {
               Integer n = (a==null) ? null : (Integer)a.getValue(Action.MNEMONIC_KEY);
               setMnemonic(n==null ? '\0' : n.intValue());
               setText(a!=null ? (String)a.getValue(Action.NAME) : null);
               setToolTipText(a!=null ? (String)a.getValue(Action.SHORT_DESCRIPTION) : null);
               setIcon(a!=null ? (Icon)a.getValue(ICON_BIG) : null);
               setDisabledIcon(a!= null ? (Icon)a.getValue(ICON_BIG_DISABLED) : null);
               setPressedIcon(a!=null ? (Icon)a.getValue(ICON_BIG_PRESSED) : null);
               setActionCommand(a!=null? (String)a.getValue(Action.ACTION_COMMAND_KEY) : null);
               setEnabled(a!=null ? a.isEnabled() : true);
     private static class MultiIconEnabledToolBar extends JToolBar {
          public JButton add(Action a) {
               if (!(a instanceof MultiIconAction)) {
                    return super.add(a);
               JButton b = new MultiIconButton(a) {
                    protected PropertyChangeListener createActionPropertyChangeListener(Action a) {
                         PropertyChangeListener pcl = createActionChangeListener(this);
                         if (pcl == null) {
                              pcl = super.createActionPropertyChangeListener(a);
                         return pcl;
               b.setText("");
               b.setHorizontalTextPosition(JButton.CENTER);
               b.setVerticalTextPosition(JButton.BOTTOM);
               add(b);
               return b;
     private static Icon[] loadIcons() {
          Icon[] icons = new Icon[4];
          try {
               icons[0] = new ImageIcon(new URL("http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/images/middle.gif"));
               icons[1] = new ImageIcon(new URL("http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/images/tumble/T1.gif"));
               icons[2] = new ImageIcon(new URL("http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/images/tumble/T2.gif"));
               icons[3] = new ImageIcon(new URL("http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/images/tumble/T3.gif"));
          } catch (MalformedURLException e) {
               e.printStackTrace();
               return null;
          return icons;
     public static void main(String[] args) {
          Icon[] icons = loadIcons();
          if (icons == null) System.exit(1);
          final JFrame frame = new JFrame(MultiIconButton.class.getName());
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          final MultiIconAction myAction = new MultiIconAction("action", icons[0], icons[1], icons[2], icons[3]);
          JPanel mainPanel = new JPanel(new BorderLayout());
          JToolBar toolBar = new MultiIconEnabledToolBar();
          toolBar.add(myAction);
          toolBar.add(new AbstractAction("simple icon action", icons[0]) {
               public void actionPerformed(ActionEvent e) {
                    myAction.setEnabled(!myAction.isEnabled());
          mainPanel.add(toolBar, BorderLayout.NORTH);
          JPanel centerPanel = new JPanel(new FlowLayout());
          JButton button = new MultiIconButton(myAction);
          centerPanel.add(button);
          mainPanel.add(centerPanel, BorderLayout.CENTER);
          frame.setContentPane(mainPanel);
          JMenuBar menuBar = new JMenuBar();
          JMenu menu = new JMenu("file");
          menu.add(myAction);
          menuBar.add(menu);
          frame.setJMenuBar(menuBar);
          SwingUtilities.invokeLater(new Runnable() {
               public void run() {
                    frame.pack();
                    frame.show();
}I really think that changing the displayed icon depending on which Container the action is added to should be much simplier (at least without having to extend those containers).

Similar Messages

  • Agentry - List Tile View Single Action AND Button?

    Hi experts,
    we are using a List Tile View with a Single Click Action, which works fine.
    But now we want to add a button (or something else you can click on) to the List Tile View with a different action.
    So, if you click on this button, action A should be executed. And if you click somewhere else into the tile, action B should be started.
    Is this somehow possible? Thanks!
    Best regards
    Christian

    Not with Single Click Action.  That is if you click on the tile it will call that action, anywhere on that tile. What you could do is have two buttons on the tile (for selected) they they can push.  But then the users would have to select the tile, then click on a button.

  • HT4085 How do I lock my ipad screen so the swipe action and side button on screen don't work? My cats do these things and the game disappears.

    How do I lock my ipad screen so the swipe action and the side button on the screen do not work?  When my cats play a game on my ipad, they regularly swipe the screen and push the side button and the game disappears.

    The button on the top that you use to lock and unlock or put to sleep is the power button.  The button lower center of the screen is the home button...can be used to also wake from sleep and switch to the base home screen.
    Good to hear you are now able to lock rotation, even if you are not sure how you did it
    If you go to the iBook icon, tap Store in the uppper left side of the screen, you can search for the iPad User Guide...a free download that will place the guide in your iBooks library as a great source of background information.

  • Dynamic actions on button and dynamic column name

    Hi!ynam
    I want to create a dynamic action on button click in my tabular form.
    I have a select list with values of my column names (P7_X_COLUMN) and a text field where users input values for update (P7_X_UVALUE).
    My idea is that when they click the button, they update selected column to desired value in all rows.
    However, I get the following error:
    ORA-06550: line 5, column 5: PL/SQL: ORA-01747: invalid user.table.column, table.column, or column specification ORA-06550: line 4, column 1: PL/SQL: SQL Statement ignored (Go to error)
    It seems to me that I have not referenced the column name correctly, I thought it was the same as referencing values. How do I do that?
    This is my code:
    begin
    update "#OWNER#"."IZV_SLOG_DET"
    set :P7_X_COLUMN=:P7_X_UVALUE;
    end;
    Regards,
    Ivan

    I got it to work, but the query is too big. Can anyone help me with how to get it to work?
    I tried breaking it into more varchar2 strings, but i always get the same error:
    Error processing row.
    ORA-01461: can bind a LONG value only for insert into a LONG column
    declare  
    l_table_name varchar2(30) := 'IZV_SLOG_DET_POM'; 
    l_sql_stmt varchar2(32762);
    begin
    l_sql_stmt := 'update ' || l_table_name || ' set ' || :P7_X_COLUMN || ' =''' || :P7_X_UVALUE|| '''' ||
    'where'||
    'nvl(MSR_PRD_ID,1) = nvl(nvl(''' || :P7_X_MSR_PRD_ID || '''' || ',MSR_PRD_ID),1) and' ||
    'nvl(SRC_STM_ID,1) = nvl(nvl(''' || :P7_X_SRC_STM_ID || '''' || ',SRC_STM_ID),1) and' ||
    'nvl(OZNAKA_KOMITENTA,1) = nvl(nvl(''' || :P7_X_OZNAKA_KOMITENTA || '''' || ',OZNAKA_KOMITENTA),1) and' ||
    'nvl(RSP,1) = nvl(nvl(''' || :P7_X_RSP || '''' || ',RSP),1) and' ||
    'nvl(OZNAKA_RETKA,1) = nvl(nvl(''' || :P7_X_OZNAKA_RETKA || '''' || ',OZNAKA_RETKA),1) and' ||
    'nvl(OZNAKA_IZVJESCA,1) = nvl(nvl(''' || :P7_X_OZNAKA_IZVJESCA || '''' || ',OZNAKA_IZVJESCA),1) and' ||
    'nvl(MBR_KOMITENTA,1) = nvl(nvl(''' || :P7_X_MBR_KOMITENTA || '''' || ',MBR_KOMITENTA),1) and' ||
    'nvl(KOMITENT_NEREZ,1) = nvl(nvl(''' || :P7_X_KOMITENT_NEREZ || '''' || ',KOMITENT_NEREZ),1) and' ||
    'nvl(ZUPANIJA,1) = nvl(nvl(''' || :P7_X_ZUPANIJA || '''' || ',ZUPANIJA),1) and' ||
    'nvl(DRZAVA,1) = nvl(nvl(''' || :P7_X_DRZAVA || '''' || ',DRZAVA),1) and' ||
    'nvl(SEKTOR_NEREZIDENTA,1) = nvl(nvl(''' || :P7_X_SEKTOR_NEREZIDENTA || '''' || ',SEKTOR_NEREZIDENTA),1) and' ||
    'nvl(VRSTA_POVEZANOSTI,1) = nvl(nvl(''' || :P7_X_VRSTA_POVEZANOSTI || '''' || ',VRSTA_POVEZANOSTI),1) and' ||
    'nvl(INSTRUMENT,1) = nvl(nvl(''' || :P7_X_INSTRUMENT || '''' || ',INSTRUMENT),1) and' ||
    'nvl(VALUTA,1) = nvl(nvl(''' || :P7_X_VALUTA || '''' || ',VALUTA),1) and' ||
    'nvl(OTKAZNI_ROK,1) = nvl(nvl(''' || :P7_X_OTKAZNI_ROK || '''' || ',OTKAZNI_ROK),1) and' ||
    'nvl(IZVORNO_DOSPIJECE,1) = nvl(nvl(''' || :P7_X_IZVORNO_DOSPIJECE || '''' || ',IZVORNO_DOSPIJECE),1) and' ||
    'nvl(VRSTA_INDEKSACIJE,1) = nvl(nvl(''' || :P7_X_VRSTA_INDEKSACIJE || '''' || ',VRSTA_INDEKSACIJE),1) and' ||
    'nvl(VALUTA_INDEKSACIJE,1) = nvl(nvl(''' || :P7_X_VALUTA_INDEKSACIJE || '''' || ',VALUTA_INDEKSACIJE),1) and' ||
    'nvl(PORTFELJ,1) = nvl(nvl(''' || :P7_X_PORTFELJ || '''' || ',PORTFELJ),1) and' ||
    'nvl(UTRZIVOST_KREDITA,1) = nvl(nvl(''' || :P7_X_UTRZIVOST_KREDITA || '''' || ',UTRZIVOST_KREDITA),1) and' ||
    'nvl(ZNACAJKE_KAPITALA,1) = nvl(nvl(''' || :P7_X_ZNACAJKE_KAPITALA || '''' || ',ZNACAJKE_KAPITALA),1) and' ||
    'nvl(RIZICNA_SKUPINA,1) = nvl(nvl(''' || :P7_X_RIZICNA_SKUPINA || '''' || ',RIZICNA_SKUPINA),1) and' ||
    'nvl(UGRADJENI_DERIVAT,1) = nvl(nvl(''' || :P7_X_UGRADJENI_DERIVAT || '''' || ',UGRADJENI_DERIVAT),1) and' ||
    'nvl(ODNOSNA_VARIJABLA,1) = nvl(nvl(''' || :P7_X_ODNOSNA_VARIJABLA || '''' || ',ODNOSNA_VARIJABLA),1) and' ||
    'nvl(PREDZNAK,1) = nvl(nvl(''' || :P7_X_PREDZNAK || '''' || ',PREDZNAK),1) and' ||
    'nvl(VRSTA_IZNOSA,1) = nvl(nvl(''' || :P7_X_VRSTA_IZNOSA || '''' || ',VRSTA_IZNOSA),1) and' ||
    'nvl(KOMITENT_PBR,1) = nvl(nvl(''' || :P7_X_KOMITENT_PBR || '''' || ',KOMITENT_PBR),1) and' ||
    'nvl(UDJELI_POVEZ_C,1) = nvl(nvl(''' || :P7_X_UDJELI_POVEZ_C || '''' || ',UDJELI_POVEZ_C),1) and' ||
    'nvl(AR_ID,1) = nvl(nvl(''' || :P7_X_AR_ID || '''' || ',AR_ID),1) and' ||
    'nvl(AU_ID,1) = nvl(nvl(''' || :P7_X_AU_ID || '''' || ',AU_ID),1) and' ||
    'nvl(AR_BUSS_ID,1) = nvl(nvl(''' || :P7_X_AR_BUSS_ID || '''' || ',AR_BUSS_ID),1) and' ||
    'nvl(MTI_CCY_TP_ID,1) = nvl(nvl(''' || :P7_X_MTI_CCY_TP_ID || '''' || ',MTI_CCY_TP_ID),1) and' ||
    'nvl(REG_NO,1) = nvl(nvl(''' || :P7_X_REG_NO || '''' || ',REG_NO),1) and' ||
    'nvl(REG_SFX,1) = nvl(nvl(''' || :P7_X_REG_SFX || '''' || ',REG_SFX),1) and' ||
    'nvl(JMBG_ID_NO,1) = nvl(nvl(''' || :P7_X_JMBG_ID_NO || '''' || ',JMBG_ID_NO),1) and' ||
    'nvl(IP_ID,1) = nvl(nvl(''' || :P7_X_IP_ID || '''' || ',IP_ID),1) and' ||
    'nvl(TAX_ID_NO,1) = nvl(nvl(''' || :P7_X_TAX_ID_NO || '''' || ',TAX_ID_NO),1) and' ||
    'nvl(INSTRUMENT_OLD,1) = nvl(nvl(''' || :P7_X_INSTRUMENT_OLD || '''' || ',INSTRUMENT_OLD),1) and' ||
    'nvl(PREDZNAK_OLD,1) = nvl(nvl(''' || :P7_X_PREDZNAK_OLD || '''' || ',PREDZNAK_OLD),1) and' ||
    'nvl(NAPOMENA,1) = nvl(nvl(''' || :P7_X_NAPOMENA || '''' || ',NAPOMENA),1) and' ||
    'nvl(NOVI_POSAO_F,1) = nvl(nvl(''' || :P7_X_NOVI_POSAO_F || '''' || ',NOVI_POSAO_F),1) and' ||
    'nvl(LISTA_SUMARNA,1) = nvl(nvl(''' || :P7_X_LISTA_SUMARNA || '''' || ',LISTA_SUMARNA),1) and' ||
    'nvl(LISTA_REKAP,1) = nvl(nvl(''' || :P7_X_LISTA_REKAP || '''' || ',LISTA_REKAP),1) and' ||
    'nvl(DZS_IDY_CL_ID,1) = nvl(nvl(''' || :P7_X_DZS_IDY_CL_ID || '''' || ',DZS_IDY_CL_ID),1) and' ||
    'nvl(HNB_IP_CL_ID,1) = nvl(nvl(''' || :P7_X_HNB_IP_CL_ID || '''' || ',HNB_IP_CL_ID),1) and' ||
    'nvl(NO_DYS_OO,1) = nvl(nvl(''' || :P7_X_NO_DYS_OO || '''' || ',NO_DYS_OO),1) and' ||
    'nvl(POSTOTAK1,1) = nvl(nvl(''' || :P7_X_POSTOTAK1 || '''' || ',POSTOTAK1),1) and' ||
    'nvl(POSTOTAK2,1) = nvl(nvl(''' || :P7_X_POSTOTAK2 || '''' || ',POSTOTAK2),1) and' ||
    'nvl(POSTOTAK3,1) = nvl(nvl(''' || :P7_X_POSTOTAK3 || '''' || ',POSTOTAK3),1) and' ||
    'nvl(BNK_ID,1) = nvl(nvl(''' || :P7_X_BNK_ID || '''' || ',BNK_ID),1) and'||
    'nvl(ID,1) = nvl(nvl(''' || :P7_X_ID || '''' || ',ID),1) and' ||
    'nvl(ID_RETKA,1) = nvl(nvl(''' || :P7_X_ID_RETKA || '''' || ',ID_RETKA),1) and' ||
    'nvl(DATUM_STANJA,1) = nvl(nvl(''' || :P7_X_DATUM_STANJA || '''' || ',DATUM_STANJA),1) and' ||
    'nvl(IZNOS,1) = nvl(nvl(''' || :P7_X_IZNOS || '''' || ',IZNOS),1) and' ||
    'nvl(IZNOS_ACTUAL,1) = nvl(nvl(''' || :P7_X_IZNOS_ACTUAL || '''' || ',IZNOS_ACTUAL),1) and' ||
    'nvl(ACT_AR_BAL_KN,1) = nvl(nvl(''' || :P7_X_ACT_AR_BAL_KN || '''' || ',ACT_AR_BAL_KN),1) and' ||
    'nvl(ACT_AR_BAL,1) = nvl(nvl(''' || :P7_X_ACT_AR_BAL|| '''' || ',ACT_AR_BAL),1) and' ||
    'nvl(IZNOS_ACTUAL_OLD,1) = nvl(nvl(''' || :P7_X_IZNOS_ACTUAL_OLD || '''' || ',IZNOS_ACTUAL_OLD),1) and' ||
    'nvl(ACT_AR_BAL_KN_OLD,1) = nvl(nvl(''' || :P7_X_ACT_AR_BAL_KN_OLD || '''' || ',ACT_AR_BAL_KN_OLD),1) and' ||
    'nvl(ACT_AR_BAL_OLD,1) = nvl(nvl(''' || :P7_X_ACT_AR_BAL_OLD || '''' || ',ACT_AR_BAL_OLD),1) and' ||
    'nvl(EXG_RT_CRD_RSK_F,1) = nvl(nvl(''' || :P7_X_EXG_RT_CRD_RSK_F || '''' || ',EXG_RT_CRD_RSK_F),1) ';
    execute immediate l_sql_stmt; 
    end;

  • ADOBE DPS - MAGAZINE to TABLET in INDESIGN.....Need to brush up my tablet design in DPS (did it a few yearscback), can anyone recommend on the Adobe site tutorials that I can download, with artworks /buttons / actions and put it together?

    ....Need to brush up my tablet design in DPS (did it a few years back), can anyone recommend on the Adobe site tutorials that I can download, with artworks /buttons / actions and put it together?

    See this forum post here from Bob. Best place to learn DPS is on Adobe TV http://tv.adobe.com/product/digital-publishing-suite/
    If you are specifically looking to learn how to create interactive overlays, go here http://helpx.adobe.com/digital-publishing-suite/help/overview-interactive-overlays.html Watch the videos on "Folio Overlays panel, Part I & Part II"

  • I'm having an issue displaying a button using advanced actions and rollover slidelets.

    I'm having an issue getting a button to display after the learner places his mouse over three different rollover slidelets which are all on the same slide. I created three variables and assigned each to the rollover slidelets. I also created a conditional action that I assigned to the slide. The variables are set to zero and then the action is to assign the variable with 1 after it's rolled over. The conditional action says that once all three variables are equal to 1, show the button and continue. Unfortunately the button is not displaying after the three rollovers have been viewed. Any insight?

    I can only suspect what is going wrong, it would have been a lot easier if you did show those actions.
    My suspicion is due to this sentence '... a conditional action that I assigned to the slide'? There are two slide events: On Enter, and On Exit. Read more about those events:
    http://blog.lilybiri.com/events-and-advanced-actions
    Those events can trigger an advanced action but only at that frame: first frame (On enter), last frame of the slide. But you expect the button to appear when the three rollover events have occurred? That means the condition has to be checked by each action triggered by the rollover events. Have multiple examples on my blog for such use cases, latest one was:
    http://blog.lilybiri.com/blog-after-posterous-clickclick
    Shortly:
    Use the On Enter event of the slide to reset the three variables to zero, that will be a standard advanced action with three Assign statements (this is not necessary if you never expect the user to return to that slide)
    Use each Rollover event to trigger a conditional advanced action with two decisions:
    First decision 'Always' will be a mimicked standard action, and toggles that variable to 1
    Second decision 'Checkit' will have your condition to see if the three variables are equal to 1, if Yes show the button, if No, nothing has to happen (or maybe Continue, depends on setup)
    Lilybiri

  • Creating button with gotoPage(action) and tooltip in Indesign CS4

    Hi,
      I want to create the button with gotopage(action) and tool tip for specific text for pdf generation, using the javascript/AppleScript .If any of you know ,Please do reply for my question.

    Dave is correct. Go to Page isn't available in PDF.
    Instead, use the Hyperlink panel and select an object or text and choose Create New Destination and give it a name.
    Then set the action for the button to be Go to Destination. Select the destination you saved.

  • Run time update on Button name and Action of Button

    I want to change the button name and button path in the GUI directly. So user can update GUI as per their requirement.
    Now I have built a GUI with multiple buttons. Whenever the button clicked corresponding webpage will be opened. This Button name and webpage link can not be changed as per current GUI design.
    But I want to allow anybody to update the Button name and webpage link as per their need.
    Please suggest , how can I achieve it? Please share if you have some code snippet.

    Changing the text on a Swing JButton is pretty simple. That isn't an appropriate question for this forum, however. This forum is for questions concerning using or extending WindowBuilder. General Swing questions should be posted to a general Swing/Java forum.

  • WARNING: Actions on button

    Hi
    I do not understand why I am getting this warning below
    WARNING: Actions on button or MovieClip instances are not supported in ActionScript 3.0.
    All scripts on object instances will be ignored.
    Can someone help?
    mimi

    You can still use pretty much any objects that you have ever used before, though that's not saying they haven't changed in some way. In AS3 to manage things like buttons and other interactions the primary code approach involves creating event listeners and event handler functions.  Here is a description of how you would approach coding a button, though the same could apply to a movieclip....
    Let's say you create a button symbol.  Since it is a button, it is already a self animating object that will react to mouse interactions, but only visually at this stage.  The first thing you need to do to make it useful code-wise is to assign it a unique instance name.  So you drag a copy of it out to the stage from the library, and while it's still selected, you enter that unique instance name for it in the Properties panel... let's say you name it "btn1"
    In AS3, to make a button work with code, you need to add an event listener and event handler function for it.  You might need to add a few (for different events, like rollover, rollout, clicking it, but for now we'll just say you want to be able to click it to get a web page to open.  In the timeline that holds that button, in a separate actions layer that you create, in a frame numbered the same as where that button exists, you would add the event listener:
    btn1.addEventListener(MouseEvent.CLICK, btn1Click);
    The name of the unique function for processing the clicking of that button is specified at the end of the event listener assignment, so now you just have to write that function out:
    function btn1Click(evt:MouseEvent):void {
       gotoAndPlay("site_section");
    Here's some of what's involved there:
    evt:MouseEvent - the event listeners throws an argument automatically which the function must be set up to receive.  In this case I have given that argument a variable name of evt, though I could have chosen anything.
    :void - this defines the class of the value that the function will return.  In this case, the function does not return anything, so "void" is used.  If it did return a value, you would see a line containing "return xyz"; in the function (where xyz is not literal, it simply represents the variable or value being returned) and the :void would be rplaced with some other class such as :String, :int, Date, etc....
    In AS3, in strict mode, it is necessary to identify the types/classes of the variables being created, which is why you see :String, :MouseEvent, etc... showing up everywhere.
    Now, to create another button with a unique function for it, you could just drag another copy of it from the library, give it a unique name, say btn2, copy/paste the code from btn1 and replace "btn1" with "btn2" in that copied code.

  • Difference between Submit Button and Button

    Hi,
    Please help me understanding the difference bewteen the following cases.
    1) Submit Button + ActionType : None
    2) Submit Button + Action Type :fire partial action
    3) Submit Button + Action Type : Fire Action
    4) Button + Action Type : fireAction
    5) Button + Action Type : firePartialAction
    My Understanding is 1st and 4th Both submits the form.
    Also, please let me know, is it a valid scenario where we use the SubmitButton and still gives ActionType. What difference it makes when action type is given with submit button.
    I understand that when we use 4th then it submits the form and whereas in case of 5th it doesnt.
    Thanks in advance
    Saurabh Agrawal

    Hi,
    Thanks for your replies.
    Actually i wanted to understand this in context of the issue we are facing.
    We have a text field and a button besides it. We have a TAB OUT even associated with the text field which is captured using firePartialAction event. Also, the button is a SUBMIT BUTTON with a partialFireAction associated with it.
    1) When you give % in textfield and tab out a popups come and load the data in a table - WORKS FINE
    2) When you dont enter anything in textfiled and clicks on the button, same popups comes and loads data into the table. - WORKS FINE
    3) When you give % in Text Field and clicks on the BUTTON, from JDEV, we verified that TAB OUT event gets triggered.Once that event is over, we can see the HOUR GLASS which doesnt go away. --- ISSUE
    Resolution Tested : When i just remove ACTIONTYPE from button and do NAVIGATION - 3, issue is resolved.
    Also, if i make that button as BUTTON and give FIRE ACTION, issue is resolved.
    Now the main concern is the same combination SUBMIT BUTTON and ACTIONTYPE: firePartialAction works fine in 11i and causes issue in R12.
    Please let me know your comments.
    Thanks in advance
    Saurabh Agrawal

  • Please help me with some action event buttons

    {color:#ff6600}i am trying to figure out how to capture two values from an action event button. i have already tried it 6 times and i cant figure it out.
    Its a simple calculator with numbers 1 and 2 and does a multiplication calculation.
    Can you help me figure it out it will be really helpful.
    {color}
    import javax.swing.*;
    import java.util.*;
    import java.awt.event.*;
    public class Calculator implements ActionListener {
    JFrame frame;
    JPanel contentpane;
    JButton one,two;
    JTextField field;
    JButton mult;
    JButton adds;
    JButton equals;
    JButton go;
    public Calculator() {
    frame = new JFrame ("Calculator" );
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    contentpane = new JPanel();
    contentpane.setBorder(BorderFactory.createEmptyBorder(20,20,40,40));
    one = new JButton( Integer.toString(1));
    one.setActionCommand(Integer.toString(1));
    one.addActionListener(this);
    contentpane.add(one);
    two = new JButton(Integer.toString(2));
    two.setActionCommand(Integer.toString(2));
    two.addActionListener(this);
    contentpane.add(two);
    field = new JTextField(10 );
    contentpane.add(field);
    go = new JButton("calculate");
    go.setActionCommand("go");
    go.addActionListener(this);
    contentpane.add(go);
    mult = new JButton( "*");
    mult.setActionCommand("mult");
    mult.addActionListener(this);
    contentpane.add(mult);
    adds = new JButton( "+");
    adds.setActionCommand("add");
    contentpane.add(adds);
    frame.setContentPane(contentpane);
    frame.pack();
    frame.setVisible(true);
    public void actionPerformed (ActionEvent event ) {
    String eventn = event.getActionCommand();
    String text = field.getText();
    String mult ="*";
    {color:#800080}if (eventn.equals("1")||eventn.equals("2") ){  \\ *{color:#ff6600}i dont know how to store two different value from an action event{color}*
    text+=eventn ;
    int num = Integer.parseInt(text);
    field.setText(text);
    {color}
    {color:#800080}if (eventn.equalsIgnoreCase("mult")){
    field.setText("");
    {color}
    {color:#800080}};
    {color}
    public static void runGui(){
    JFrame.setDefaultLookAndFeelDecorated(true);
    Calculator r = new Calculator();
    public static void main (String[]args){
    javax.swing.SwingUtilities.invokeLater(new Runnable(){
    public void run(){
    runGui();

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ListenerDemo {
        private class DigitListener implements ActionListener {
           private int digit;
           public DigitListener(int digit) {
               this.digit = digit;
           public void actionPerformed(ActionEvent evt) {
                JOptionPane.showMessageDialog(f, "You pressed " + digit);
        private JFrame f = new JFrame();
        private JButton button1 = new JButton("1");
        private JButton button2 = new JButton("2");
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    new ListenerDemo().go();
        void go() {
            button1.addActionListener(new DigitListener(1));
            button2.addActionListener(new DigitListener(2));
            JPanel cp = new JPanel();
            cp.add(button1);
            cp.add(button2);
            f.setContentPane(cp);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Destination folder in Actions and Batch

    I use Photoshop CS on a Mac G4 (PPC) with OS X 10.4.11.
    I need to convert large folders of JPEGs with sRGB profile to Adobe RGB. I recorded an 'action' , which works fine, except for one thing. Here are the instructions from the Photoshop Help files:
    To create a new action:
    Open a file.
    In the Actions palette, click the New Action button , or choose New Action from the Actions palette menu.
    Enter a name for the action.
    (Photoshop) Choose a set from the pop-up menu.
    If desired, set one or both of the following options:
    Assign a keyboard shortcut to the action. You can choose any combination of a Function key, the Ctrl key (Windows) or Command key (Mac OS), and the Shift key (for example, Ctrl+Shift+F3), with these exceptions: In Windows, you cannot use the F1 key, nor can you use F4 or F6 with the Ctrl key.
    (Photoshop) Assign a color for display in Button Mode.
    Click Record. The Record button in the Actions palette turns red .
    Important: When recording the Save As command, do not change the filename. If you enter a new filename, Photoshop records the filename and uses that filename each time you run the action. Before saving, if you navigate to a different folder, you can specify a different location without having to specify a filename.
    Choose the commands, and perform the operations you want to record.
    To stop recording, either click the Stop button, choose Stop Recording from the Actions palette menu, or press the Escape key. To resume recording in the same action, choose Start Recording from the Actions palette menu.
    It's the 'Important:' bit under 6. that I'm concerned about If, when recording the action, I specify, say, 'Desktop' in which to 'Save As...', and then when I use the Batch command I specify a particular (different) destination folder, I end up with two lots of converted images: one lot in the destination folder, the other on the desktop. If, when recording the action, I specify a particular place to save in, then I can't (or can I?) use this action on another occasion when I haven't created a destination folder of that name and want to specify a new destination folder under 'Batch'. And if I specify the same destination folder in the recorded action and in 'Batch', I run into further trouble.
    What is the right thing to do? Thank you in anticipation of help.

    Sorry, something went wrong. Here is my question again:
    I use Photoshop CS on a Mac G4 (PPC) with OS X 10.4.11.
    I need to convert large folders of JPEGs with sRGB profile to Adobe RGB. I recorded an 'action' , which works fine, except for one thing. Here are the instructions from the Photoshop Help files:
    To create a new action:
    Open a file.
    In the Actions palette, click the New Action button , or choose New Action from the Actions palette menu.
    Enter a name for the action.
    (Photoshop) Choose a set from the pop-up menu.
    If desired, set one or both of the following options:
    Assign a keyboard shortcut to the action. You can choose any combination of a Function key, the Ctrl key (Windows) or Command key (Mac OS), and the Shift key (for example, Ctrl+Shift+F3), with these exceptions: In Windows, you cannot use the F1 key, nor can you use F4 or F6 with the Ctrl key.
    (Photoshop) Assign a color for display in Button Mode.
    Click Record. The Record button in the Actions palette turns red .
    Important: When recording the Save As command, do not change the filename. If you enter a new filename, Photoshop records the filename and uses that filename each time you run the action. Before saving, if you navigate to a different folder, you can specify a different location without having to specify a filename.
    Choose the commands, and perform the operations you want to record.
    To stop recording, either click the Stop button, choose Stop Recording from the Actions palette menu, or press the Escape key. To resume recording in the same action, choose Start Recording from the Actions palette menu.
    It's the 'Important:' bit under 6. that I'm concerned about If, when recording the action, I specify, say, 'Desktop' in which to 'Save As...', and then when I use the Batch command I specify a particular (different) destination folder, I end up with two lots of converted images: one lot in the destination folder, the other on the desktop. If, when recording the action, I specify a particular place to save in, then I can't (or can I?) use this action on another occasion when I haven't created a destination folder of that name and want to specify a new destination folder under 'Batch'. And if I specify the same destination folder in the recorded action and in 'Batch', I run into further trouble.
    What is the right thing to do? Thank you in anticipation of help.

  • Actions on button or MovieClip instances are not supported in ActionScript 3.0?

    I have recently updated my Flash and I seriously regret it as everything seems to of changed. For instance I want to publish a movie i created in Action Script 3.0. In this movie i have buttons which have actions applied to them and everytime i go to publish the site, it brings up the error
    'WARNING: Actions on button or MovieClip instances are not supported in ActionScript 3.0. All scripts on object instances will be ignored.'
    How do I go about keeping my 3.0 elements but having buttons with actions applied to them. I am a complete beginner with Flash by the way so the answer would need to be completely straight forward.
    Thanks!

    okay, just to simplify this even further and to break it into steps..
    1: I Create a new button.
    2: I give it an instance name of say 'button'
    3: I place the following code in the timeline
    button.addEventListener(MouseEvent.CLICK,callFunction);
    function callFunction(e:Event):void{
    gotoAndPlay();
    Now here is where I am stuck. What do you need to add to this to navigate to another scene?
    Thanks again!!

  • Struts Actions and events in one jsp?!

    Hello,
    I have a problem with Struts actions and events in a jsp.
    It is a search page and when the user clicks the search button I trigger an event and when the user clicks on a link in the result table (same page) I use an action that opens a new detail jsp. The first search query works well, I get a result, open the detail page, go back (using an action).
    Then I start a new search, but struts tries to open the detail page. While debugging I found out, that struts apparantly has no action or event. Why does it work at first time?
    Any ideas?
    Thanks in advance
    Britta

    Thanks for answer,
    I work with actions AND events. I think that`s the problem. When I go back from detail page to search page I use a custom DataForwardAction class with the following method:
    public void onCancel(DataActionContext ctx)
    DCBindingContainer bc = ctx.getBindingContainer();
    HttpServletRequest request = ctx.getHttpServletRequest();
    WebUtils.setSession(request);
    String ziel = request.getParameter("ziel");
    JUCtrlActionBinding action = (JUCtrlActionBinding) bc.findCtrlBinding("Rollback");
    action.doIt();
    try
    ctx.setActionForward(ziel);
    catch (Exception e)
    ctx.setActionForward("liste_freig");
    Ziel has the correct value ("search") and I think the struts config is also correct:
    <action path="/material" type="view.actions.materialAction" className="oracle.adf.controller.struts.actions.DataActionMapping" parameter="/material.jsp" name="DataForm">
    <set-property property="modelReference" value="generalUIModel"/>
    <forward name="liste_freig" path="/liste_freig.do"/>
    <forward name="liste_angelegt" path="/liste_angelegt.do"/>
    <forward name="list_bewertet" path="/list_bewertet.do"/>
    <forward name="liste_abgelehnt" path="/liste_abgelehnt.do"/>
    <forward name="liste_onhold" path="/liste_onhold.do"/>
    <forward name="search" path="/search.do?action=search"/>
    </action>
    But when I get back from material page to search page (the first time it works). The location pathname is material.do not search.do When start a new search the material page opens, not, as desired, the search page with new results.
    Search Action:
    public class searchAction extends DataForwardAction
    public searchAction()
    protected void prepareModel(DataActionContext ctx) throws Exception
    HttpServletRequest request = ctx.getHttpServletRequest();
    DataActionMapping acmap = ctx.getActionMapping();
    DCBindingContainer bc = ctx.getBindingContainer();
    WebUtils.setSession(request);
    JUCtrlActionBinding action = (JUCtrlActionBinding) bc.findCtrlBinding("delSearchQuery");
    action.doIt();
    String sEvent=null;
    try
    sEvent=request.getParameter("event");
    catch (Exception e)
    sEvent=null;
    if (sEvent==null)
    if (request.getParameter("action") != null)
    if (request.getParameter("action").equals("material"))
    Number mat_no=new Number(request.getParameter("MaterialNumber"));
    Number userId=new Number(WebUtils.getUserId(request));
    bc = ctx.getBindingContainer();
    action = (JUCtrlActionBinding) bc.findCtrlBinding("prepareMaterial");
    ArrayList arrayList= new ArrayList();
    arrayList.add(0,mat_no);
    arrayList.add(1,userId);
    action.setParams(arrayList);
    action.doIt();
    ctx.setActionForward("material");
    if (request.getParameter("action").equals("material_datasheet"))
    ctx.setActionForward("material_datasheet");
    super.prepareModel(ctx);
    public void onSearch(DataActionContext ctx)
    DCBindingContainer bc = ctx.getBindingContainer();
    HttpServletRequest request = ctx.getHttpServletRequest();
    WebUtils.setSession(request);
    ctx.setActionForward("search");
    Struts config:
    <action path="/search" className="oracle.adf.controller.struts.actions.DataActionMapping" type="view.actions.searchAction" name="DataForm" parameter="/search.jsp">
    <set-property property="modelReference" value="searchUIModel"/>
    <forward name="search" path="/search.do?action=search"/>
    <forward name="material" path="/material.do?action=material"/>
    <forward name="material_datasheet" path="/material_datasheet.do?action=material_datasheet"/>
    </action>
    I think it`s a Struts bug. Or is there something I don`t see?

  • Add JavaScript to boxes and buttons

    This question was posted in response to the following article: http://help.adobe.com/en_US/captivate/cp/using/WS5b3ccc516d4fbf351e63e3d119e9581edd-7feb.h tml

    This article is talking about a click box object in Captivate, not a text caption. Clickboxes and buttons in Cp are interactive objects that can be used to trigger Advanced Actions, one of which is to execute JavaScript code.
    You CAN make a text caption clickable by attaching an Event Handler widget to it.  This effectively turns the text caption into an interactive object capable of executing Advanced Actions in response to mouse events.  However, there is no Advanced Action that will turn your text caption into a scrolling caption.

Maybe you are looking for

  • Receiver Time error in adapter Module in PI 7.31

    Hello Team, I am trying working on adapter module that accomplish Message id, Sender Interface name,Receiver Interface name sent time and receiver time. I got all values in my file except receiver time .I have failed to get exact receiver time. sent

  • Buttons created in InDesign, exported to flash

    Good evening, I need to deal with different geometric shapes (about 200) designed in InDesign, such as buttons: 1: click the left should change color, and reclick must return to the old color; Let me know if laying out everything to get what is writt

  • Why am I seeing a white screen instead of my topics.

    I must have done something this morning to cause RoboHelp to turn against me. I was attempting to add an image to a phrase. I wanted to display the topic and see how it looked and worked. Blank screen is all I get. I checked other topics and I get th

  • Best strategy to replace system files/folders from backup?

    I'm having a problem with Mail and Safari quitting upon launch (posted in the Safari for Mac area). Things I've tried in my attempt to solve problem: -repaired permissions -cleaned cache -ran hardware test and removed suspect ram -ran disk utility an

  • Public holidays in different languages

    Hi Experts, We would like to know how to define the public holiday in different languages (English and German) For e.g. May 1st : Labor holiday in english, same holiday need to be mentioned in German language. Please provide the steps how to define t