Help! Spark Datagrid overriding a method

Hi!
I need help!
Do you know how to override a select item/row method in a spark datagrid? In mx datagrid, the method is selectItem, how about for the spark datagrid?

You didn't override the method handleException in JBDCBatchJob, you just overloaded it. So int JBDCBatchJob, you actually had two versions of handleException, one that took a parameter of the type Exception, one that took a parameter of the type SQLException.
So, in SimpleJDBCBatchJob, you need to have a catch block like
try {
// statements that may throw SQLException or in general Exception
catch (SQLException sqle) {
handleException( sqle );
catch (Exception e) {
handleException( e );
This would call your handleException in BatchJob if a general exception was thrown, and the handleException in JBDCBatchJob if a SQLException was thrown from the try block.
Hope that makes things clearer for you.
Alan

Similar Messages

  • HELP: Inheritance question: Overriding a method.

    Hi all.
    I have one class: BatchJob.java which defines the following method:
    (1) protected void handleException(Exception e) {
         setInitError( true );
         printTrace(getClass().getName(), "*** ERROR: " + e.toString());
         createMailError(e);
    Another class JBDCBatchJob.java which extends BatchJob, overrides the previous method like this:
    (2) protected void handleException(SQLException sqlEx) {
         setInitError( true );
         printTrace(getClass().getName(), getSqlQuery(), sqlEx);
         createMailError(getSqlQuery(), sqlEx);
    where getSqlQuery() is a getter for a String member field which contains the last SQL query sent to the JDBC Driver.
    In another class (say SimpleJDBCBatchJob) which extends JDBCBatchJob, I've got the following code fragment:
    try {
    // statements that may throw SQLException or in general Exception
    catch (Exception e) {
    handleException( e );
    I have realized that the method invoked by the JVM when an SQLException is thrown in SimpleJDBCBatchJob is (1), that is, the "handleException" defined in BatchJob and not that in JDBCBatchJob which it should (or at least, that's what I meant). Why is it? Is it possible to accomplish this without having to rename the method (2), I mean, using method overriding? Any idea would be highly appreciated. THANKS in advance.

    You didn't override the method handleException in JBDCBatchJob, you just overloaded it. So int JBDCBatchJob, you actually had two versions of handleException, one that took a parameter of the type Exception, one that took a parameter of the type SQLException.
    So, in SimpleJDBCBatchJob, you need to have a catch block like
    try {
    // statements that may throw SQLException or in general Exception
    catch (SQLException sqle) {
    handleException( sqle );
    catch (Exception e) {
    handleException( e );
    This would call your handleException in BatchJob if a general exception was thrown, and the handleException in JBDCBatchJob if a SQLException was thrown from the try block.
    Hope that makes things clearer for you.
    Alan

  • Overriding Spark DataGrid item renderer's prepare method - renderer's child is initially null

    I am currently using the 4.12.0 SDK.  I have a Spark DataGrid setup that makes use of an externally-defined itemRenderer:
    <s:DataGrid id="dgEquipment"
                width="100%" height="100%"
                doubleClickEnabled="true"
                creationComplete="init()" doubleClick="popTab(event)">
      <s:columns>
        <s:ArrayList>
          <s:GridColumn itemRenderer="renderers.equipment.IconRenderer"
                        dataField="EXISTING"
                        width="22"/>
    The data provider is set programmatically after a remote call has returned a result.
    I have the renderer setup as follows:
    <?xml version="1.0" encoding="utf-8"?>
    <s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                        xmlns:s="library://ns.adobe.com/flex/spark"
                        xmlns:mx="library://ns.adobe.com/flex/mx"
                        dataChange="init()" remove="dispose()">
      <s:layout>
        <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
      </s:layout>
      <fx:Script>
        <![CDATA[
          import mx.controls.Menu;
          import mx.events.MenuEvent;
          import spark.components.DataGrid;
          [Bindable]
          [Embed(source="../../../assets/images/Icon 1.png")]
          private var ico1:Class;
          [Bindable]
          [Embed(source="../../../assets/images/Icon 2.png")]
          private var ico2:Class;
          [Bindable]
          [Embed(source="../../../assets/images/Icon 3.png")]
          private var ico3:Class;
          private var isExisting:Boolean;
          private var popUp:Menu;
          private function init():void
            if (data)
              isExisting = data.EXISTING == 1;
          private function dispose():void
            if (popUp)
              popUp.removeEventListener(MenuEvent.ITEM_CLICK, popUp_click);
              popUp = null;
            if (imgActions)
              imgActions.removeEventListener(MouseEvent.CLICK, image_click);
              imgActions = null;
          override public function prepare(hasBeenRecycled:Boolean):void
            if (data)
              if ((data.TYPE == "A" || data.TYPE == "B") && !data.X && !data.Y)
                disableLink();
                imgActions.source = ico3;
                imgActions.toolTip = "Blah blah.";
              else if (data.TYPE == "C" || data.TYPE == "D")
                disableLink();
              else if (isExisting)
                imgActions.source = ico1;  //******************************            imgActions.toolTip = "More blah blah.";
                imgActions.addEventListener(MouseEvent.CLICK, image_click);
              else
                imgActions.source = ico2;
                imgActions.addEventListener(MouseEvent.CLICK, image_click);
                imgActions.toolTip = "Even more blah blah.";
                initPopUp();
          private function initPopUp():void
          private function popUp_click(event:MenuEvent):void
          private function image_click(event:MouseEvent):void
          private function disableLink():void
        ]]>
      </fx:Script>
      <s:Image id="imgActions"
               height="18" width="18"/>
    </s:GridItemRenderer>
    When the code reaches the line where I have added a comment full of asterisks, I get the following error:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at renderers.equipment::IconRenderer/prepare()[C:\…\renderers\equipment\IconRenderer.mxml:81 ]
        at spark.components.gridClasses::GridViewLayout/initializeItemRenderer()[/Users/justinmclean /Documents/ApacheFlex4.12.0/frameworks/projects/spark/src/spark/components/gridClasses/Gri dViewLayout.as:1808]
        at spark.components.gridClasses::GridViewLayout/createTypicalItemRenderer()[/Users/justinmcl ean/Documents/ApacheFlex4.12.0/frameworks/projects/spark/src/spark/components/gridClasses/ GridViewLayout.as:1243]
        at spark.components.gridClasses::GridViewLayout/updateTypicalCellSizes()[/Users/justinmclean /Documents/ApacheFlex4.12.0/frameworks/projects/spark/src/spark/components/gridClasses/Gri dViewLayout.as:1374]
        at spark.components.gridClasses::GridViewLayout/measure()[/Users/justinmclean/Documents/Apac heFlex4.12.0/frameworks/projects/spark/src/spark/components/gridClasses/GridViewLayout.as: 875]
        at spark.components.supportClasses::GroupBase/measure()[/Users/justinmclean/Documents/Apache Flex4.12.0/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as:1156 ]
        at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[/Users/justinmclean/Documents/ApacheFlex4.12.0/frameworks/projects/framework/src/mx/cor e/UIComponent.as:9038]
        at mx.core::UIComponent/validateSize()[/Users/justinmclean/Documents/ApacheFlex4.12.0/framew orks/projects/framework/src/mx/core/UIComponent.as:8962]
        at spark.components::Group/validateSize()[/Users/justinmclean/Documents/ApacheFlex4.12.0/fra meworks/projects/spark/src/spark/components/Group.as:1074]
        at mx.managers::LayoutManager/validateSize()[/Users/justinmclean/Documents/ApacheFlex4.12.0/ frameworks/projects/framework/src/mx/managers/LayoutManager.as:673]
        at mx.managers::LayoutManager/doPhasedInstantiation()[/Users/justinmclean/Documents/ApacheFl ex4.12.0/frameworks/projects/framework/src/mx/managers/LayoutManager.as:824]
        at mx.managers::LayoutManager/doPhasedInstantiationCallback()[/Users/justinmclean/Documents/ ApacheFlex4.12.0/frameworks/projects/framework/src/mx/managers/LayoutManager.as:1188]
    Running the debugger shows that this occurs with the first item in the data provider.  If I alter the prepare method to check for the existence of imgActions before doing anything, everything works fine after the first item.  So I'll have one row in the DataGrid with a missing icon, and all the rest will have icons.
    So the question is, is it normal for prepare to run before any children of the item renderer are created?  If so, how should I handle this?
    Many thanks in advance.

    A little more info.  I added some event handlers to the renderer and the image (for events that I thought would be relevant), and here is the order of events based on trace statements within the handlers:
    griditemrenderer1_addedHandler
    griditemrenderer1_addedToStageHandler
    griditemrenderer1_preinitializeHandler
    imgActions_addedHandler
    griditemrenderer1_addedHandler
    imgActions_addedToStageHandler
    imgActions_preinitializeHandler
    imgActions_addedHandler
    griditemrenderer1_addedHandler
    imgActions_initializeHandler
    griditemrenderer1_elementAddHandler
    imgActions_addHandler
    griditemrenderer1_initializeHandler
    griditemrenderer1_addHandler
    prepare called
    imgActions_resizeHandler
    griditemrenderer1_resizeHandler
    imgActions_creationCompleteHandler
    imgActions_updateCompleteHandler
    griditemrenderer1_creationCompleteHandler
    griditemrenderer1_updateCompleteHandler
    griditemrenderer1_removeHandler
    griditemrenderer1_addedHandler
    griditemrenderer1_addedToStageHandler
    imgActions_addedToStageHandler
    griditemrenderer1_addHandler
    griditemrenderer1_dataChangeHandlerTypeError: Error #1009: Cannot access a property or method of a null object reference.
    prepare called
        at renderers.equipment::IconRenderer/prepare()[C:\…\renderers\equipment\IconRenderer.mxml:91 ]
    imgActions_renderHandler
    griditemrenderer1_renderHandler

  • Help needed in overriding the finalize() method!

    Hi
    I need some help in overwriting the finalize() method.
    I have a program, but at certain points, i would like to "kill" a particular object.
    I figured that the only way to do that is to make that object's class override the finalize method, and call it when i need to kill the object.
    Once that is done, i would call the garbage collector gc() to hopefully dispose of it.
    Please assist me?
    Thanks
    Regards

    To, as you put it, kill an object, just null it. This
    will be an indication for the garbage collector to
    collect the object. In the finalizer, you marely null
    all fields in the class. Like this:
    public class DummyClass
    String string = "This is a string";
    Object object = new Boolean(true);
    public void finalize() throws Throwable
    super.finalize();
    string = null;
    object = null;
    public static void main(String[] args)
    //Create a new object, i.e allocate an
    te an instance.
    DummyClass cls = new DummyClass();
    //Null the reference
    cls = null;
    This is a pointless exercise. If an object is being finalized, then all the references it contains are about to cease being relevant anyway, so there's no purpose to be served in setting them to null.
    All that clearing a reference to an object does is to clear the reference. Whether the object is subsequently finalized depends on whether the object has become unreachable.
    Directly calling finalize is permitted, but doesn't usually serve any purpose. In particular, it does not cause the object to be released. Further, calling the finalize method does not consitute finalization of the object. Finalization occurs when the method is called as a consequence of a garbage collector action.
    If a variable contains a reference to an object (say a table), and you want a new table instead, then create a new table object, and assign its reference to the variable. Assuming that the variable was the only place that the old table's reference was stored, the old table will, sooner or later, get finalized and collected.
    Sylvia.

  • Spark DataGrid Help

    Where does one look to find examples on the Spark DataGrid? I know its bleeding edge but I can't find much info on how to use it.
    Specifically, I have two arrays: One with the column data such as [['name', 'string'], ['age', 'int']] and another with row data, such as [[dave, 30], [ray, 29], [jason, 25], [sara, 30]].
    I'd like to have a datagrid bound to these arrays, but not sure how. I'm building a dynamic data browser and it would help to have some info around setting columns dynamically. I played around with creating one array, and giving it objects such as columns, and rows with the data outlined above. Thats not helping either.
    THanks for any direction,
    D

    Thanks Peter,
    I should have been more clear the data/arrays that I am using are brought back from a separate class asynchronously:
    var tableName:String = event.currentTarget.selectedItems[0];
    tableMap[tableName] = {};
    controller.getTableInfo(tableName, function(data:Array):void
    tableInfo.source = data.map(function (element:RowData, index:int, array:Array):String {
    return element.getColumnAsString(1) + " (" + element.getColumnAsString(2) + ")";
    tableMap[tableName].label = tableInfo;
    dataGrid.columnHeaderBar.labelField = "label";
    controller.selectAll(tableName, function(data:Array):void
    tableMap[tableName].data = data;
    dataGrid.dataProvider = new ArrayCollection(tableMap[tableName].data);
    Right now I am close, but the column headings all say [object GridColumn]
    thanks

  • Spark datagrid - custom renderers

    In my Spark DG I have a column that serves a purpose of starting and ending an editing session. I use a custom item renderer with a button that when I click on it initiates editing and gets its icon changed.
    When I click on the same button in another row I want to end editing in the first row and flip its button back to original. I am using states for that.
    Everything seems to be working except when I start editing in row #1 from the top and then click on a button in any other row the button in the first row does not change its icon.
    It has been already days of work trying figuring out what is so special in the row #1. No luck. Please help.
    Thank you.

    I am implementing the datagrid that only redraws and refreshed the cells that are updated insted of refreshing the whole datagrid.
    There is already and example  on MX Datagrid which refreshed only particular cells. Here is the link http://blogs.adobe.com/tomsugden/2010/04/optimizing_the_flex_datagrid_f.html . we can test it by launching application, right click on the application and select "Show redraw regions"
    I have the similar requirement (updating only the refreshed cells, insted of whole datagrid) but I want this feature in Spark Datagrid.
    (similar  one on spark is in this link http://hansmuller-flex.blogspot.com/2011/07/high-performance-christmas-tree.html)
    I am using the prepare method, but still the functionality is not working. When I right click and select show redraw regions. The whole daatgrid is redrawn instead of particular cells.
    override public function prepare(hasBeenRecycled:Boolean):void  {

  • Spark DataGrid Embedded Font Quandary

    01.  In everything that follows, I am talking about the latest [21328] version of the SDK, not that I believe that my problems have anything to do with that release, just so anyone interested and willing to help will know the version.
    02.  My application happens to be rooted in AIR's WindowedApplication, but again, I do not think that has any impact on my problems; I believe the same results would obtain for a Flex Application.
    03.  I have a custom renderer for the Spark DataGrid which extends DefaultGridItemRenderer.  It works fine. Its primary job is to change the font characteristics of each row in the list as a visual clue to the user as to the specific nature of the content that is accessible.  Some entries are just in the Regular font, some in Bold, some in Italic, and some in Bold-Italic.
    04.  I have, for most of the project, embedded the necessary fonts like this:
        [Embed (source="C:/Windows/Fonts/ArnoPro-Caption.otf", fontName="ArnoPro_BI_4",
            fontStyle="italic",
            fontWeight="bold",
            mimeType="application/x-font",
            embedAsCFF="true",
            unicodeRange="U+0021-U+00ff, U+20ac-U+20ac")]
        private const ArnoPro_BI_4:Class;
    As I said, that all works just as advertized.  But, that method of embedding carries the somewhat painful burden of slower compilations, so for the last 24 hours I have unseccessfully been trying to replace that with:
    [Embed (source = "../resources/assets/ArnoPro_BI_4.swf", symbol="ArnoPro_BI_4")]
    private const ArnoPro_BI_4:Class;
    where the swf file was produced via fontswf, using this incantation:
    fontswf -4 -u U+0021-U+00ff,U+20ac-U+20ac -b -i -a ArnoPro_BI_4 -o ArnoPro_BI_4.swf C:/Windows/Fonts/ArnoPro-Caption.otf
    06.  By all that is holy, the two different means of embedding the font ought to yield the same result, but they do not.  I have debugging code inserted to print out the list of fonts upon initiation of the application, and they are identical.  Both means of embedding do succeed in getting the embedded fonts into the .swf, but the attempt to use the fonts fails using the second approach.
    There is, of course, no change being made to the code in the item renderer which merely uses setStyle() to effect the row-by-row result.  The result in the second case is that the only style of the embedded font that renders is 'regular'.
    07.  I have used the 'keep-generated' facility to look at the code being generated by the mxmlc compiler and can see that different code is emitted, but it does not help me find a fix to the problem.  Both forms of the meta-tag do something; both methods of embedding seem to correctly register themselves with the FontManager, but only the method of embedding which actually performs the transcoding during compilation seems to result in a set of registered fronts which can be found and correctly used to render output based on the runtime setting of the font style.

    Thank for the reply
    I hoped that my posting indicated how the fonts in the the .swf file were constructed.  The "-4", argument to the command-line tool, fontswf, as far as I can tell, is the precise analog to the "embedAsCFF" argument in the [Embed] syntax.  That is what makes it so perplexing.  Given all the external documentation that is available for each tool/methodology, I would have thought that the resultant bytecodes, classes, flags, whatever, would have been identical.  The only difference would be the timing of when the transcoding took place.
    Since it is clearly more efficient to only transcode whatever set of fonts an application needs once, not once per build/test turn-around, I would really like to make the fontswf workflow work.  For those of us outside the beneficial environment of your licensed tools, the kindly-provided alternative to the facilities built into Flash Professional and/or Flash Builder give us the greatest degree of productivity.
    Whoever has access to the source code for Font [I can only see the uninteresting FontAsset in the SDK] can probably determine what difference might result from mxmlc working with this intermediate output, when inline transcoding is 'tagged':
    package
    import mx.core.FontAsset;
    [ExcludeClass]
    [Embed(fontName="ArnoPro_IT_4", _resolvedSource="C:/WINDOWS/Fonts/ArnoPro-ItalicCaption.otf", fontStyle="italic", _line="1189", _pathsep="true", embedAsCFF="true", fontWeight="normal", unicodeRange="U+0021-U+00ff, U+20ac-U+20ac", source="C:/Windows/Fonts/ArnoPro-ItalicCaption.otf", _column="2", exportSymbol="AIRZoom_ArnoPro_IT_4", _file="G:/FP/AIRZoom/src/AIRZoom_AS.as", mimeType="application/x-font")]
    public class AIRZoom_ArnoPro_IT_4 extends mx.core.FontAsset
        public function AIRZoom_ArnoPro_IT_4()
            super();
    versus this, when swf extraction is 'tagged':
    package
    import mx.core.FontAsset;
    [ExcludeClass]
    [Embed(fontName="ArnoPro_IT_4", _resolvedSource="C:/WINDOWS/Fonts/ArnoPro-ItalicCaption.otf", fontStyle="italic", _line="1191", _pathsep="true", embedAsCFF="true", fontWeight="normal", unicodeRange="U+0021-U+00ff, U+20ac-U+20ac", source="C:/Windows/Fonts/ArnoPro-ItalicCaption.otf", _column="2", exportSymbol="AIRZoom_ArnoPro_IT_4", _file="G:/FP/AIRZoom/src/AIRZoom_AS.as", mimeType="application/x-font")]
    public class AIRZoom_ArnoPro_IT_4 extends mx.core.FontAsset
        public function AIRZoom_ArnoPro_IT_4()
            super();
    The only difference is that value for '_line' which probably only indicates that one of the two processes has a comment or empty line somewhere.

  • Column stretch event in spark datagrid

    Hi everybody,
    These days I'm converting our Flex application from Flex 3 SDK to Flex 4.5 SDK (Hero).
    I've a problem with the spark datagrid, and more specifically, the events listening on the columns.
    How can we know that the columns in the spark datagrid are stretched or shrinked?
    In Flex 3, there was a DataGridEvent.COLUMN_STRETCH event on the datagrid and I can't find the equivalent in Flex 4.5.
    If you have any tips.... thanks!!!!

    When a GridColumn is interactively resized "widthChanged" events are dispatched because the column's width property is set.   To track the entire column separator press-drag-release gesture you can listen for GridEvent.SEPARATOR_MOUSE_DOWN,SEPARATOR_MOUSE_DRAG, etc..events on the DataGrid's columnHeaderGroup skin part.   If you wanted to change the way the interactive column resizing works you'd have to subclass DataGrid and override protected methods like separator_mouseDownHandler(event:GridEvent), separator_mouseDragHandler(event:GridEvent).
    - Hans

  • Setting font style on hover for spark datagrid

    I'm trying to skin a Spark datagrid. I have most things sorted by creating a custom skin, but one thing I can't find is how to set the colour of the row's font on hover. I can set the background colour fine, but how would I go about changing the font colour when a user hovers over the row?
    Thanks

    Hi
    You don’t actually deal with the text that’s displayed in the a datagrid inside of the skin
    Look at item renderers for the grid columns. You can style your text or whatever else you would like to display in the grid, in the renderer
    Hope that helps a little
    If you are still stuck just let me know and I’ll send you some code
    Cheers
    g
    heres some code
    NOTE: I am making this up as I sit here so I may be forgetting something. Don’t be surprised if this doesn’t work, but the basic idea is right I think
    So in the spark datagrid when you set your column (if you use mxml) this will replace a glob renderer so you can have a different one for each column if you wish.
    <s:GridColumn dataField="Status"
    headerText="name"
    width="37"                                                    
    itemRenderer="fooRenderer"
    />
    Or set a gloabel renderer in the grid def itself
    <s:DataGrid itemRenderer=”fooRenderer” />
    Then write a custom renderer: fooRenderer.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/mx"
                         clipAndEnableScrolling="true"
                         >
           <fx:Script>
                  <![CDATA[
                         override public function discard(willBeRecycled:Boolean):void
                               labelData.text="";
                               super.discard(willBeRecycled);
                         override public function prepare(hasBeenRecycled:Boolean):void
                               if(data)
                                       // set the colour of the text label to black
                                      labelData.setStyle("color",0x000000)
                                      // put some logic here to dynamic style the label
                               //check for the 'format' function on the column  (THIS MAY BE WRONG)
                               if( column.labelFunction != null )
                                      labelData.text = column.labelFunction( data, column );
                               else
                                      labelData.text = data[column.dataField];
                         super.prepare(hasBeenRecycled);
                  ]]>
           </fx:Script>
           <s:Label id="labelData" />
    </s:GridItemRenderer

  • Want to implent CheckBox for itemRenderer and headerItemRenderer for spark DataGrid.

    I am using mx:DataGrid in my application.
    The first column itemRenderer and headerItermRenderer is CheckBox.
    Now I want to move it to spark DataGrid. I could imprement itermRenderer easily by creating sub-claassing GridItemRenderer. But I am struck at implementing headerItermRenderer. I tried to implent it using GridItemRenderer sub-class as I did with itemRenderer. It is not working. The set data method is not getting called.
    Do anyone have code for implenting checkbox as itemRenderer and headerRendere in spark datagrid (and not mx datagrid)?
    Thanks,
    Prithvee Zankat.

    Hi,
    Item renderer can be implemented for spark and i think you will have to write custom header renderer. I am providing some useful links,please go through them :
    http://help.adobe.com/en_US/flex/using/WS0ab2a460655f2dc3-427f401412c60d04dca-7ff3.html
    http://cookbooks.adobe.com/post_3_state_checkbox_for_header_renderer_in_datagrid-18900.htm l
    http://blogs.adobe.com/aharui/category/item-renderers
    http://boardreader.com/thread/Spark_Datagrid_custom_header_renderer_1zw07Xgoeo.html
    Thanks and Regards,
    Vibhuti Gosavi | [email protected] | www.infocepts.com

  • Is not abstract and does not override abstract method actionPerformed

    I dont how to corr. Please help!! and thank you very much!!
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class test extends JFrame implements ActionListener, ItemListener
              private CenterPanel centerPanel;
              private QuestionPanel questionPanel;
              private ButtonPanel buttonPanel;
              private ResponsePanel responsePanel;
              private JButton b1,b2,b3,b4,b5;               //Create five references to Jbutton instances
         private JTextField t1,t2,t3,t4,t5;          //Create five references to JTextField instances
              private JLabel label1;                    //Create one references to JLabel instances
              private JRadioButton q1,q2,q3;               //Create three references to JRadioButton instances
              private ButtonGroup radioGroup;               //Create one references to Button Group instances
              private int que1[] = new int[5];           //Create int[4] Array
              private int que2[] = new int[5];
              private int que3[] = new int[5];
              private String temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9, temp10,
                        temp11, temp12, temp13, temp14, temp15;
    public test (String header)
              super(header);
              Container container = getContentPane();
              label1 = new JLabel ("PLease click on your response to ");     
              q1 = new JRadioButton("I understand most of the content of this subject",true);
              add(q1);
              q2 = new JRadioButton("I see the relevance of the subject to my degree",false);
              add(q2);
              q3 = new JRadioButton("The workload in this subject is appropriate",false);
              add(q3);
              radioGroup = new ButtonGroup();               //JRadioButton belong to ButtonGroup
              radioGroup.add(q1);
              radioGroup.add(q2);
              radioGroup.add(q3);
              JPanel buttonPanel = new JPanel();
              JPanel responsePanel = new JPanel();
              JPanel questionPanel = new JPanel();
              JPanel centerPanel = new JPanel();
              b1 = new JButton ("Strongly DISAGREE");          //Instantiate JButton with text
              b1.addActionListener (this);               //Register JButtons to receive events
              b2 = new JButton ("DISAGREE");
              b2.addActionListener (this);
              b3 = new JButton ("Neither AGREE or DISAGREE");
              b3.addActionListener (this);
              b4 = new JButton ("AGREE");
              b4.addActionListener (this);
              b5 = new JButton ("Strongly AGREE");
              b5.addActionListener (this);
              buttonPanel.setLayout(new GridLayout(5,1));
              buttonPanel.add(b1);
              buttonPanel.add(b2);
              buttonPanel.add(b3);
              buttonPanel.add(b4);
              buttonPanel.add(b5);
              t1 = new JTextField ("0",3);               //JTextField contains empty string
              t2 = new JTextField ("0",3);
              t3 = new JTextField ("0",3);
              t4 = new JTextField ("0",3);
              t5 = new JTextField ("0",3);
              t1.setEditable( false );
              t2.setEditable( false );
              t3.setEditable( false );
              t4.setEditable( false );
              t5.setEditable( false );
              responsePanel.setLayout(new GridLayout(5,1));
              responsePanel.add(t1);
              responsePanel.add(t2);
              responsePanel.add(t3);
              responsePanel.add(t4);
              responsePanel.add(t5);
              questionPanel.setLayout(new GridLayout(4,1));
              questionPanel.add(label1);
              questionPanel.add(q1);
              questionPanel.add(q2);
              questionPanel.add(q3);
              centerPanel.add(buttonPanel,BorderLayout.CENTER);
              centerPanel.add(responsePanel,BorderLayout.EAST);
              container.add(centerPanel,BorderLayout.WEST);
              container.add(questionPanel,BorderLayout.NORTH);
              q1.addActionListener(
                   new ActionListener(){
              public void actionPerformed( ActionEvent e )          
    {                                        //actionPerformed of all registered listeners
              if (e.getSource() == b1) {
                   que1[0] = Integer.parseInt(t1.getText()) + 1;
                   String temp1 = String.valueOf(que1[0]);
              t1.setText(temp1);
              else if (e.getSource() == b2)     {
                   que1[1] = Integer.parseInt(t2.getText()) + 1;
                   String temp2 = String.valueOf(que1[1]);
              t2.setText(temp2);
              else if (e.getSource() == b3)     {
                   que1[2] = Integer.parseInt(t3.getText()) + 1;
                   String temp3 = String.valueOf(que1[2]);
              t3.setText(temp3);
              else if (e.getSource() == b4)     {
                   que1[3] = Integer.parseInt(t4.getText()) + 1;
                   String temp4 = String.valueOf(que1[3]);
              t4.setText(temp4);
              else if (e.getSource() == b5)     {
                   que1[4] = Integer.parseInt(t5.getText()) + 1;
                   String temp5 = String.valueOf(que1[4]);
              t5.setText(temp5);
    } //end action performed
              q2.addActionListener(
                   new ActionListener(){
              public void actionPerformed( ActionEvent e )          
    {                                        //actionPerformed of all registered listeners
              if (e.getSource() == b1) {
                   que2[0] = Integer.parseInt(t1.getText()) + 1;
                   String temp6 = String.valueOf(que2[0]);
              t1.setText(temp1);
              else if (e.getSource() == b2)     {
                   que2[1] = Integer.parseInt(t2.getText()) + 1;
                   String temp7 = String.valueOf(que2[1]);
              t2.setText(temp7);
              else if (e.getSource() == b3)     {
                   que2[2] = Integer.parseInt(t3.getText()) + 1;
                   String temp8 = String.valueOf(que2[2]);
              t3.setText(temp8);
              else if (e.getSource() == b4)     {
                   que2[3] = Integer.parseInt(t4.getText()) + 1;
                   String temp9 = String.valueOf(que2[3]);
              t4.setText(temp9);
              else if (e.getSource() == b5)     {
                   que2[4] = Integer.parseInt(t5.getText()) + 1;
                   String temp10 = String.valueOf(que2[4]);
              t5.setText(temp10);
    } //end action performed
              q3.addActionListener(
                   new ActionListener(){
              public void actionPerformed( ActionEvent e )          
    {                                        //actionPerformed of all registered listeners
              if (e.getSource() == b1) {
                   que3[0] = Integer.parseInt(t1.getText()) + 1;
                   String temp11 = String.valueOf(que3[0]);
              t1.setText(temp11);
              else if (e.getSource() == b2)     {
                   que3[1] = Integer.parseInt(t2.getText()) + 1;
                   String temp12 = String.valueOf(que3[1]);
              t2.setText(temp12);
              else if (e.getSource() == b3)     {
                   que3[2] = Integer.parseInt(t3.getText()) + 1;
                   String temp13 = String.valueOf(que3[2]);
              t3.setText(temp13);
              else if (e.getSource() == b4)     {
                   que3[3] = Integer.parseInt(t4.getText()) + 1;
                   String temp14 = String.valueOf(que3[3]);
              t4.setText(temp14);
              else if (e.getSource() == b5)     {
                   que3[4] = Integer.parseInt(t5.getText()) + 1;
                   String temp15 = String.valueOf(que3[4]);
              t5.setText(temp15);
    } //end action performed
    }//end constructor test
    public void itemStateChanged(ItemEvent item) {
    //int state = item.getStateChange();
    //if (q1 == item.SELECTED)
              public class ButtonPanel extends JPanel
                   public ButtonPanel()
              public class CenterPanel extends JPanel
                   public CenterPanel()
              public class QuestionPanel extends JPanel
                   public QuestionPanel()
              public class ResponsePanel extends JPanel
                   public ResponsePanel()
    public static void main(String [] args)
         test surveyFrame = new test("Student Survey") ;
         surveyFrame.setSize( 500,300 );
         surveyFrame.setVisible(true);
         surveyFrame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
         }//end main
    }//end class test

    is not abstract and does not override abstract method actionPerformed
    Oh, I see that the title of your post is an error message? Ok. Well, the test class is declared as implementing an ActionListener. That means the test class must have an actionPerformed() method. Your test class apparently does not.
    It does not appear that the test class needs to implement ActionListener. You are using annonymous classes as listeners.

  • Is not abstract and does not override abstract method ERROR

    Hello. I'm new at all this, and am attempting to recreate a sample code out of my book (Teach Yourself XML in 24 Hours), and I keep getting an error. I appriciate any help.
    This is the Error that I get:
    DocumentPrinter is not abstract and does not override abstract method skippedEntity(java.lang.String) in org.xml.sax.ContentHandler
    public class DocumentPrinter implements  ContentHandler, ErrorHandler
            ^This is the sourcecode:
    import org.xml.sax.Attributes;
    import org.xml.sax.ContentHandler;
    import org.xml.sax.ErrorHandler;
    import org.xml.sax.Locator;
    import org.xml.sax.SAXParseException;
    import org.xml.sax.XMLReader;
    public class DocumentPrinter implements  ContentHandler, ErrorHandler
    // A Constant containing the name of the SAX parser to use.
    private static final String PARSER_NAME = "org.apache.xerces.parsers.SAXParser";
    public static void main(String[] args)
       // Check to see whether the user supplied any command line arguments.  If not, print an error and exit.
       if (args.length == 0)
         System.out.println("No XML document path specified.");
         System.exit(1);
       // Create a new instance of the DocumentPrinter class.
       DocumentPrinter dp = new DocumentPrinter();
       try
         // Create a new instance of the XML Parser.
         XMLReader parser = (XMLReader)Class.forName(PARSER_NAME).newInstance();
         // Set the parser's content handler
        // parser.setContentHandler(dp);
         // Set the parsers error handler
         parser.setErrorHandler(dp);
         // Parse the file named in the argument
         parser.parse(args[0]);
       catch (Exception ex)
         System.out.println(ex.getMessage());
         ex.printStackTrace();
    public void characters(char[] ch, int start, int length)
       String chars ="";
       for (int i = start; i < start + length; i++)
         chars = chars + ch;
    System.out.println("Recieved characters: " + chars);
    public void startDocument()
    System.out.println("Start Document.");
    public void endDocument()
    System.out.println("End of Document.");
    public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
    System.out.println("Start element: " + localName);
    for (int i = 0; i < atts.getLength(); i++)
    System.out.println(" Attribute: " + atts.getLocalName(i));
    System.out.println(" Value: " + atts.getValue(i));
    public void endElement(String namespaceURI, String localName, String qName)
    System.out.println("End of element: " + localName);
    public void startPrefixMapping(String prefix, String uri)
    System.out.println("Prefix mapping: " + prefix);
    System.out.println("URI: " + uri);
    public void endPrefixMapping(String prefix)
    System.out.println("End of prefix mapping: " + prefix);
    public void ignorableWhitespace(char[] ch, int start, int length)
    System.out.println("Recieved whitespace.");
    public void processingInstruction(String target, String data)
    System.out.println("Recieved processing instruction:");
    System.out.println("Target: " + target);
    System.out.println("Data: " + data);
    public void setDocumentLocation(Locator locator)
    // Nada
    public void error(SAXParseException exception)
    System.out.println("Parsing error on line " + exception.getLineNumber());
    public void fatalError(SAXParseException exception)
    System.out.println("Fatal parsing error on line " + exception.getLineNumber());
    public void warning(SAXParseException exception)
    System.out.println("Warning on line " + exception.getLineNumber());

    Check to make sure that the arguments are consistent with your ContentHandler class. Probably the wrong type.
    I think you forgot to include the skippedEntity method, it seems to be missing. Even if an implemented class has a method that you are not using, you still have to include the method in your code even if it doesn't do anything.
    Message was edited by:
    ChargersTule1

  • ...is not abstract and does not override abstract method compare

    Why am I getting the above compile error when I am very clearly overriding abstract method compare (ditto abstract method compareTo)? Here is my code -- which was presented 1.5 code and I'm trying to retrofit to 1.4 -- followed by the complete compile time error. Thanks in advance for your help (even though I'm sure this is an easy question for you experts):
    import java.util.*;
       This program sorts a set of item by comparing
       their descriptions.
    public class TreeSetTest
       public static void main(String[] args)
          SortedSet parts = new TreeSet();
          parts.add(new Item("Toaster", 1234));
          parts.add(new Item("Widget", 4562));
          parts.add(new Item("Modem", 9912));
          System.out.println(parts);
          SortedSet sortByDescription = new TreeSet(new
             Comparator()
                public int compare(Item a, Item b)   // LINE CAUSING THE ERROR
                   String descrA = a.getDescription();
                   String descrB = b.getDescription();
                   return descrA.compareTo(descrB);
          sortByDescription.addAll(parts);
          System.out.println(sortByDescription);
       An item with a description and a part number.
    class Item implements Comparable     
          Constructs an item.
          @param aDescription the item's description
          @param aPartNumber the item's part number
       public Item(String aDescription, int aPartNumber)
          description = aDescription;
          partNumber = aPartNumber;
          Gets the description of this item.
          @return the description
       public String getDescription()
          return description;
       public String toString()
          return "[descripion=" + description
             + ", partNumber=" + partNumber + "]";
       public boolean equals(Object otherObject)
          if (this == otherObject) return true;
          if (otherObject == null) return false;
          if (getClass() != otherObject.getClass()) return false;
          Item other = (Item) otherObject;
          return description.equals(other.description)
             && partNumber == other.partNumber;
       public int hashCode()
          return 13 * description.hashCode() + 17 * partNumber;
       public int compareTo(Item other)   // OTHER LINE CAUSING THE ERROR
          return partNumber - other.partNumber;
       private String description;
       private int partNumber;
    }Compiler error:
    TreeSetTest.java:25: <anonymous TreeSetTest$1> is not abstract and does not over
    ride abstract method compare(java.lang.Object,java.lang.Object) in java.util.Com
    parator
                public int compare(Item a, Item b)
                           ^
    TreeSetTest.java:41: Item is not abstract and does not override abstract method
    compareTo(java.lang.Object) in java.lang.Comparable
    class Item implements Comparable
    ^
    2 errors

    According to the book I'm reading, if you merely take
    out the generic from the code, it should compile and
    run in v1.4 (assuming, of course, that the class
    exists in 1.4). I don't know what book you are reading but that's certainly incorrect or incomplete at least. I've manually retrofitted code to 1.4, and you'll be inserting casts as well as replacing type references with Object (or the erased type, to be more precise).
    These interfaces do exist in 1.4, and
    without the generics.Exactly. Which means compareTo takes an Object, and you should change your overriding method accordingly.
    But this raises a new question: how does my 1.4
    compiler know anything about generics? It doesn't and it can't. As the compiler is telling you, those interfaces expect Object. Think about it, you want to implement one interface which declares a method argument type of Object, in several classes, each with a different type. Obviously all of those are not valid overrides.

  • Product is not abstract and does not override abstract method

    Received the following errors.
    Product.java:3: Product is not abstract and does not override abstract method ge
    tDisplayText() in Displayable
    public class Product implements Displayable
    ^
    Product.java:16: getDisplayText() in Product cannot implement getDisplayText() i
    n Displayable; attempting to use incompatible return type
    found : void
    required: java.lang.String
    public void getDisplayText()
    ^
    2 errors
    Code reads as follows
    import java.text.NumberFormat;
    public class Product implements Displayable
         private String code;
         private String description;
         private double price;
         public Product()
              this.code = "";
              this.description = "";
              this.price = 0;
    public void getDisplayText()
    String message =
    "Code: " + code + "\n" +
    "Description: " + description + "\n" +
    "Price: " + this.getFormattedPrice() + "\n";
         public Product(String code, String description, double price)
              this.code = code;
              this.description = description;
              this.price = price;
         public void setCode(String code)
              this.code = code;
         public String getCode(){
              return code;
         public void setDescription(String description)
              this.description = description;
         public String getDescription()
              return description;
         public void setPrice(double price)
              this.price = price;
         public double getPrice()
              return price;
         public String getFormattedPrice()
              NumberFormat currency = NumberFormat.getCurrencyInstance();
              return currency.format(price);
    Please help!

    Received the following errors.
    Product.java:3: Product is not abstract and does not
    override abstract method ge
    tDisplayText() in Displayable
    public class Product implements Displayable
    ^
    Product.java:16: getDisplayText() in Product cannot
    implement getDisplayText() i
    n Displayable; attempting to use incompatible return
    type
    found : void
    required: java.lang.String
    public void getDisplayText()
    ^
    2 errors
    Code reads as follows
    Please use the code tags when posting code. There is a code button right above the text box where you enter your post. Click on it and put the code between the code tags.
    These error messages are quite clear in telling what is wrong. You have an Interface called Displayable that specifies a method something like thispublic String getDisplayText() {But in your Product source code, you created thismethodpublic void getDisplayText() {The compiler is complaining because the methods are not the same.
    You also need to return a String in the method probalby like thisreturn message;

  • How to resize the spark datagrid collumns based on the headertext?

    Hi friends,
         I am using spark datagrid for displaying the tablur data in my application, when i setting the dataprovider property of the datagrid, it displays the content exactally what i expeceted.
    but the widht of the collumns are based on the content of the dataprovider, i am not able to see the full collumn name in the datagrid's header. I want to display the full collumn name to the users without setting the collumn width explicitly because the data are dynamically returned from the server. could you pls give me some ideas to acheive this...?
    Thanks in advance.

    Hi Karthikeyan Subramain,
    You can make use of typicalItem proberty to set the column width.
    Here is the link for sample code which uses typicalItem:
    http://butterfliesandbugs.wordpress.com/2011/03/08/its-a-best-practice-to-size-a-spark-dat agrids-columns-with-a-typicalitem/
    Hope this will help you
    Thanks and Best regards,
    Pooja Kuber | [email protected] | www.infocepts.com

Maybe you are looking for

  • Lag on imported canon t2i footage

    I recently imported native 720p canon t2i footgae via a memory card reader to my late 2011 MBP (2.2 i7, 8GB RAM) and the playback is choppy. The stagnant nature shots are smooth, but when riders come on screen it becomes starts to 'stutter' and it ne

  • Can't move diagonally

    Anyone having difficulty in moving diagonally across the iphone 4 screen? Also try a circle movement with your finger and my system just goes up or down or side to side but won't work both at same time. This didn't occur on 3GS.

  • Filtering on a dimension table

    Hi all, I am trying to bring in a field from a dimension table-to be used in my mapping. This is based on a condition.(All attributes belong to the same level in the dimension). I brought in the dimension using the 'dimension' operator and tried to '

  • UCES in SAP Portal configuration

    Hi All,         I am completely new to this UCES(Utility Customer E Service) configuration, i found business package for this one, but i don't how to configure in SAP Portal side, could you please tell me once if you deployed into portal, what is def

  • Can't find "Server Properties" in the Admininstration tab of ASC

    Hey, I'm running OC4J 10g (10.1.3.5) I'm trying to enable remote debugging (for IntelliJ IDEA) on my locally installed OC4J instance. I'm logged in as an Admin user with all privileges, however I cannot seem to find the "Server Properties" in the Adm