C# implementation issue with double buffering

I am using the C# dll library to access the berkeley db, is there any way to pass the buffer, offset, count for the btree cursor move function. I dont want to double buffer to memory every time I conduct a cursor move.

Sir,
The call I am assuming you are using on the double buffered example is the DAQ_DB_TRANSFER. The output or return value on this is an integer array of i16's. I'm not very familiar with Borland C++ Builer 4, but I'm thinking the VCL label is just a control that you are trying to send a value to. I'm not sure why this would give you an violation, other than that array of integers not having an data in there, or you are pointing to the data in an element incorrectly.
Daniel McChane
Application Engineer
National Instruments

Similar Messages

  • Performance issue with using buffering in a APPL0 or APPL1 Table

    Hi,
    Can anyone please tell me whether there's any serious performace issue with using buffering for a Master or Transaction table? I'm asking this because when I run code inspector for my transp table I'm getting information message:
    Message Code 0011 ==> Buffereing is Activated but Delivery Class Is "A" and Message Code 0014 ==> Buffereing is Activated but Data Class Is "APPL1".
    So what's other way round for improving performance.
    Thanks,
    Mahesh M.S.

    Hi,
    have you read the documentation?
    Let me paste it here for you:
    Buffering is switched on for the examined table and it has data type 'APPL0' or 'APPL1'.
    Tables with data type 'APPL0' or 'APPL1' should contain master or transaction data, so these tables should either contain a large amount of data or their content should change frequently. Therefore buffering the table is unfavourable. Very large tables suppress other tables in the buffer memory and hence slow done any access to them. Transaction data should not be buffered because the synchronization of the changes on the various application servers is very time consuming.
    In exceptional cases, small master data tables ('APPL0', size category 0) can be buffered.
    The solution depends on the table content. If it is master or transaction data, the table should not be buffered. If the table content does not consist of master or transaction data, the data type should be corrected accordingly.
    This should answer your questions...
    Kind regards,
    Hermann

  • Sprite animation with double buffering

    Hello, I am writing a game. I am not using swing. Just awt.
    I have several books I am looking at right now. One uses the
    BufferedImage class to create a buffered sprite. The other book instead uses the Image class to impliment double buffering. So, I am really confused now. I do not know if I should use the BufferedImage class or the Image class. Note that
    Please help. Which method is the best to use?
    Val

    These links may assist you in full-screen animation with double-buffering:
    http://www.sys-con.com/java/article.cfm?id=1893
    http://www.meatfighter.com/meat.pdf
    - Mike

  • High CPU usage with double buffering enabled

    Hello all,
    My GUI application is using 100% of the CPU with double buffering (DB) enabled, about 20% with it disabled?
    Also with DB enabled is visible slower than without, although there are some flickers.
    Java 1.7.0_21
    2 NVIDIA Quadro NVS 420
    Windows 7
    Any ideas?

    Try tinkering with the Java2D system flags:
    http://docs.oracle.com/javase/1.5.0/docs/guide/2d/flags.html

  • Problem with Double Buffering and Swing

    Hi
    I made a game and basically it works pretty well, my only problem is it flickers really badly right now. I read up on a whole lot of forums about double buffering and none of those methods seemed to work. Then I noticed that Swing has double buffering built in so I tried that but then I get compilation errors and I'm really not sure why. My original code was a console application and worked perfectly, then I ported it into a JApplet and it still works but it flickers and thats what I'm tryign to fix now.
    The code below is in my main class under the constructor.
    Heres the double buffering code I'm trying to use, I'm sure you all seen it before lol
    public void update(Graphics g)
              // initialize buffer
              if (dbImage == null)
                   dbImage = createImage(this.getSize().width, this.getSize().height);
                   dbg = dbImage.getGraphics();
              // clear screen in background
              dbg.setColor(getBackground());
              dbg.fillRect(0, 0, this.getSize().width, this.getSize().height);
              // draw elements in background
              dbg.setColor(getForeground());
              paint(dbg);
              // draw image on the screen
              g.drawImage(dbImage, 0, 0, this);
         }My paint is right under neath and heres how it looks
    This snipet of code works but when I change the method to
    public paintComponent(Graphics g){
    super.paintComponent(g)...
    everythign stops working and get a compilation error and says that it can't find paintComponent in javax.swing.JFrame.
    public void paint(Graphics g)
              super.paint(g);
              //if game starting display menue
              if (show_menue)
                   //to restart lives if player dies
                   lives = 3;
                   menue.draw_menue(g);
                   menue_ufo1.draw_shape(g);
                   menue_ufo2.shape_color = Color.DARK_GRAY;
                   menue_ufo2.draw_shape(g);
                   menue_ufo3.shape_color = Color.BLUE;
                   menue_ufo3.draw_shape(g);
                   menue_ufo4.shape_color = new Color(82, 157, 22);
                   menue_ufo4.draw_shape(g);
                   menue_ufo5.draw_shape(g);
                   menue_ufo6.shape_color = new Color(130, 3, 3); ;
                   menue_ufo6.draw_shape(g);
                   menue_turret.draw_ship(g);
                   menue_ammo.draw_ammo(g);
              else
                   //otherwise redraw game objects
                   gunner.draw_ship(g);
                   y_ammo.draw_ammo(g);
                   grass.draw_bar(g);
                   o_ufo.draw_shape(g);
                   b_ufo.draw_shape(g);
                   m_ufo.draw_shape(g);
                   s_ufo.draw_shape(g);
                   z_ufo.draw_shape(g);
                   xx_ufo.draw_shape(g);
                   info.draw_bar(g);
                   live_painter.draw_lives(g, lives);
                   score_painter.draw_score(g, score);
                   level_display.draw_level(g, level);
                   explosion.draw_boom(g);
         }I just want to get rid of the flickering for now so any help will be greatly appreciated. Depending which will be simpler I can either try to double buffer this program or port it all to swing but I'm not sure which elements are effected by AWT and which by Swing. Also I read some of the Java documentation but couldn't really understand how to implement it to fix my program.
    Thanks in advance
    Sebastian

    This is a simple animation example quickly thrown together. I have two classes, an animation panel which is a JPanel subclass that overrides paintComponent and draws the animation, and a JApplet subclass that simply holds the animation panel in the applet's contentpane:
    SimpleAnimationPanel.java
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Point;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.imageio.ImageIO;
    import javax.swing.JPanel;
    import javax.swing.Timer;
    class SimpleAnimationPanel extends JPanel
        private static final int DELAY = 20;
        public static final int X_TRANSLATION = 2;
        public static final int Y_TRANSLATION = 2;
        private Point point = new Point(5, 32);
        private BufferedImage duke = null;
        private Timer timer = new Timer(DELAY, new TimerAction());
        public SimpleAnimationPanel()
            try
                // borrow an image from sun.com
                duke = ImageIO.read(new URL(
                        "http://java.sun.com/products/plugin/images/duke.wave.med.gif"));
            catch (MalformedURLException e)
                e.printStackTrace();
            catch (IOException e)
                e.printStackTrace();
            setPreferredSize(new Dimension(600, 400));
            timer.start();
        // do our drawing here in the paintComponent override
        @Override
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            if (duke != null)
                g.drawImage(duke, point.x, point.y, this);
        private class TimerAction implements ActionListener
            @Override
            public void actionPerformed(ActionEvent e)
                int x = point.x;
                int y = point.y;
                Dimension size = SimpleAnimationPanel.this.getSize();
                if (x > size.width)
                    x = 0;
                else
                    x += X_TRANSLATION;
                if (y > size.height)
                    y = 0;
                else
                    y += Y_TRANSLATION;
                point.setLocation(new Point(x, y)); // update the point
                SimpleAnimationPanel.this.repaint();
    }AnimationApplet.java
    import java.lang.reflect.InvocationTargetException;
    import javax.swing.JApplet;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    public class AnimationApplet extends JApplet
        public void init()
            try
                SwingUtilities.invokeAndWait(new Runnable()
                    public void run()
                        // construct the panel
                        JPanel simpleAnimation = new SimpleAnimationPanel();
                        // put it in the contentPane of the JApplet
                        getContentPane().add(simpleAnimation);
                        setSize(simpleAnimation.getPreferredSize());
            catch (InterruptedException e)
                e.printStackTrace();
            catch (InvocationTargetException e)
                e.printStackTrace();
    }Here's a 3rd bonus class that shows how to put the JPanel into a stand-alone program, a JFrame. It's very similar to doing it in the JApplet:
    AnimationFrame.java
    import javax.swing.JFrame;
    public class AnimationFrame
        private static void createAndShowUI()
            JFrame frame = new JFrame("SimpleAnimationPanel");
            frame.getContentPane().add(new SimpleAnimationPanel());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    createAndShowUI();
    }Edited by: Encephalopathic on Mar 15, 2008 11:01 PM

  • Need help with double buffering

    Hi!
    I'm trying to write an animated applet the shows the Java Duke waving.
    No problem getting it to work, but the applet is flickering and I sence the need for double buffering.
    I've tried to use "traditional" double buffering techniques without success. Something like this:
    currentDuke = bufferGraphics.getGraphics();
    public void update(Graphics g) {
        bufferGraphics.clearRect(0, 0, this.getWidth(), this.getHeight());
        paint(g);
    public void paint(Graphics g) {
        bufferGraphics.drawImage(nextDuke, 0, 0, this);
        g.drawImage(currentDuke, 0, 0, this);
    }Didn't help...
    Here's my current code:
    import javax.swing.*;
    import java.awt.*;
    * This is a simple animation applet showing Duke waving.
    * @author Andrew
    * @version 1.0 2002-07-04
    public class WavingDuke extends JApplet implements Runnable {
        private Image[] duke;
        private Image currentDuke;
        private Thread wave;
         * Called by the browser or applet viewer to inform this applet that it has
         * been loaded into the system.
        public void init() {
            loadDuke();
            currentDuke = this.createImage(this.getWidth(), this.getHeight());
         * Called by the browser or applet viewer to inform this applet that it
         * should start its execution.
        public void start() {
            if (wave == null) {
                wave = new Thread(this);
                wave.start();
         * Loads all the duke images into a <code>Image</code> array.
        private void loadDuke() {
            duke = new Image[10];
            for (int i = 0; i < 10; i++) {
                duke[i] = this.getImage(this.getCodeBase(), "images/duke"+i+".gif");
         * Method cycles through different images and calls <code>repaint</code>
         * to make an animation. After each call to <code>repaint</code> the thread
         * sleeps for predefined amount of time.
        public void run() {
            while (true) {
                for (int i = 0; i < 10; i++) {
                    currentDuke = duke;
    repaint();
    paus(150);
    * Method makes the current thread to sleep for tha amount of time
    * specified in parameter <code>ms</code>.
    * @param ms The time to wait specified in milliseconds.
    private void paus(int ms) {
    try {
    Thread.sleep(ms);
    } catch (InterruptedException ie) {
    System.err.println(ie.getMessage());
    * Updates this component.
    * @param g The specified context to use for updating.
    public void update(Graphics g) {
    paint(g);
    * Paints this component.
    * @param g The graphics context to use for painting.
    public void paint(Graphics g) {
    g.clearRect(0, 0, this.getWidth(), this.getHeight());
    g.drawImage(currentDuke, 0, 0, this);
    Thanks in advance!
    /Andrew

    I've solved it!
    /Andrew

  • Issue with double click zoom on Essbase Excel Add-in

    Several of my users have been experiencing a problem recently when the do a double click zoom in or zoom out in Excel Add-in 7.1.3. It will start clocking (icon flashes as well as the cells while the clocking is occuring) and the only way to break out of it is to hit escape. Sometimes the clocking will only last a minute but, depending on the number of members that you can drill down into, can last several minutes at which point the users end up just escaping out. This doesn't happen with all templates or with all users. Zooming in and zooming out using the menu works fine. This only occurs with double click zooming (which to the users is much quicker and they prefer not using the menu).
    This is Excel Add-in 7.1.3 on Office 2007 which I realize is not certified compatible but we have not had this issue until the last few weeks.
    Anyone else having this issue? Ideas?

    sometimes you dont find any excel sheets open but there will be a process allocated to it and running ..you can see this in the task manager..
    so go to task manager and try deleting all the process related to excel.
    Now after deleting all the processes you find NO excel sheets open..
    Try viewing the required excel sheet now..
    hope it works now..

  • Drawing with double buffering to a JFrame

    I want to create a simple JFrame and draw stuff to it via Graphic object using double buffering.
    If I create a loop and draw constantly using JFrame.getGraphic().xxx, am i doing double buffering. ( 'cause i read somewhere that swing components automaticly use double buffering ). And is this the righ approuch ( or whatever it's spelled ) ?

    I want to create a simple JFrame and draw stuff to it
    Don't do that.
    If you want to do custom rendering then use JPanel or JComponent, not JFrame.
    If I create a loop and draw constantly using JFrame.getGraphic().xxx, am i doing double buffering.
    No.
    You're also painting outside the standard paint cycle, which is a Bad Idea.
    So, essentially, everything your suggesting is the wrong way to go about things.
    In its most simple form, double buffering works something like this, though there are a whole load of subtleties to consider (such as component resizing for a start)
    public class Foo extends JComponent
        private BufferedImage image = null;
        protected void paintComponent(Graphics g)
            if (image != null)
                image = createImage(getWidth(), getHeight());
                paintBuffer(ig);
            g.drawImage(image, 0, 0, this);
        private void paintBuffer()
            Graphics ig = image.getGraphics();
            // do the rendering
            ig.dispose();
    }

  • ALV: Issue with double  click event after sorting the ALV

    Hello Experts,
    I have an internal table that populates an ALV grid. When the user doubleclicks a row, my method HANDLE_DOUBLE_CLICK returns the e_row-index value from the ALV Grid. I use this index value to read the internal table, then retrieve additional data.
    My problem is the user may sort the ALV grid before double clicking on a line. If this happens my internal table is not sorted to match the ALV grid, so reading the internal table with the e_row-index value returns the wrong information.
    When the double click event occurs, is it possible to capture the value in column 1 instead of a value for e_row-index?
    There is one more paramter in HANDLE_DOUBLE_CLICK for row id.   It is coming blank in debugging .  what is the purpose of this parameter and how i can make use of it ?
    Regards
    Vivek

    Hi,
    I am Posting The Code Which Uses Double Click Event.
    And This Code will provide the total information to you.
    REPORT  ZALVGRID_PG.
    TABLES: SSCRFIELDS.
    DATA: V_BELNR TYPE RBKP-BELNR.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: IRNO FOR V_BELNR.
    PARAMETERS: P_GJAHR TYPE RBKP-GJAHR.
    SELECTION-SCREEN END OF BLOCK B1.
    DATA: WA TYPE ZALVGRID_DISPLAY,
          ITAB TYPE STANDARD TABLE OF ZALVGRID_DISPLAY.
    DATA: IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: L_IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: L_TREE TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.
    TYPE-POOLS: SLIS,SDYDO.
    DATA: L_LOGO TYPE SDYDO_VALUE,
          L_LIST TYPE SLIS_T_LISTHEADER.
    END-OF-SELECTION.
    CLASS CL_LC DEFINITION.
      PUBLIC SECTION.
        METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN.
    ENDCLASS.
    CLASS CL_LC IMPLEMENTATION.
      METHOD DC.
        DATA: WA1 TYPE ZALVGRID_DISPLAY.
        READ TABLE ITAB INTO WA1 INDEX E_ROW-INDEX.
        BREAK-POINT.
        SET PARAMETER ID 'BLN' FIELD WA1-BELNR.
        CALL TRANSACTION 'FB02'.
      ENDMETHOD.                    "DC
    ENDCLASS.
    DATA: OBJ_CL TYPE REF TO CL_LC.
    START-OF-SELECTION.
      PERFORM SELECT_DATA.
      IF SY-SUBRC = 0.
        CALL SCREEN 100.
      ELSE.
        MESSAGE E000(0) WITH 'DATA NOT FOUND'.
      ENDIF.
      INCLUDE ZALVGRID_PG_STATUS_0100O01.
      INCLUDE ZALVGRID_PG_LOGOSUBF01.
      INCLUDE ZALVGRID_PG_SELECT_DATAF01.
    INCLUDE ZALVGRID_PG_USER_COMMAND_01I01.
    ***INCLUDE ZALVGRID_PG_STATUS_0100O01 .
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'AB'.
    *  SET TITLEBAR 'xxx'.
      IF IDENTITY IS INITIAL.
        CREATE OBJECT IDENTITY
        EXPORTING
          CONTAINER_NAME = 'ALVCONTROL'.
        CREATE OBJECT GRID
        EXPORTING
          I_PARENT = IDENTITY.
        CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
             I_STRUCTURE_NAME              = 'ZALVGRID_DISPLAY'
          CHANGING
            IT_OUTTAB                     = ITAB.
        CREATE OBJECT OBJ_CL.
        SET HANDLER OBJ_CL->DC FOR GRID.
        ENDIF.
        IF L_IDENTITY IS INITIAL.
          CREATE OBJECT L_IDENTITY
          EXPORTING
            CONTAINER_NAME = 'LOGO'.
          CREATE OBJECT L_TREE
          EXPORTING
            I_PARENT = L_IDENTITY.
          PERFORM LOGOSUB USING L_LOGO.
          CALL METHOD L_TREE->CREATE_REPORT_HEADER
            EXPORTING
              IT_LIST_COMMENTARY    = L_LIST
              I_LOGO                = L_LOGO.
          ENDIF    .
    ENDMODULE.                 " STATUS_0100  OUTPUT
    ***INCLUDE ZALVGRID_PG_LOGOSUBF01 .
    FORM LOGOSUB  USING    P_L_LOGO.
      P_L_LOGO = 'ERPLOGO'.
    ENDFORM.                    " LOGOSUB
    ***INCLUDE ZALVGRID_PG_SELECT_DATAF01 .
    FORM SELECT_DATA .
      SELECT RBKP~BELNR
             RBKP~BLDAT
             RSEG~BUZEI
             RSEG~MATNR
             INTO TABLE ITAB
             FROM RBKP INNER JOIN RSEG
        ON RBKP~BELNR = RSEG~BELNR
        WHERE RBKP~BELNR IN IRNO
        AND RBKP~GJAHR = P_GJAHR.
    ENDFORM.                    " SELECT_DATA
    ***INCLUDE ZALVGRID_PG_USER_COMMAND_01I01 .
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
           EXIT.
           ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Warm Regards,
    PavanKumar.G
    Edited by: pavankumar.g on Jan 19, 2012 5:30 AM

  • Crystal XI R2 exporting issues with double-byte character sets

    NOTE: I have also posted this in the Business Objects General section with no resolution, so I figured I would try this forum as well.
    We are using Crystal Reports XI Release 2 (version 11.5.0.313).
    We have an application that can be run using multiple cultures/languages, chosen at login time. We have discovered an issue when exporting a Crystal report from our application while using a double-byte character set (Korean, Japanese).
    The original text when viewed through our application in the Crystal preview window looks correct:
    性能 著概要
    When exported to Microsoft Word, it also looks correct. However, when we export to PDF or even RPT, the characters are not being converted. The double-byte characters are rendered as boxes instead. It seems that the PDF and RPT exports are somehow not making use of the linked fonts Windows provides for double-byte character sets. This same behavior is exhibited when exporting a PDF from the Crystal report designer environment. We are using Tahoma, a TrueType font, in our report.
    I did discover some new behavior that may or may not have any bearing on this issue. When a text field containing double-byte characters is just sitting on the report in the report designer, the box characters are displayed where the Korean characters should be. However, when I double click on the text field to edit the text, the Korean characters suddenly appear, replacing the boxes. And when I exit edit mode of the text field, the boxes are back. And they remain this way when exported, whether from inside the design environment or outside it.
    Has anyone seen this behavior? Is SAP/Business Objects/Crystal aware of this? Is there a fix available? Any insights would be welcomed.
    Thanks,
    Jeff

    Hi Jef
    I searched on the forums and got the following information:
    1) If font linking is enabled on your device, you can examine the registry by enumerating the subkeys of the registry key at HKEY_LOCAL_MACHINEu2013\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink to determine the mappings of linked fonts to base fonts. You can add links by using Regedit to create additional subkeys. Once you have located the registry key that has just been mentioned, from the Edit menu, Highlight the font face name of the font you want to link to and then from the Edit menu, click Modify. On a new line in the dialog field "Value data" of the Edit Multi-String dialog box, enter "path and file to link to," "face name of the font to link".u201D
    2) "Fonts in general, especially TrueType and OpenType, are u201CUnicodeu201D.
    Since you are using a 'true type' font, it may be an Unicode type already.However,if Bud's suggestion works then nothing better than that.
    Also, could you please check the output from crystal designer with different version of pdf than the current one?
    Meanwhile, I will look out for any additional/suitable information on this issue.

  • Issue with double quotes in APEX 3.1

    Hi,
    Recently we have upgraded our APEX environment (both production and development) from HTMLDB 2.0 to APEX 3.1.
    Users reported that when they cut/paste data from word document into forms, double and single quotes in the data are displaying as weird symbols like "¿".
    Surprisingly we have this issue in our production environment only not in development environment. I am guessing there must be setting which is causing this issue.
    Please help me to resolve the issue and let me know if you want more details.
    Thanks,
    Lakshmi

    It's most likely this is caused by non-standard Microsoft character encoding in combination with default "auto correct" behaviour in their products that users may not even be aware is operating. "Smart Quotes" are the culprit in this case.
    As it is highly unlikely that your users will be able to stop using these products, the best options are: turn off the offending features in MS software; educate users about the source of the problem and get them to replace the errant characters with the relevant ASCII or Unicode character or "decimal numeric character reference" when transferring to DB/web (worthwhile bearing some context in mind here: ASCII apostrophes and quotes are probably best for values stored in traditional database columns as they may be used in a number of different applications); try to write some kind of translator in your database/application that fixes the incorrect characters.
    That this is occurring in one environment but not the other may indicate that there's a character set difference somewhere in the stack, but the human element may be coming into play as well: developers encounter this problem frequently and often turn off "smart quotes" as a result!

  • Issues with Double, calc not accepted

    I found a site with some example problems I'm working through. I'm following what I think I understand is right, but I get errors that the calculation with type Double isn't accepted. What am I missing?
    import java.io.*;
    class Change
      public static void main (String [] args) throws IOException
        String charData;
        Double change;
        Double value;
        //read in change amount
        BufferedReader stdin = new BufferedReader
          (new InputStreamReader (System.in));
        System.out.println ("Enter amount in cents");
        charData = stdin.readLine();
        change = Double.parseDouble (charData);
        //calculate change due
        //dollars
        value = change / 100;
        System.out.println ("There are " + value + " dollars");
        change = change % 100;
        //quarters
        value = change / 25;
        System.out.println ("There are " + value + " quarters");
        change = change % 25;
        //dimes
        value = change / 10;
        System.out.println ("There are " + value + " dimes");
        change = change % 10;
        //nickles
        value = change / 5;
        System.out.println ("There are " + value + " nickles");
        change = change % 5;
        //pennies
        System.out.println ("There are " + change + " pennies");
        //end
        System.out.println ("End");
    }and my errors...
    C:\JP>javac Change.java
    Change.java:19: incompatible types
    found : double
    required: java.lang.Double
    change = Double.parseDouble (charData);
    ^
    Change.java:24: operator / cannot be applied to java.lang.Double,double
    value = change / 100.0;
    ^
    Change.java:26: operator % cannot be applied to java.lang.Double,double
    change = change % 100.0;
    ^
    Change.java:29: operator / cannot be applied to java.lang.Double,double
    value = change / 25.0;
    ^
    Change.java:31: operator % cannot be applied to java.lang.Double,double
    change = change % 25.0;
    ^
    Change.java:34: operator / cannot be applied to java.lang.Double,int
    value = change / 10;
    ^
    Change.java:36: operator % cannot be applied to java.lang.Double,int
    change = change % 10;
    ^
    Change.java:39: operator / cannot be applied to java.lang.Double,int
    value = change / 5;
    ^
    Change.java:41: operator % cannot be applied to java.lang.Double,int
    change = change % 5;
    ^
    9 errors
    Thanks in advance for any help.

    I just realized I included errors that included trying to force the 100 and 25 to Double by making them 100.0 etc. It basically yielded the same results though. sigh

  • Issue with Double.parseDouble

    ok i dono whats going on here im writing a console based bank management program and when converting a input srting from console.readline to Double.parseDouble it says the method parseDouble cannot be found, im using the latest jvm whats going on! help!

    my bad i ment latest jdk not thinking tonight! heres the error:
    D:\My Documents\Java\Bank Acount\AccountDriver.java:59: Method parseDouble(java.lang.String) not found in class java.lang.Double.
                             newAcc = Double.parseDouble (input);
                             ^
    1 error

  • Force repaint with Double-buffering

    i've been using the "classic" DB class you can find everywhere on the net (just extend a component - JPanel in my case - keep an image and draw the image to component on repaint ) the class works well however when the code execution is intense the repaint manager doesnt have time to draw the image to the screen- i've tried playing to the repaintManger but in fact it seems like i can control very little of it. Is there a way to force repainting to screen? thanks

    If "the code execution is intense", then the code should be running in a separate thread so that it doesn't block up the painting.

  • Panel refreshing and double buffering

    Hi all swing experts
    Could any one solve the problem.I have an application,which is having a JSplit pane.
    On the left of the JSplit pane , there is a tree. When u click a node from the tree
    that will be selected and you can place that node into the right side panel.
    And the same way you can click an another node (redirection or sink) and drop into the
    panel.you can draw a line by clicking the source and the sink / or redirection.
    The line is getting drawn dynamically by getting the x,y coordinates of the node.
    once the line is drawn am storing the line into vector, since this is getting drawn
    dynamically once if i minimize and maxmize it will disappear.
    For avoiding this am trying to redraw the old line from the vector when the window
    is getting activated, here the problem starts it draws the line but the line
    is getting disappeared immly.
    HOW DO I SOLVE THIS?
    is it possible to solve this problem with double buffering tech? if so how?
    PL HELP.
    Software - Visual Tool
    Last Modified -7/23/01
    sami
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.TitledBorder;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.plaf.FontUIResource;
    import javax.swing.tree.*;
    import java.lang.System;
    import java.net.*;
    import java.awt.image.*;
    import javax.swing.event.*;
    public class CompTree extends JFrame implements TreeSelectionListener,WindowListener{      
    // Swing components declarations     
         public JSplitPane jSplitPane1,jSplitPaneTop;
         public JScrollPane treeScrollPane,splitScrollPane;     
    public JTree mainTree,jtree ;
    public static DefaultMutableTreeNode topchildnode1, topchildnode2, topchildnode3,toptreenode;
    DrawPanel dp = new DrawPanel();
         public int i=0;
         public int j=0;
         public int flag = 1 ;
         public String var,S,R,D;
    Frame fr = new Frame("GUI TOOL");
    public CompTree()
         File nFile = null ;     
         mainTree = DrawTree(nFile,"N") ;
         mainTree.updateUI();
         mainTree.setBackground(new Color(105,205,159));     
              // Tree is getting added into scroll pane
         treeScrollPane = new JScrollPane(mainTree);
              treeScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    treeScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
              splitScrollPane = new JScrollPane();
              splitScrollPane.setViewportView(dp.panel1);          
              splitScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    splitScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    jSplitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,treeScrollPane,splitScrollPane);          
         jSplitPane1.setOneTouchExpandable(true);
         jSplitPane1.setContinuousLayout(true);
    jSplitPane1.addComponentListener(new ComponentAdapter(){
              public void componentResized(ComponentEvent e) {      
                   System.out.println("Componenet resized");
              flag = 1;
              paint(dp.panel1.getGraphics());          
    //Provide minimum sizes for the two components in the split pane
    Dimension minimumSize = new Dimension(150,75);
              splitScrollPane.setMinimumSize(minimumSize);
    //Provide a preferred size for the split pane
    jSplitPane1.setPreferredSize(new Dimension(700, 500));
              //setContentPane(jSplitPane1);
              fr.add(jSplitPane1);
              fr.setSize(700,500);
              fr.setVisible(true);          
              fr.addWindowListener(this);     
    public void windowActivated(WindowEvent we){
         System.out.println("activated");
         dp.draw();
    public void windowClosed(WindowEvent we){System.out.println("closed");}
    public void windowIconified(WindowEvent we){System.out.println("iconified");}
    public void windowDeiconified(WindowEvent we){
         dp.draw();
         System.out.println("deiconified");
    public void windowDeactivated(WindowEvent we){System.out.println("deactivated");}
    public void windowOpened(WindowEvent we){
         dp.repaint();
         System.out.println("opened");
    public void windowClosing(WindowEvent we){
         System.exit(0);
         System.out.println("closing");
         public void valueChanged(TreeSelectionEvent e) {
              DefaultMutableTreeNode node = (DefaultMutableTreeNode)
              mainTree.getLastSelectedPathComponent();     
              String strRootNode = "" ;
              try{
                   Object rootNode = node.getRoot();          
                   strRootNode = rootNode.toString() ;
              catch(Exception eRoot)
                   System.out.println("Error in geting Root Node");
              if (node == null) return;
              Object nodeInfo = node.getUserObject();          
              TreeNode ParentNode = node.getParent();               
              final String strParentName = node.toString() ;
                   if (strParentName.equals("Source"))
              System.out.println("Before source");     
              var = "S";
              System.out.println("This is source");
              else if (strParentName.equals("Redirection"))
    var ="R";
              else if (strParentName.equals("Sink") )
                   var ="D";
              else
                   if ( strRootNode != strParentName){
         public JTree DrawTree( File file, String strIsValid)
                   jtree = new JTree();
                   toptreenode = new DefaultMutableTreeNode("Start");
                   topchildnode1 = new DefaultMutableTreeNode("Source");
                   topchildnode2 = new DefaultMutableTreeNode("Sink");
                   topchildnode3 = new DefaultMutableTreeNode("Redirection");
                   toptreenode.add(topchildnode1);
                   toptreenode.add(topchildnode2);
                   toptreenode.add(topchildnode3);
                   jtree.putClientProperty("JTree.lineStyle", "Angled");
                   DefaultTreeModel defaulttreemodel = new DefaultTreeModel(toptreenode);
                   jtree.setModel(defaulttreemodel);
                   DefaultTreeSelectionModel defaulttreeselectionmodel = new DefaultTreeSelectionModel();
                   defaulttreeselectionmodel.setSelectionMode(1);
                   jtree.setSelectionModel(defaulttreeselectionmodel);
                   jtree.addTreeSelectionListener(this);
                   jtree.setEditable(true);
                   return jtree;      
    public static void main(String args[]){
         CompTree ct = new CompTree();
         * This class contains all the component related to panel 1
         * this can be used for .....
    public class DrawPanel extends JPanel implements ActionListener,
         ComponentListener,MouseListener,KeyListener{
         public JRadioButton uniRadio,multiRadio,show;
         public JButton sBut,rBut,dBut;
         public int flag = 1 ;
         public int Radio = 1;
         public boolean sIndicator = true;
         public boolean rIndicator = true;
         public boolean isDestSelected = false;
         public boolean isDestFirstTime = true;
    public int x1 = 0 ;
         public int y1 = 0 ;
         public int x2 = 0 ;
         public int y2 = 0;
         public int x3 = 0;
         public int y3 = 0;
         public int k=0;
         public int l = 40;
    public int b = 40;     
         public String connection1,connection2,connection3,destination1,destination2;
         public int locX;
         public int locY;
    public JPanel panel1 = new JPanel ();      
    public JPanel panel2 = new JPanel ();     
         Vector lines = new Vector();
         Vector colors = new Vector();
         Vector obj = new Vector();
    Vector source = new Vector();
         Vector loc = new Vector();
         BasicStroke stroke = new BasicStroke(2.0f);
    Icon compImage = new ImageIcon("network1.gif"); //new
    Icon workImage = new ImageIcon("tconnect02.gif");
    Icon lapImage = new ImageIcon("server02.gif");
         public DrawPanel(){
         am adding radio button for checking the mode unicast and broad cast mode -- new
    uniRadio = new JRadioButton("Unicast Mode");
    uniRadio.setMnemonic(KeyEvent.VK_B);
    uniRadio.setSelected(true);
    multiRadio = new JRadioButton("Broadcast Mode");
    multiRadio.setMnemonic(KeyEvent.VK_C);
    show = new JRadioButton("show Panel");
    show.setMnemonic(KeyEvent.VK_C);
         ButtonGroup group = new ButtonGroup();
    group.add(uniRadio);
    group.add(multiRadio);
              group.add(show);
         /*     Border border = ButtonGroup.getBorder();
              Border margin = new EmptyBorder(10,10,10,10);
              ButtonGroup.setBorder(new CompoundBorder(border,margin)); */
              uniRadio.addActionListener(this);
         multiRadio.addActionListener(this);
              show.addActionListener(this);
    panel1.add(uniRadio);
              panel1.add(multiRadio);
              panel1.add(show);
              uniRadio.setBounds(150,15,100,40);
              multiRadio.setBounds(260,15,120,40);
              show.setBounds(390,15,100,40);
              uniRadio.setBackground(new Color(105,200,205));
              multiRadio.setBackground(new Color(105,200,205));
              show.setBackground(new Color(105,200,205));
              /*****************PANEL 1*********************/
              panel1.setLayout(null);
    panel1.setBounds(new Rectangle(0,0,400,400));
              panel1.setBackground(new Color(105,100,205));
              panel1.addComponentListener(this);
              panel1.addMouseListener(this);      
         public void sourceObject(String name)
    sBut = new JButton(compImage);
         panel1.add(sBut);     
         sBut.setMnemonic(KeyEvent.VK_F);
         sBut.setBounds(new Rectangle(locX,locY,l,b));     
         sBut.addActionListener(this);
         sBut.addMouseListener(this);
         sBut.addKeyListener(this);
    System.out.println("am inside the source object") ;
         sBut.setBackground(new Color(105,100,205));
         System.out.println("key number" +sBut.getMnemonic());
         System.out.println("MY LOCATION : SBUT : "+ sBut.getLocation());
         public void redirectionObject(String name)
         rBut = new JButton(workImage);
         panel1.add(rBut);
         rBut.setBounds(new Rectangle(locX,locY,l,b));     
    rBut.addActionListener(this);
         rBut.addMouseListener(this);
         rBut.addKeyListener(this);
         rBut.setBackground(new Color(105,100,205));
    System.out.println("am inside the redirection :" + j) ;
    System.out.println("MY LOCATION : RBUT : "+ rBut.getLocation());          
    public void destinationObject(String name){     
         dBut = new JButton(lapImage);
         panel1.add(dBut);     
         dBut.setBackground(new Color(105,100,205));
    System.out.println("am inside the destination object") ;     
    dBut.setBounds(new Rectangle(locX,locY,l,b));                    
         System.out.println("am inside the destination:" + j) ;
         dBut.addActionListener(this);
         dBut.addMouseListener(this);
         dBut.addKeyListener(this);
         System.out.println("MY LOCATION : DBUT : "+ dBut.getLocation());           
    public void paintComponent(Graphics g){
    super.paintComponent(g);
         System.out.println("inside paint");
         Graphics2D g2 = (Graphics2D) g;
    g2.setStroke(stroke);
    if(flag == 1){
         /* this is for drawing current line, this will be drawn when component event happens */
              g.setColor(getForeground());
    System.out.println("inside flag");
    int np = lines.size();
                        System.out.println("Total number of lines present the buffer to draw :" + np);
                             for (int I=0; I < np; I++) {                       
         Rectangle p = (Rectangle)lines.elementAt(I);
                        g2.setColor((Color)colors.elementAt(I));
                             System.out.println("width" + p.width);
                             g2.setColor(Color.red);
                        //     g2.setPaint(p.x,p.y,p.width,p.height);
                             g2.drawLine(p.x,p.y,p.width,p.height);                         
                             System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
                             System.out.println(obj.elementAt(I));
                             System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
                             System.out.println(p.x +"," +","+ p.y + ","+ ","+ p.width+ "," + ","+ p.height);
    flag = -1;
    }else if(flag == -1){
         if(x1 != 0 && y1 != 0 && x2 != 0 && y2 != 0 ){
    connection1 = "source to redirection";
    g2.setColor(Color.red);
         g2.drawLine(x1,y1,x2,y2);          
         lines.addElement(new Rectangle(x1,y1,x2,y2));
         colors.addElement(getForeground());
         obj.addElement(connection1);
         x1 = 0 ;y1 = 0 ;
         x2 = 0 ;y2 = 0 ;
    else if (x2 != 0 && y2 != 0 && x3 != 0 && y3 != 0 )
              connection2 = "Redirection to Destination";
              g2.setColor(Color.green);
                   g2.drawLine(x2,y2,x3,y3);                    
    colors.addElement(getForeground());
                   lines.addElement(new Rectangle(x2,y2,x3,y3));               
                   obj.addElement(connection2);
                   x2 = 0; y2 = 0 ;
                   x3 = 0 ; y3 = 0 ;                    
    else if (x1 != 0 && y1 != 0 && x3 != 0 && y3 != 0)
                   connection3 = "Source to Destination";
                   g2.setColor(Color.red);
                   g2.drawLine(x1,y1,x3,y3);                    
    colors.addElement(getForeground());
                   lines.addElement(new Rectangle(x1,y1,x3,y3));                              
                   obj.addElement(connection3);
                        x1 = 0; y1 = 0 ;
                        x3 = 0 ; y3 = 0 ;                    
                        /*     Image offscreen = panel1.createImage(400,400);
              Graphics og = offscreen.getGraphics();
         og.drawLine(200,200,500,500);
              g.drawImage(offscreen,0,0,null); */
    // Component Listener's method
    public void componentHidden(ComponentEvent e) { 
    if(e.getSource().equals(panel1)){System.out.println("Componenet Hidden");}
              System.out.println("Componenet Hidden");
    public void componentMoved(ComponentEvent e) {
              System.out.println("Componenet moved");
              draw();
    public void componentResized(ComponentEvent e) {      
              System.out.println("Componenet resized");
              flag = 1;
              paintComponent(panel1.getGraphics());
    public void componentShown(ComponentEvent e) {     
              System.out.println("Componenet Shown");
    // Mouse Listerner's Method
         public void mouseClicked(MouseEvent me){
    if (me.getSource().equals(panel1))
              System.out.println("inside mouse clicked");
                        if(var == "S"){
    the boolean sIndicator will allow the usage of source object only once
         This is the case for both unicast and multi cast.It has been restricted
         to single use.
                             if (sIndicator){
                             System.out.println("inside mouse clicked");
                        System.out.println("locX" + locX);
                        locX = me.getX();
    locY = me.getY();
                   sourceObject("Source");
                             sIndicator = false;
                        }else{}
              }else if (var == "R")
    if(rIndicator){
    if(!isDestSelected){
    System.out.println("redirection" + locX);
    locX = me.getX();
    locY = me.getY();
                   redirectionObject("Redirection");
                   rIndicator = false;
                   }else{}
    } else{}
              }else if(var == "D"){
              if(Radio == 1 && isDestSelected == false){
              System.out.println("Destination -- uni cast mode" + locX);
    locX = me.getX();
    locY = me.getY();
                   destinationObject("Sink");
              isDestSelected = true;
              } else if (Radio == 2)
                                  System.out.println("Destination -- Multicast mode" + locX);
                                  locX = me.getX();
                                  locY = me.getY();
                                  destinationObject("Sink");
                                  isDestSelected = true;                    
         public void mousePressed(MouseEvent me){System.out.println("am inside mouse pressed"); }
         public void mouseReleased(MouseEvent me){
              System.out.println("am inside mouse released");
              paintComponent(panel1.getGraphics());
         public void mouseEntered(MouseEvent me){}
         public void mouseExited(MouseEvent me){}
    // key Listener
    public void keyReleased(KeyEvent e) {        
                        Component compo =(JButton)e.getSource();                               
                             if (e.getKeyChar() == e.VK_DELETE){                         
                             remove(compo);
              public void keyTyped(KeyEvent e) {}
              public void keyPressed(KeyEvent e){}
    public void remove(Component comp){          
    System.out.println("inside delete key" );                         
         panel1.remove(comp);
         panel1.repaint();     
         public void draw(){
              super.paint(panel1.getGraphics());
              System.out.println("inside draw");
              flag = 1;
              paintComponent(panel1.getGraphics());     
         public void actionPerformed(ActionEvent e)
                             if(e.getSource().equals(sBut)){
                                  System.out.println("am s button");                
                                  x1 = sBut.getX() + l;
                                  y1 = sBut.getY() + (b/2);
                             else if(e.getSource().equals(rBut)){
                                  System.out.println("am r button");               
                                  x2 = rBut.getX() ;
                                  y2 = rBut.getY()+ b/2;
                                  System.out.println("x2 : " + x2 + "y2 :" +y2 );
                             else if(e.getSource().equals(dBut)){
                                  System.out.println("am d button");                
                                  x3 = dBut.getX();
                                  y3 = dBut.getY()+ b/2;
                             else if (e.getSource().equals(uniRadio)){
                                  System.out.println("uni radio");
                                  Radio = 1 ;
                             } else if (e.getSource().equals(multiRadio)){
                                       System.out.println("multi radio");
                                       Radio = 2;
                             } else if (e.getSource().equals(show)){            
                                  System.out.println("inside show");
    *********************************************

    ok
    i don't take a long time tracing your code, but i think u have to overwrite the repaint methode so it 's call the methode which will paint the line each time.
    hope this will help!

Maybe you are looking for

  • Error message HRTIM00WS007 - infotype not found

    Hi ALL, I am getting this error message when I am trying to access IT2001. Infotype 0007 not found on XX.XX.XXXX (date) Message no. HRTIM00WS007 Please guide Regards, Amit

  • Wont burn--says blank disc is full

    Hi there, Having a problem with iphoto 5.04, trying to burn 446 meg of photos to a disc. When it asks for a blank disc (have tried 3) it comes up saying the disc is full and wont burn it. sound familliar? is there a way around this? am i missing some

  • What is different between strut and jsp+servlet+javabean?

    welcome

  • ITunes not opens...msi file mentioned

    I can't open iTunes anymore. I've tried unstalling the program (though I can't uninstall every single file). When I download a new installer and try to reinstall, an error box pops up mentioning I should try to find a folder with the iTunes.msi file

  • IOS 6 Shows Recurring Reminders as Overdue

    I have several reminders set up in my MacBook, iPhone 4, and iPad 2 and sync them with iCloud. Some of these are recurring, so I have set them to repeat using the reminders schedule. In iOS 5, these recurring reminders never showed as overdue (posts