Adding buttons to Skins

I am trying to add buttons to the XP Blue skin. I can see the
buttons in Preview. I have clicked Update...
When I publish (to RoboInfo) the buttons do not display. Any
ideas?
Thanks.

Hi Mooresville
If RoboInfo works anything like regular RoboHelp does, you
will probably need to expand the Single Source Layouts pseudo
folder and double-click the layout to get at the properties. But
something tells me you may not see this in RoboInfo. Hopefully
there is a dialog somewhere that will list all the options
available to you. In regular RoboHelp HTML, when you add a button,
you then have to ensure you enable it in the layout properties
before it will show up in the resulting files.
Sorry I'm not much more help, but having never seen or used
RoboInfo, I'm stabbing in the dark. Hopefully fellow Community
Expert and fellow RoboHelp instructor John Daigle will pick this up
and offer more.
Cheers... Rick

Similar Messages

  • Adding Buttons to a ScrollPane??

    Hello Swing people,
    I have had this problem now for quite some time and still have had no luck in getting it right. I am coding an ordering system and on this form is a Jtable displaying product details. Beside the Jtable are category buttons one after the other in a vertical line and there are 18 of them - meaning they cannot fit on the screen!! Therefore i want these buttons to be in some kind of scollpane or list so they can all be viewed.
    I thought this would be a simple matter of adding buttons to a scrollpane and then to the panel but this has proved not the case! Does anyone know how i could do this as i have been trying this for too long without the help of you geniuses???
    To give u an idea of what i was trying here is a snippet of my code:
    import javax.swing.*;
    public class junk2 extends JFrame{
         junk2()    {
         JPanel panel = new JPanel();
         panel.setLayout(new java.awt.GridLayout(0, 1) );
         JButton []button = new JButton[20];
         for(int i=0; i<button.length; i++) {
              button=new JButton(""+(i+1) );
              panel.add(button[i]);
         JScrollPane scroll = new JScrollPane(panel);
         getContentPane().add(scroll, java.awt.BorderLayout.CENTER);
         setSize(50, 100);
         setDefaultCloseOperation( EXIT_ON_CLOSE );
         public static void main(String []args) {
              new junk2().show();
    This code is fine and puts buttons in a vertical line but the buttons only have numbers on them from 1-20, i want the names of the buttons i have declared to be in here - therefore allowing the action performed on these buttons to be recognised and therefore work too! - anyone know how to get around this??
    Also the scrollpane with these buttons in apears in a whole new frame being that it is a small test program but does anyone know how to ensure the buttons appear in the scrollpane only and not in a new frame??
    all 25 dukes if someone can sort this long problem out!!!

    Hi guys thanks a lot for your replies, i compiled both of them and they are fine! the first reply is more what i am looking for but there is still a problem, i am finding it difficult to incorporate this piece of code into my order form class.
    Im trying to take out the current declarations of my JButtons and replace it with the code i was given (reply 1) and obviously keep my action performed methods there as they will be the same but cant seem to do this!
    If anyone can add in the code from reply 1 into my code below or at least help me i will give u the 25 dukes, taking into consideration i still want the form (panel) to be displayed as well as the panel or scrollpane containing the JButtons???
    Can u help - cheers in advance!!
    Pc
    public class OrderForm extends JFrame implements ActionListener {
         private JPanel panel;
         private JButton saveArchive,unCompleted,submitOrder,checkSheet,clear,exit,bread,fruit,dairy,
    salads,cakes,frozen,meat,cheeses,sauces,dry,drinks,soup,cleaning,boxes,cups,cutlery,lids,misc,stick,soup2;
         private JScrollPane pane;
         private JTextField textorderno,textorderdate,textdelivdate,textemp,textshop,textsupp;
         private JLabel heading1,heading2,orderno,orderdate,delivdate,emp,shop,supplier;
         private String todaysDate, deliveryDate;
         private ResultSet result;
         private ResultSet shops;
         private int column_count;
         private JComboBox combobox;
         ResultSetTableModel model = new ResultSetTableModel();
         Result rs = new Result(); 
         Orders orderSaving = new Orders();
         ProductOrders tableSaving = new ProductOrders();
         private boolean save;
         JTable table;
         public OrderForm()throws SQLException {
              displayForm();
              displayFields();//Have not provided coz it aint needed for this
              displayButtons();//Wont need this anymore i dont think
              getContentPane().add(panel);
              setVisible(true);
         public void displayForm() throws SQLException{
              setTitle("Pret Ordering System");
              setSize(700,600);
              // Center the frame
              Dimension dim = getToolkit().getScreenSize();
              setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2);
              //Creates the coloured bored around the panel
              panel = new JPanel();
              panel.setLayout( null );
              Border paneltitled = BorderFactory.createLineBorder(Color.red.darker().darker(),10);
              panel.setBorder(paneltitled);
              ResultSet result = rs.setBreadProds();
              model.fillTableModel(result);
              table = new JTable(model);
              for(int i = 0; i < column_count; i++) {          
                   table.getColumnModel().getColumn (i).setPreferredWidth (200);                   
              table.setSelectionForeground( Color.white );
              table.setSelectionBackground( Color.red.darker().darker() );
              pane = new JScrollPane(table);
                  pane.setBounds(190, 230, 440, 200);
                  panel.add(pane);
              combobox = new JComboBox();
              ResultSet shops = rs.getSupplierNames();
              while(shops.next()){  
                   combobox.addItem(shops.getString("supplier_name"));
    //Hope you can help - cheers

  • How to display checkbox within button using skin?

    Hi,
    I am trying to put checkbox inside spark button using skin. The button looks like  -
    I want the button to repond mouse event (which is any way responding), but I also want check box too should respond to mouse event when mouse pointer is over check box.
    I am able to create button which looks like above. But when I move mouse pointer over button, the button look changed and looks like -
    As can be seen that there is no check box. I need check box to be shown always in button and should also be clickable.
    Do any one have idea how to solve it?
    Thanks,
    Prithveesingh Zankat.

    Hi,
    Here is complete skin code-
    <s:SparkButtonSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
                       xmlns:s="library://ns.adobe.com/flex/spark"
                       xmlns:fb="http://ns.adobe.com/flashbuilder/2009"
                       minWidth="21" minHeight="21"
                       alpha.disabled="0.5"
                       width.up="84">
        <fx:Metadata>
            <![CDATA[
             * @copy spark.skins.spark.ApplicationSkin#hostComponent
            [HostComponent("spark.components.Button")]
            ]]>
        </fx:Metadata>
        <fx:Script fb:purpose="styling">
            <![CDATA[        
                import spark.components.Group;
                /* Define the skin elements that should not be colorized.
                For button, the graphics are colorized but the label is not. */
                static private const exclusions:Array = ["labelDisplay"];
                 * @private
                override public function get colorizeExclusions():Array {return exclusions;}
                 * @private
                override protected function initializationComplete():void
                    useChromeColor = true;
                    super.initializationComplete();
                 *  @private
                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number) : void
                    var cr:Number = getStyle("cornerRadius");
                    if (cornerRadius != cr)
                        cornerRadius = cr;
                        shadow.radiusX = cornerRadius;
                        fill.radiusX = cornerRadius;
                        lowlight.radiusX = cornerRadius;
                        highlight.radiusX = cornerRadius;
                        border.radiusX = cornerRadius;
                    if (highlightStroke)
                        highlightStroke.radiusX = cornerRadius;
                    if (hldownstroke1)
                        hldownstroke1.radiusX = cornerRadius;
                    if (hldownstroke2)
                        hldownstroke2.radiusX = cornerRadius;
                    super.updateDisplayList(unscaledWidth, unscaledHeight);
                private var cornerRadius:Number = 2;
            ]]>       
        </fx:Script>
        <!-- states -->
        <s:states>
            <s:State name="up" />
            <s:State name="over" />
            <s:State name="down" />
            <s:State name="disabled" />
        </s:states>
        <!-- layer 1: shadow -->
        <!--- @private -->
        <s:Rect id="shadow" left="-1" right="-1" top="-1" bottom="-1" radiusX="2">
            <s:fill>
                <s:LinearGradient rotation="90">
                    <s:GradientEntry color="0x000000"
                                     color.down="0xFFFFFF"
                                     alpha="0.01"
                                     alpha.down="0" />
                    <s:GradientEntry color="0x000000"
                                     color.down="0xFFFFFF"
                                     alpha="0.07"
                                     alpha.down="0.5" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect>
        <!-- layer 2: fill -->
        <!--- @private -->
        <s:Rect id="fill" left="1" right="1" top="1" bottom="1" radiusX="2">
            <s:fill>
                <s:LinearGradient rotation="90">
                    <s:GradientEntry color="0xFFFFFF"
                                     color.over="0xBBBDBD"
                                     color.down="0xAAAAAA"
                                     alpha="0.85" />
                    <s:GradientEntry color="0xD8D8D8"
                                     color.over="0x9FA0A1"
                                     color.down="0x929496"
                                     alpha="0.85" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect>
        <!-- layer 3: fill lowlight -->
        <!--- @private -->
        <s:Rect id="lowlight" left="1" right="1" top="1" bottom="1" radiusX="2">
            <s:fill>
                <s:LinearGradient rotation="270">
                    <s:GradientEntry color="0x000000" ratio="0.0" alpha="0.0627" />
                    <s:GradientEntry color="0x000000" ratio="0.48" alpha="0.0099" />
                    <s:GradientEntry color="0x000000" ratio="0.48001" alpha="0" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect>
        <!-- layer 4: fill highlight -->
        <!--- @private -->
        <s:Rect id="highlight" left="1" right="1" top="1" bottom="1" radiusX="2">
            <s:fill>
                <s:LinearGradient rotation="90">
                    <s:GradientEntry color="0xFFFFFF"
                                     ratio="0.0"
                                     alpha="0.33"
                                     alpha.over="0.22"
                                     alpha.down="0.12"/>
                    <s:GradientEntry color="0xFFFFFF"
                                     ratio="0.48"
                                     alpha="0.33"
                                     alpha.over="0.22"
                                     alpha.down="0.12" />
                    <s:GradientEntry color="0xFFFFFF"
                                     ratio="0.48001"
                                     alpha="0" />
                </s:LinearGradient>
            </s:fill>
        </s:Rect>
        <!-- layer 5: highlight stroke (all states except down) -->
        <!--- @private -->
        <s:Rect id="highlightStroke" left="1" right="1" top="1" bottom="1" radiusX="2" excludeFrom="down">
            <s:stroke>
                <s:LinearGradientStroke rotation="90" weight="1">
                    <s:GradientEntry color="0xFFFFFF" alpha.over="0.22" />
                    <s:GradientEntry color="0xD8D8D8" alpha.over="0.22" />
                </s:LinearGradientStroke>
            </s:stroke>
        </s:Rect>
        <!-- layer 6: highlight stroke (down state only) -->
        <!--- @private -->
        <s:Rect id="hldownstroke1" left="1" right="1" top="1" bottom="1" radiusX="2" includeIn="down">
            <s:stroke>
                <s:LinearGradientStroke rotation="90" weight="1">
                    <s:GradientEntry color="0x000000" alpha="0.25" ratio="0.0" />
                    <s:GradientEntry color="0x000000" alpha="0.25" ratio="0.001" />
                    <s:GradientEntry color="0x000000" alpha="0.07" ratio="0.0011" />
                    <s:GradientEntry color="0x000000" alpha="0.07" ratio="0.965" />
                    <s:GradientEntry color="0x000000" alpha="0.00" ratio="0.9651" />
                </s:LinearGradientStroke>
            </s:stroke>
        </s:Rect>
        <!--- @private -->
        <s:Rect id="hldownstroke2" left="2" right="2" top="2" bottom="2" radiusX="2" includeIn="down">
            <s:stroke>
                <s:LinearGradientStroke rotation="90" weight="1">
                    <s:GradientEntry color="0x000000" alpha="0.09" ratio="0.0" />
                    <s:GradientEntry color="0x000000" alpha="0.00" ratio="0.0001" />
                </s:LinearGradientStroke>
            </s:stroke>
        </s:Rect>
        <!-- layer 7: border - put on top of the fill so it doesn't disappear when scale is less than 1 -->
        <!--- @private -->
        <s:Rect id="border" left="0" top="0" bottom="0" radiusX="2"
                right.disabled="0" width.disabled="69" height.disabled="20"
                right.down="0" width.down="69" height.down="20"
                right.over="0" width.over="69" height.over="20"
                left.up="0" right.up="0" top.up="0" bottom.up="0">
            <s:stroke>
                <s:LinearGradientStroke rotation="90" weight="1">
                    <s:GradientEntry color="0x000000"
                                     alpha="0.5625"
                                     alpha.down="0.6375" />
                    <s:GradientEntry color="0x000000"
                                     alpha="0.75"
                                     alpha.down="0.85" />
                </s:LinearGradientStroke>
            </s:stroke>
        </s:Rect>
        <!-- layer 8: text -->
        <!--- @copy spark.components.supportClasses.ButtonBase#labelDisplay  -->
        <s:Label id="labelDisplay" left="10" top="2" bottom="2" maxDisplayedLines="1" textAlign="center"
                 verticalAlign="middle"
                 right.disabled="10" horizontalCenter.disabled="0" verticalCenter.disabled="1"
                 left.down="20" right.down="5" top.down="2" bottom.down="2" horizontalCenter.down="7"
                 left.over="20" right.over="5" top.over="2" bottom.over="2" horizontalCenter.over="7"
                 left.up="20"  right.up="5"    top.up="2"   bottom.up="2"   horizontalCenter.up="7"
                 verticalCenter.up="2">
        </s:Label>
        <s:CheckBox includeIn="up" left="2" top="2" bottom="2" width="16" verticalCenter="0"
                    right.disabled="10" horizontalCenter.disabled="0" verticalCenter.disabled="0" width.disabled="18"
                    left.down="2" top.down="2" bottom.down="2" verticalCenter.down="0" width.down="18"
                    left.over="0" top.over="2" bottom.over="2" verticalCenter.over="0" width.over="18"
                    left.up="2"   top.up="2"   bottom.up="2"   verticalCenter.up="0"   width.up="18"
                    />
    </s:SparkButtonSkin>
    Thank,
    Prithveesingh Zankat.

  • Bug? Mouse wheel doesn't work on Firefox and Chrome when added an application skin

    I added a customized skin to make the background of Flex to transparent. The skin is created by the "new file wizard" and only changed the "backgroundRect" 's alpha to "0".
    It works with no problem in IE8.0.6001 and Opera11.6 but doesn't respond to any mouse wheel event in FireFox 11.0 and Google Chrome 17.0.963.79.
    Is it a BUG?
    The flash player's versions are: IE:11.1.102.55; FireFox:11.1.102.55; Chrome:11.1.102.63; Opera:11.1.102.55

    I opened a new Flex project and then tried again. I finally found that it's not a problem of flash but div rendering.
    It seems Firefox and Chorme don't pass mouse wheel event automatically if div layout is set to "absolute".
    Although this is not a Flex issue, any idea of passing that event to flash will be appriciated. I haven't find a way to do it so far :-(
    What I'm doing is editing the "index.tamplate.html" to test. I added a div to contain the div of "flashContent" and set it's style to:
        position: absolute;
        top: 150px; left: 150px;
        height: 250px; width: 250px;
        z-index: 10;
    Another div's z-index is set to 1 to test the overlay effect.
    The reason why I added a div to contain the original div of flash, is I cannot figure out a way to effectively edit the CSS of the "flashContent" div.
    Any help will be thankful!!

  • Captiave 2 - Adding Buttons to Question Slides

    I need to use the Captivate Question Slide "maker" to create
    interactive questions with navigation back to the "Jeopardy-esque"
    main page. When doing so, the question slide maker prevents adding
    buttons/navigation, etc.
    Any work arounds, hints, suggestions?
    Thanks...

    Hi Beta Bob and welcome to our community
    As you have seen, you cannot insert interactive objects
    (Buttons, Click Boxes or Text Entry Boxes) on Question slides.
    The only workaround I can think of is to sort of simulate the
    question slide using these objects on a standard slide.
    Cheers... Rick

  • Standard buttons not displaying ALV when added button by creating PF status

    Hi  All,
    I have added a button(using SE41) in application toolbar for ALV grid using Factory method.But the problem is I am unable to see the standard tool bar buttons(Layout,Download,Mail etc).
    Even I tried adding buttons(using standard FCODES) to the PFstatus.Now the buttons are visible but the functionality is not working for all buttons.Its working only for Graphic and Change layout buttons.
    Can any one suggest...??
    -Phaniram

    Disregard DKS's response...that's the older stuff and you're using NetWeaver ALV.
    In SALV you can cause those buttons to appear, but you may need to copy the SALV_STANDARD GUI from one of the SALV* named program using SE80...sounds like you have that part, but you may need to turn functions ON...
    Perhaps something like this would help:
    data:  gr_f_list  type ref to cl_salv_functions_list,
             gr_alv     type ref to cl_salv_table,
    SALV toolbar & GUI functions
      gr_f_list = gr_alv->get_functions( ).     "Get Toolbar functions
      gr_f_list->set_all( abap_true ).          "All On
      gr_f_list->set_view_lotus( abap_false ).  "Lotus 123 off
      gr_f_list->set_view_excel( abap_false ).  "Excel in Place Off
      gr_f_list->set_graphics( abap_false ).    "Graph tool off
    For undesired buttons, set each tool OFF after turning all ON.

  • How to make separation between added buttons into a jToolBar?

    Hi friends,
    I have made a jToolBar (using NetBeans IDE 5.5) with several buttons, but i dont know how to make custom separation between those added buttons. I will appreciate it if anyboy give me some tips.
    Thanks in advance,
    Reza_mp

    I don't know about NetBeans but yeah U can add horizontal atruts and verticals struts between two components, i.e.
    1.) add first component
    2.) add horizontal or vertical struts(according to ur toolbar)
    3.) add second component
    4.) add add horizontal or vertical struts(according to ur toolbar)
    this will definitely solve ur problem.
    If it does, don't forget to pay ur points.

  • Recently added     button accidently deleted How do I get this button back?

    'Recently added' button accidently deleted How do I get this button back?
    I can not find where my tracks off a cd are
    on my imac with out this button or
    icon on the left hand side of itunes.
    HELP I am technically challenged but
    relatively intelligent musician!

    catcowkitty wrote:
    'Recently added' button
    that button is actually a *smart playlist* which you can create yourself quite easily.
    in iTunes, choose +new smart playlist+ from the file menu and recreate the following rules:
    the screenshot is from my original recently added playlist.
    JGG

  • Can i restore the 'recently added' button in the sidebar of iTunes?

    It happend that I accidencially erased the 'Recently Added' button from the sidebar in iTunes which is a bit of a dissaster for me as I often add mp3's from musicproductions elsewere. It makes it quite difficult to find the songs without that button.

    Hi Jimzgoldfinch
    It worked, i have a new smart playlist up and running. That's great, thanks a lot!
    Sam Foh

  • Adding button to a custom table cell (and handling them)

    Hi
    I'm wondering if it's possible to add a button on each row of a table view using a custom table cell view. If it's possible, I'm really wondering how I can handle the click events on these buttons.
    Thanks

    No.
    Try creating a view and adding it to a cell. Let us know what problems you have, and we can try to help.

  • Problem in embedding a png file for a button's skin

    I am trying to embed a png graphic as a skin for a button using actionscript class for a custom component. It has an error: "unable to resolve 'btn.png' for transcoding" - see method 1 code below. However, it works fine in method 2. Code are all shown belown. Can someone help regarding why this happens and how to make method 1 work?
    Got error in method 1:
    package net.abc.free
        import mx.core.BitmapAsset;
        public class myComp extends Canvas {
            [Embed(source="assets/btn.png")]
            [Bindable]
            public var clasBtn:Class;
        public function myComp() {
            super();  
    Successful in method 2: 
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
        <mx:Script>
            <![CDATA[
                import mx.core.BitmapAsset;
                [Embed(source="assets/btn.png")]
                [Bindable]
            public var clasBtn:Class;
            ]]>
        </mx:Script>
        <mx:Panel id="mainPanel" width="400" height="300" backgroundAlpha="0">
            <mx:HBox width="100%" height="100%" horizontalAlign="center" horizontalGap="100">
                <mx:Button id="myBtn" upSkin="{clasBtn}"/>           
            </mx:HBox>
        </mx:Panel>
    </mx:Application>

    If you don't put "/" in front of the path Flex will look for the file in the relative path of the file you refer it from.
    Your first example will look for the png file in:
    /net/abc/free/assets/  -- wrong path
    Your second example will look for it in:
    /assets/ -- since the application mxml file is at root level
    but if you put /assets/  it will look for it in /assets/ no matter where the MXML/AS file is

  • Adding Button to Active Form

    Hi,
    I created button in PO  on Form load event. its working fine.but
    how to add a button on the active(PO)  form once My add-on is started?
    Regards,
    Ganesh k

    Hi,
    i checked for the existance of my button in my active form, if not exist i added my button in et_FORM_ACTIVATE  Event. its working now.
    If pVal.EventType = et_FORM_ACTIVATE And pVal.FormTypeEx = "142" And FLAG = False Then
                oOrderForm = sbo_application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
                Dim ii As Integer
                For ii = 0 To oOrderForm.Items.Count - 1
                    If oOrderForm.Items.Item(ii).UniqueID = "MyBtnId" Then
                        FLAG = True
                    End If
                Next ii
                If FLAG = False Then
                    ADDBUTTON()
                End If
            End If
    Thanks For the Suggestions..
    regards,
    Ganesh K

  • Problem wiht added button on invoice form

    I have added a custom button on invoice form.
    Scenario 1:
    I open the invoice form then the custom button is added and the et_ITEM_PRESSED event on custom button in catched. All is ok!
    Scenario 2
    I open a custom form and after close it.
    After I open the invoice form then custom button is added but et_ITEM_PRESSED event on custom button in not catched!!
    Could somebody please help me?
    Thanks

    Hi Domenico,
    It could be that the custom form gets an exception and then no other events might be caught. Try and put try...catch clauses around all your code and show messages when an error is received. This might be the cause of the problem - an unhandled exception.
    Hope it helps,
    Adele

  • Adding buttons on title line

    I am relatively new to Flex and I have run into a slight
    problem that I that I think is because of lack of experience. I
    have a panel and I have set the title attribute but now I am
    required to add buttons to the right of the title. I am not sure
    what the best way to do this is or even if it is viable. I have
    read in other places throughout the internet that it is possible to
    add buttons to the title of an object, but I do not know how to do
    to proceed. I have thought about it and I think making an HBox and
    adding a label for the title and then the required buttons might
    work, but when it compiles it leaves a blank space above my new
    HBox that just does not look good. Is there someway to override the
    title of the panel or set its height to 0, or better yet some way
    to add buttons to the title line of the panel? Any help would be
    appreciated.

    Check out post...
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid =1271263&highlight_key=y&keyword1=button

  • Adding button events stops core functonality!

    This should be an easy one; here is a piece of code that i have adapted from the Java website!
    The problem occured when i added the code for the buttons in Public void actionPerformed.
    Instead of animating; the picture is static and will only advance by 1 frame if i press either the play or stop buttons! if u remove the code for the buttons the animation works fine!
    what am i doing wrong?
    (T1 to T10 can be any random gif pictures)
    I was wondering if i need a new actionPerformed class or something????
    hope you can help me
    kind regards
    RSH
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ImageSequenceTimer extends JFrame
                                    implements ActionListener {
        ImageSQPanel imageSQPanel;
        static int frameNumber = -1;
        int delay;
        Thread animatorThread;
        static boolean frozen = false;
        Timer timer;
         //Invoked only when this is run as an application.
        public static void main(String[] args) {
            Image[] waving = new Image[10];
            for (int i = 1; i <= 10; i++) {
                waving[i-1] =
                    Toolkit.getDefaultToolkit().getImage("images/T"+i+".gif");
            JFrame f = new JFrame("ImageSequenceTimer");
            f.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
            ImageSequenceTimer controller = new ImageSequenceTimer();
            controller.buildUI(f.getContentPane(), waving);
            controller.startAnimation();
            f.setSize(new Dimension(350, 350));
            f.setVisible(true);
        //Note: Container must use BorderLayout, which is the
        //default layout manager for content panes.
        void buildUI(Container container, Image[] dukes) {
            int fps = 10;
            //How many milliseconds between frames?
            delay = (fps > 0) ? (1000 / fps) : 100;
            //Set up a timer that calls this object's action handler
            timer = new Timer(delay, this);
            timer.setInitialDelay(0);
            timer.setCoalesce(true);
            JPanel buttonPanel = new JPanel();
            JButton play = new JButton("PLAY");
            play.addActionListener(this);
            JButton stop = new JButton("STOP");
            stop.addActionListener(this);
            JButton restart = new JButton("RESTART");
            JButton back = new JButton("Back");
            imageSQPanel = new ImageSQPanel(dukes);
            container.add(imageSQPanel, BorderLayout.CENTER);
            imageSQPanel.addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                    if (frozen) {
                        frozen = false;
                        startAnimation();
                    } else {
                        frozen = true;
                        stopAnimation();
           container.add(buttonPanel, BorderLayout.SOUTH);
           buttonPanel.add(play);
           buttonPanel.add(stop);
           buttonPanel.add(restart);
           buttonPanel.add(back);
        public void start() {
            startAnimation();
        public void stop() {
            stopAnimation();
        public synchronized void startAnimation() {
            if (frozen) {
                //Do nothing.  The user has requested that we
                //stop changing the image.
            } else {
                //Start animating!
                if (!timer.isRunning()) {
                    timer.start();
        public synchronized void stopAnimation() {
            //Stop the animating thread.
            if (timer.isRunning()) {
                timer.stop();
        public void actionPerformed(ActionEvent e) {
            //Advance the animation frame.
            frameNumber++;
            //Display it.
            imageSQPanel.repaint();
            {JButton button = (JButton) e.getSource();
             String label = button.getText();
             if("PLAY".equals(label))
             { start();
             else if("STOP".equals(label))
             { stop();
        class ImageSQPanel extends JPanel{
            Image dukesWave[];
            public ImageSQPanel(Image[] dukesWave) {
                this.dukesWave = dukesWave;
            //Draw the current frame of animation.
            public void paintComponent(Graphics g) {
                super.paintComponent(g); //paint background
                //Paint the frame into the image.
                try {
                    g.drawImage(dukesWave[ImageSequenceTimer.frameNumber%10],
                                0, 0, this);
                } catch (ArrayIndexOutOfBoundsException e) {
                    //On rare occasions, this method can be called
                    //when frameNumber is still -1.  Do nothing.
                    return;
    }

    You get ClassCastException at JButton button = (JButton) e.getSource(); therefore
    1. Always look if there are any exceptions thrown
    2. In this case e.getSource() does not always return JButton object reference, actionPerformed is also called by Timer. This is a source of your exception: you cast correctly only once - when button is pressed; then Timer calls actionPerformed, exception is thrown and animation stops.
    Here s corrected code
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test extends JFrame
                                    implements ActionListener {
        ImageSQPanel imageSQPanel;
        static int frameNumber = -1;
        int delay;
        Thread animatorThread;
        static boolean frozen = false;
        Timer timer;
        JButton play, stop; // <------------------------------------
         //Invoked only when this is run as an application.
        public static void main(String[] args) {
            Image[] waving = new Image[10];
            for (int i = 1; i <= 10; i++) {
                waving[i-1] =
                    Toolkit.getDefaultToolkit().getImage("images/T"+i+".gif");
            JFrame f = new JFrame("ImageSequenceTimer");
            f.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
            Test controller = new Test();
            controller.buildUI(f.getContentPane(), waving);
            controller.startAnimation();
            f.setSize(new Dimension(350, 350));
            f.setVisible(true);
        //Note: Container must use BorderLayout, which is the
        //default layout manager for content panes.
        void buildUI(Container container, Image[] dukes) {
            int fps = 10;
            //How many milliseconds between frames?
            delay = (fps > 0) ? (1000 / fps) : 100;
            //Set up a timer that calls this object's action handler
            timer = new Timer(delay, this);
            timer.setInitialDelay(0);
            timer.setCoalesce(true);
            JPanel buttonPanel = new JPanel();
            play = new JButton("PLAY"); // <------------------------------------
            play.addActionListener(this);
            stop = new JButton("STOP"); // <------------------------------------
            stop.addActionListener(this);
            JButton restart = new JButton("RESTART");
            JButton back = new JButton("Back");
            imageSQPanel = new ImageSQPanel(dukes);
            container.add(imageSQPanel, BorderLayout.CENTER);
            imageSQPanel.addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                    if (frozen) {
                        frozen = false;
                        startAnimation();
                    } else {
                        frozen = true;
                        stopAnimation();
           container.add(buttonPanel, BorderLayout.SOUTH);
           buttonPanel.add(play);
           buttonPanel.add(stop);
           buttonPanel.add(restart);
           buttonPanel.add(back);
        public void start() {
            startAnimation();
        public void stop() {
            stopAnimation();
        public synchronized void startAnimation() {
            if (frozen) {
                //Do nothing.  The user has requested that we
                //stop changing the image.
            } else {
                //Start animating!
                if (!timer.isRunning()) {
                    timer.start();
        public synchronized void stopAnimation() {
            //Stop the animating thread.
            if (timer.isRunning()) {
                timer.stop();
        public void actionPerformed(ActionEvent e) {
            //Advance the animation frame.
            frameNumber++;
            //Display it.
            imageSQPanel.repaint();
             if(e.getSource() == play) // <------------------------------------
             { start();
             else if(e.getSource() == stop) // <------------------------------------
             { stop();
        class ImageSQPanel extends JPanel{
            Image dukesWave[];
            public ImageSQPanel(Image[] dukesWave) {
                this.dukesWave = dukesWave;
            //Draw the current frame of animation.
            public void paintComponent(Graphics g) {
                super.paintComponent(g); //paint background
                //Paint the frame into the image.
                try {
                    g.drawImage(dukesWave[Test.frameNumber%10],
                                0, 0, this);
                } catch (ArrayIndexOutOfBoundsException e) {
                    //On rare occasions, this method can be called
                    //when frameNumber is still -1.  Do nothing.
                    return;
    }

Maybe you are looking for

  • Need help on developing a report

    Hey Experts, Any one has done report on opening stock. The report should display opening stock, issues, receipts and closing stock for a material. Any inputs ASAP would be highly appreciated. Please help. Regards Shankar

  • How to extract a csv registered in a BLOB column

    I've got a BLOB column where there is a CSV. How can I download the CSV? Oracle vers. 8i Thanks in advance!

  • How do I make a FFT filter fade over time?

    I am trying to apply a FFT filter (underwater shallow) to an audio track, but I want it to gradually fade until we here the original non-filtered audio at the end. I've created a multitrack session, but Show Envelopes does not unclude the FFT filter.

  • Simple CQL query error - Invalid statement: select one from inputChannel

    Hi, I am new to oracle cep, I wrote a simple query.... "select * from inputChannel RETAIN 5 EVENTS" but some how it shows the error as . Invalid statement: "select one from >>inputChannel RETAIN<< 5 EVENTS" Cause: generic syntax error Action: The syn

  • How Do I Creative Media Source Organizer to recognize my old playli

    I have recently changed hardri'ves to my new computer. I have spent months editing my track properties to create a playlist. I copied all my music and playlist to the new hardri've, I browsed PC Library to "My Playlist", but I cannot get the organize