How to change double to int?

i got a double
double x
x = 3 * 1.2
how to change x to int type?
thx a lot

You can't change x, it's declared as type double.
You can retrieve the value of x as an int by using a cast:
int y = (int) x;

Similar Messages

  • How to change double random value to int value?

    I need to change double random number to int in my program. Please help
    Here's my program
    import java.io.*;
    class GuessingGame
    public static void main( String[] args ) throws IOException
    int guess;
    BufferedReader stdin = new BufferedReader(
    new InputStreamReader( System.in ) );
    String input;
    double somevalue;
    int attempt = 0;
    boolean win = false;
    somevalue=Math.random()*10 ;
    while ( attempt < 3 && !win )
    boolean correct = true;
    //First Guess
    System.out.println("\nI am thinking of a number from 1 to 10.");
    System.out.println("You must guess what it is in three tries.");
    System.out.println("Enter a guess:");
    input = stdin.readLine();
    guess = Integer.parseInt( input );
    if ( guess != somevalue )
    correct = false ;
    System. out.println("Wrong");
    //Second Guess
    System.out.println("Enter a guess: ");
    input = stdin.readLine();
    guess = Integer.parseInt( input );
    if ( guess != somevalue )
    correct = false ;
    System. out.println("Wrong");
    //Third Guess
    System.out.println("Enter a guess: ");
    input = stdin.readLine();
    guess = Integer.parseInt( input );
    if ( guess != somevalue )
    correct = false ;
    System. out.println("Wrong");
    //Result
    if ( correct )
    System. out.println("Right");
    System.out.println("You won the game!");
    win = true;
    else
              System.out.println("The correct number was:"+ somevalue);
    System.out.println("You lost");
    attempt = attempt + 1;

    Ceranith, thanks. It works now. You were very helpful. I searched and found your answer on a similar question using nextInt(int n). I tried to use that approach to my program (for learning purposes)as well, but it didn't work. Could you help to find out what's wrong?
    Here it is:
    import java.io.*;
    import java.util.*;
    class GuessingGame
    public static void main( String[] args ) throws IOException
    int guess;
    BufferedReader stdin = new BufferedReader(
    new InputStreamReader( System.in ) );
    String input;
    int attempt = 0;
    boolean win = false;
    int n=10;
    Random numb = new Random();
    int somevalue = numb.nextInt(int n)+1;
    while ( attempt < 3 && !win )
    boolean correct = true;
    //First Guess
    System.out.println("\nI am thinking of a number from 1 to 10.");
    System.out.println("You must guess what it is in three tries.");
    System.out.println("Enter a guess:");
    input = stdin.readLine();
    guess = Integer.parseInt( input );
    if ( guess != somevalue )
    correct = false ;
    System. out.println("Wrong");
    //Second Guess
    System.out.println("Enter a guess: ");
    input = stdin.readLine();
    guess = Integer.parseInt( input );
    if ( guess != somevalue )
    correct = false ;
    System. out.println("Wrong");
    //Third Guess
    System.out.println("Enter a guess: ");
    input = stdin.readLine();
    guess = Integer.parseInt( input );
    if ( guess != somevalue )
    correct = false ;
    System. out.println("Wrong");
    //Result
    if ( correct )
    System. out.println("Right");
    System.out.println("You won the game!");
    win = true;
    else
              System.out.println("The correct number was:"+ somevalue);
    System.out.println("You lost");
    attempt = attempt + 1;

  • How to change double spaces to single space

    For some reason that I don't know about, the majority of the
    time that I download a PHP or HTML document from the web server to
    my local PC the document gets double spaces injected into each line
    of code. In HomeSite there is a simple command in the menu to
    change double spacing to single spacing. Why does Dreamweaver not
    have this, or if it does, then where is it? I cannot spend all of
    my time mannually removing each double spaced line. I tried the
    search and replace for this, but then I loose my tab formatting and
    it makes the code hard to read. Can anybody help or point me to an
    extension that works for this or sdomething? Or, do I just need to
    reload HomeSite and work in it instead of Dreamweaver?

    "carl@csi" <[email protected]> wrote in
    message
    news:fgn8sd$bn4$[email protected]..
    > For some reason that I don't know about, the majority of
    the time that I
    > download a PHP or HTML document from the web server to
    my local PC the
    > document
    > gets double spaces injected into each line of code. In
    HomeSite there is a
    > simple command in the menu to change double spacing to
    single spacing.
    > Why
    > does Dreamweaver not have this, or if it does, then
    where is it? I cannot
    > spend
    > all of my time mannually removing each double spaced
    line. I tried the
    > search
    > and replace for this, but then I loose my tab formatting
    and it makes the
    > code
    > hard to read. Can anybody help or point me to an
    extension that works for
    > this
    > or sdomething? Or, do I just need to reload HomeSite and
    work in it
    > instead of
    > Dreamweaver?
    Open the find/replace dialog, and check "Use regular
    expressions".
    then type the following in the search box
    \n\s*\n
    and type Ctrl-Enter in the replace box
    this should replace double line-breaks (with or without
    whitespace between
    them) with a single one.
    Joris van Lier

  • How to change double i = Math.random(); value to (int) value

    I am trying to find out how to convert a given double value to integer, which is, to conver double myNumber = Math.random() to (int) value. Here is the sample program look like this.
    Thank you for the help.
    import javax.swing.JOptionPane;
    public class numbers
    public static void main(String[] args)
    int upperLimit = Integer.parseInt(JOptionPane.showInputDialog
    (null, "Enter the upper range integer."));
    double myNumber = Math.random();
    //Test of Random numbers.
    System.out.println("The Upper random number limit is: " +
    myNumber * upperLimit);
    } //End of main.
    } // End of class.

    Not sure exactly what you want and why you want to change the double to an int. I'm assuming by this you want to generate random integers, from 1 to the upper limit the user enters? If so, this is how I would do it:import java.util.*;
    import javax.swing.*;
    public class Numbers
        public static void main(String[] args)
            int upperLimit = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter the upper range integer."));
            Random r = new Random();
            int myNumber = r.nextInt(upperLimit) + 1;
            System.out.println(myNumber);
    }

  • Problem with changing double to int!

    Hi guys. I've got a major headache trying to solve this problem, and I'm hoping maybe someone abit wiser than I could help me out.
    I've added two lots of code, one where if I input 10 as the distance I get an answer of 423.529411..etc. However I want it to display this as just 423seconds. Then print on the next line 'to Travel 10 takes 0 hours, 7mins and 3 seconds. Instead it prints 0.1117etc hours and 7.0574738 minutes and 3.529etc seconds.
       public static double enterDistance()
             System.out.println("Type the travel distance: ");
             distance = UserInput.readDouble();
             if (distance < 0)
                  System.out.println("Illegal Distance Value");
                  distance = 0;
                  enterRoadType();
                  enterDistance();
             return distance;
        public static void calcTime()
             enterRoadType();
             time = enterDistance()/speed; // time in secs
             tottime = tottime + time; //total time in hours
             System.out.println("To travel " + distance + " takes " + (time*60*60) + " seconds");
              System.out.println("To travel " + distance +" takes " + time + " hours and " + (time*convert%convert) + " minutes and " + (time *convert*convert%convert) + " seconds");
              Totaltime = Totaltime + (time*convert*convert);
              Totaldistance = Totaldistance + distance;        
        }So to try and get it to do what I want, I change this line:
    time = enterDistance()/speed; // time in secsto
    time = (int)(enterDistance()/speed); // time in secsHowever then it prints that it takes 0 seconds, 0 hours, 0 mins.
    Argh I'm so lost.
    Any help is appreciated

    I see you use (time*60*60) to display your seconds,
    this means that time = enterDistance()/speed; // time in secs is actually wrong
    So my guess is that you either or using wrong units for your speed or distance.
    I think if you try time = (int)(60*60*enterDistance()/speed); you will not get 0 for your time but i would focus on why your seconds arent seconds first

  • Help!!!!!  anyone know how to change a Double to an int??

    Help!!!!! anyone know how to change a Double to an int?? for use in an array[int].

    I don't know why would you want to depend on a double value to build your array but programmatically just use plain old cast: i = (int) double_value;
    Keep in mind though, the integer value will be truncated.

  • How to change data type from Integer to Double?

    In a data set, BIP treat Oracle number type column as Integer. How to change it to double?

    Hi,
    This could be possible with the tcode RSD2 in BW.
    But before you do this you need to remove this KF from the cubes/dso in which they are used.Otherwise i don think you can do this.
    Once the change is done you could add them back to the DataTargets and load the data as required.
    Regards,
    Anoop

  • How to change String to double ?

    I want to change String to double in Applet program, but for the run time, error is occurred.
    It can not find the method parseDouble.
    Error -> Double.parseDouble("7.5");
    I try to test String to Integer, it works fine.
    OK -> Integer.parseInt("7");
    How to change String to double in Applet ?

    Yea, the Double.parseDouble method came in a later release (first time in 1.2).

  • How to change MANAGED-BEAN-SCOPE??????

    Hi Gurus,
    How to change the managed-bean-scope? In my ADF application I have created one backing bean which has attched with the page fragment. I cant able to set the bean scope other than REQUEST....
    If I set the bean scope request, then page and the inside fragment is rendering without any error. But I need to make that bean scope to pageFlow... but if I do, getting the below error. Non of the scopes are working except request... Please help me how to set the other scope which will solve my major development issue!!!!
    Error:
    Error trying to include:viewId:/advsearch-flow-definition/advUserSearch uri:/app/advUserSearch.jsffjavax.faces.FacesException: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'UserSearch' resolved to null
    My ADFC-Config.xml:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
    <managed-bean>
    <managed-bean-name>backing_app_idm</managed-bean-name>
    <managed-bean-class>edu.syr.oim.backing.app.Idm</managed-bean-class>
    <managed-bean-scope>backingBean</managed-bean-scope>
    <!--oracle-jdev-comment:managed-bean-jsp-link:1app/idm.jspx-->
    </managed-bean>
    <managed-bean>
    <managed-bean-name>backing_app_userMgmt</managed-bean-name>
    <managed-bean-class>edu.syr.oim.backing.app.UserMgmt</managed-bean-class>
    <managed-bean-scope>backingBean</managed-bean-scope>
    <!--oracle-jdev-comment:managed-bean-jsp-link:1app/userMgmt.jspx-->
    </managed-bean>
    *<managed-bean>*
    *<managed-bean-name>UserSearch</managed-bean-name>*
    *<managed-bean-class>edu.syr.oim.backing.app.UserSearch</managed-bean-class>*
    *<managed-bean-scope>request</managed-bean-scope>*
    *</managed-bean>*
    </adfc-config>
    -kln
    Edited by: klogube on Jan 14, 2010 7:23 AM

    *public class UserSearch {*
    private RichTable searchResultTable;
    private Row currentRow;
    private String selectedNetID;
    private RichInputText inputOne;
    private RichInputText inputTwo;
    private RichInputText inputThree;
    private RichSelectOneChoice choiceOne;
    private RichSelectOneChoice choiceTwo;
    private RichSelectOneChoice choiceThree;
    private RichRegion region;
    private String choiceOneVal;
    private String choiceTwoVal;
    private String choiceThreeVal;
    DCBindingContainer bindings;
    int choiceOneRowIndex;
    int choiceTwoRowIndex;
    int choiceThreeRowIndex;
    Row choiceOnerw;
    Row choiceTworw;
    Row choiceThreerw;
    String choiceOneUserSelected = null;
    String choiceTwoUserSelected = null;
    String choiceThreeUserSelected = null;
    static String  txnTypeOne  = null;
    static String  txnTypeTwo  = null;
    static String  txnTypeThree  = null;
    String netid;
    RequestContext requestContext = RequestContext.getCurrentInstance();
    HashMap rcBackupHM = new HashMap();
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = facesContext.getELContext();
    FacesContext fc = FacesContext.getCurrentInstance();
    HttpServletRequest request = (HttpServletRequest)fc.getExternalContext().getRequest();
    HttpSession session = request.getSession();
    *public UserSearch() {*
    *public String userSelected() {*
    FacesCtrlHierNodeBinding binding = (FacesCtrlHierNodeBinding) searchResultTable.getSelectedRowData();
    currentRow = binding.getRow();
    selectedNetID = (String) currentRow.getAttribute("netid");
    requestContext.getPageFlowScope().put("netid",selectedNetID);
    return "goToDetails";
    ** Invoke this method when user double click the row in searchResult*
    *public void doDbClick(ClientEvent clientEvent) {*
    FacesCtrlHierNodeBinding binding = (FacesCtrlHierNodeBinding) searchResultTable.getSelectedRowData();
    currentRow = binding.getRow();
    selectedNetID = (String) currentRow.getAttribute("netid");
    requestContext.getPageFlowScope().put("netid",selectedNetID);
    *try{*
    FacesContext facesCtx = FacesContext.getCurrentInstance();
    NavigationHandler nh = facesCtx.getApplication().getNavigationHandler();
    nh.handleNavigation(facesCtx, "", "goDetails");
    *// Refresh the current region; advse1 is the id of the region component inside jspx page*
    AdfFacesContext.getCurrentInstance().addPartialTarget(region);
    *catch(Exception e){ }*
    *public void setSearchResultTable(RichTable searchResultTable) {*
    this.searchResultTable = searchResultTable;
    *public RichTable getSearchResultTable() {*
    return searchResultTable;
    *public void setInputOne(RichInputText inputOne) {*
    this.inputOne = inputOne;
    *public RichInputText getInputOne() {*
    return inputOne;
    *public void setInputTwo(RichInputText inputTwo) {*
    this.inputTwo = inputTwo;
    *public RichInputText getInputTwo() {*
    return inputTwo;
    *public void setInputThree(RichInputText inputThree) {*
    this.inputThree = inputThree;
    *public RichInputText getInputThree() {*
    return inputThree;
    *public void setChoiceOne(RichSelectOneChoice choiceOne) {*
    this.choiceOne = choiceOne;
    *public RichSelectOneChoice getChoiceOne() {*
    return choiceOne;
    *public void setChoiceTwo(RichSelectOneChoice choiceTwo) {*
    this.choiceTwo = choiceTwo;
    *public RichSelectOneChoice getChoiceTwo() {*
    return choiceTwo;
    *public void setChoiceThree(RichSelectOneChoice choiceThree) {*
    this.choiceThree = choiceThree;
    *public RichSelectOneChoice getChoiceThree() {*
    return choiceThree;
    *public void setChoiceOneVal(String choiceOneVal) {*
    this.choiceOneVal = choiceOneVal;
    *public String getChoiceOneVal() {*
    return choiceOneVal;
    *public void setChoiceTwoVal(String choiceTwoVal) {*
    this.choiceTwoVal = choiceTwoVal;
    *public String getChoiceTwoVal() {*
    return choiceTwoVal;
    *public void setChoiceThreeVal(String choiceThreeVal) {*
    this.choiceThreeVal = choiceThreeVal;
    *public String getChoiceThreeVal() {*
    return choiceThreeVal;
    *public void setRegion(RichRegion region) {*
    this.region = region;
    *public RichRegion getRegion() {*
    return region;
    Can you please explain how to define the 2nd bean in the pageFlowScope and injnect?...bacially my problem is I am loosing the pageFlowScope value when I navigate from first page to next page which I am setting by this above class....I need to carry forward the netid which I am losing ...any idea plz

  • Know how to change the outline shape of a tooltip?

    Hi All,
    I was wondering if anybody knows how to change the shape of a tooltip popup box?
    I've implemented my own UI delegate for ToolTipUI and overridden the paint( Graphics g, JComponent c ) method which I thought would have allowed me to completely control the rendering of the tooltip, box and all. But what I discovered was that even when I did nothing inside this method, the rectangular popup window was still appearing (I stepped through the code, and the correct instance of UI was being used, not the one that may have been defined by UIManager.set( "ToolTipUI", "foo.Bar" )) After a little more investigation, I ended up in ToolTipManager.showTipWindow() which eventually calls
    PopupFactory popupFactory = PopupFactory.getSharedInstance();
    tipWindow = popupFactory.getPopup(insideComponent, tip, location.x, location.y);
    tipWindow.show();To try to overcome this, as a test I extended JButton with the following constructor:
    public TestButton() {
        super();
        setUI( new MyCustomUI() );
        ToolTipManager.sharedInstance().unregisterComponent( this );
    }but this didn't solve the problem either. Has anybody got any ideas on this?
    Cheers,
    Paul.

    Try this.
    regards,
    Stas
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.awt.geom.*;
    public class Test {
        JScrollPane scroll;
        JPanel p=new JPanel(new BorderLayout());
        Robot robot=new Robot();
        public Test()  throws Exception {
            final JFrame frame=new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.getContentPane().add(p);
            JButton b=new JButton("Test balloon!");
            b.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    TransparentFrame frame1=new TransparentFrame();
                    int x=frame.getX()-100;
                    if (x<0) x=0;
                    int y=frame.getY()-100;
                    if (y<0) y=0;
                    frame1.setBounds(x,y,100,100);
                    frame1.createBalloon();
                    frame1.setVisible(true);
            frame.getContentPane().add(b);
            frame.setBounds(200,200,120,50);
            frame.show();
        public static void main(String[] args) throws Exception {
            new Test();
    class TransparentFrame extends JWindow {
        Robot robot;
        BufferedImage screenImg;
        Rectangle screenRect;
        MyPanel contentPanel=new MyPanel();
        boolean userActivate=false;
        Area Balloon;
        public TransparentFrame() {
            super();
            createScreenImage();
            contentPanel.Balloon=Balloon;
            this.setContentPane(contentPanel);
            this.addComponentListener(new ComponentAdapter() {
                public void componentHidden(ComponentEvent e) {}
                public void componentMoved(ComponentEvent e) {
                    resetUnderImg();
                    repaint();
                public void componentResized(ComponentEvent e) {
                    resetUnderImg();
                    repaint();
                public void componentShown(ComponentEvent e) {}
            this.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                public void windowClosed(WindowEvent e) {
                public void windowOpened(WindowEvent e) {
                public void windowIconified(WindowEvent e) {
                public void windowDeiconified(WindowEvent e) {
                public void windowActivated(WindowEvent e) {
                public void windowDeactivated(WindowEvent e) {
                    Balloon=null;
        protected void createScreenImage() {
            try {
                if (robot==null)
                    robot=new Robot();
            catch (AWTException ex) {
                ex.printStackTrace();
            Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
            screenRect=new Rectangle(0,0,screenSize.width,screenSize.height);
            screenImg=robot.createScreenCapture(screenRect);
        public void createBalloon() {
            Rectangle bounds=new Rectangle(0,0,getWidth(),getHeight());
            Balloon=new Area(new Rectangle(bounds));
            System.err.println(Balloon.getBounds());
            RoundRectangle2D content=new RoundRectangle2D.Double(0,0,getWidth(),getHeight()/3,20,20);
            Polygon polygon=new Polygon(new int[] {20,getWidth()/2,getWidth()},new int[] {getHeight()/3,getHeight()/3,getHeight()},3);
            Area a=new Area(new Rectangle(bounds));
            a.subtract(new Area(content));
            a.subtract(new Area(polygon));
            Balloon.subtract(a);
            contentPanel.Balloon=Balloon;
        public void resetUnderImg() {
            if (robot!=null && screenImg!=null) {
                Rectangle frameRect=getBounds();
                int x=frameRect.x;
                contentPanel.paintX=0;
                contentPanel.paintY=0;
                if (x<0) {
                    contentPanel.paintX=-x;
                    x=0;
                int y=frameRect.y;
                if (y<0) {
                    contentPanel.paintY=-y;
                    y=0;
                int w=frameRect.width;
                if (x+w>screenImg.getWidth())
                    w=screenImg.getWidth()-x;
                int h=frameRect.height;
                if (y+h>screenImg.getHeight())
                    h=screenImg.getHeight()-y;
                contentPanel.underFrameImg=screenImg.getSubimage(x,y,w,h);
    class MyPanel extends JPanel {
        BufferedImage underFrameImg;
        Area Balloon;
        int paintX=0;
        int paintY=0;
        public MyPanel() {
            super();
            setOpaque(true);
        public void paint(Graphics g) {
            super.paint(g);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.drawImage(underFrameImg,paintX,paintY,null);
            if (Balloon!=null) {
                g.setColor(Color.yellow);
                ((Graphics2D)g).fill(Balloon);
            g.setColor(Color.red);
            g.drawString("Balloon test!",10,20);
    }

  • How do i double buffer this code (URGENT)

    i make an image move when user presses the arrow buttons but the moving image flickers how do i prevent that
    the code:
    import java.awt.*;
    import java.io.*;
    public class KenshinGame extends Frame{
    MoveImages mi = new MoveImages();
    int x = 355;
    int y = 10;
    int spaceCount = 0;
    public KenshinGame () {
         add ("Center", mi);
    public boolean handleEvent (Event evt){
         if (evt.id == Event.WINDOW_DESTROY){
         System.exit(0);
         return super.handleEvent(evt);
    public boolean keyDown(Event evt, int key){
    if (key == Event.LEFT) {
         //System.out.println (x);
         if (y > 125 && y <170 && x > 65){
         x = x - 10;
         mi.move(x, y);
         else if (y < 650&& y > 620 && x > 110){
         x = x - 10;
         mi.move(x, y);
    else if (key == Event.RIGHT) {
         //System.out.println (x);
         if (y > 125 && y <170 && x < 675){
         x = x + 10;
         mi.move(x, y);
         else if (y < 650&& y > 620 && x < 640){
         x = x + 10;
         mi.move(x, y);
    else if (key == Event.UP) {
         //System.out.println (y);
         if (y > 10 && x == 355){
         y = y - 10;
         mi.move(x, y);
         else if (y > 120 && x > 320 && x < 390){
         y = y - 10;
         mi.move(x, y);
         else if (x < 130 && x > 110 && y > 120 && y < 170){
         y = y - 10;
         mi.move(x, y);
         else if (x > 475 && x < 515 && y > 110 && y < 170){
         y = y - 10;
         mi.move(x, y);
         else if (x > 625 && x < 655 && y > 110 && y < 170){
         y = y - 10;
         mi.move(x, y);
         else if (x < 130 && x > 110 && y > 605 && y < 640){
         y = y - 10;
         mi.move(x, y);
    else if (key == Event.DOWN) {
         if (x > 320 && x < 390 && y < 670){
         y = y + 10;
         mi.move(x, y);
         else if (x < 130 && x > 110 && y > 100 && y < 170){
         y = y + 10;
         mi.move(x, y);
         else if (x > 475 && x < 515 && y > 90 && y < 170){
         y = y + 10;
         mi.move(x, y);
         else if (x > 625 && x < 655 && y > 90 && y < 170){
         y = y + 10;
         mi.move(x, y);
         else if (x < 130 && x > 110 && y > 595 && y < 640){
         y = y + 10;
         mi.move(x, y);
         else if (y > 660){
         x = 615;
         y = 390;
         mi.move (x, y);
    return true;
    public static void main(String args[]) {
         Frame f = new KenshinGame();
         f.resize (760, 740);
         f.show();
         f.setTitle ("Gmae: Level 1");
    class MoveImages extends Canvas {
    int x = 355;
    int y = 10;
    int w = 10;
    int h = 20;
    String mapLoc = new String ("c:\\My Documents\\My Pictures\\liotto.gif");
    String maincLoc = new String ("c:\\My Documents\\My Pictures\\rstand.gif");
    Image map = Toolkit.getDefaultToolkit().getImage(mapLoc);
    Image mainc = Toolkit.getDefaultToolkit().getImage (maincLoc);
    public void paint (Graphics g){
         MediaTracker tracker = new MediaTracker(this);
         tracker.addImage(map, 0);
         g.drawImage (map, 0, 0, this);
         try {     
         tracker.waitForAll();
         catch (InterruptedException e) {
         g.drawImage (mainc, x, y, this);
    public void move(int xCo, int yCo){
         x = xCo;
         y = yCo;
         repaint();
    public void update (Graphics g){
         paint (g);
    }

    i havent changed the main class but i did change the canvas because i have figured out how to use double buffering any suggestions how i can fix this instead:
    class MoveImages extends Canvas {
    int x = 355;
    int y = 10;
    String di = "stand";
    String mapLoc = new String ("c:\\My Documents\\My Pictures\\liotto.gif");
    Image map = Toolkit.getDefaultToolkit().getImage(mapLoc);
    Image stand = Toolkit.getDefaultToolkit().getImage("c:\\My Documents\\My Pictures\\rstand.gif");
    Image walka = Toolkit.getDefaultToolkit().getImage("c:\\My Documents\\My Pictures\\rwalka.gif");
    Image walkt = Toolkit.getDefaultToolkit().getImage("c:\\My Documents\\My Pictures\\rwalkt.gif");
    Image walkl = Toolkit.getDefaultToolkit().getImage("c:\\My Documents\\My Pictures\\rwalkl.gif");
    Image walkr = Toolkit.getDefaultToolkit().getImage("c:\\My Documents\\My Pictures\\rwalkr.gif");
    int w = 760;
    int h = 740;
    Image offscreen ;
    Graphics og;
    public MoveImages (){
    public void paint (Graphics g){
         g.drawImage (map, 0, 0, this);
         if (di.equals ("stand")){
         g.drawImage (walka, x, y, this);
         g.drawImage (walkt, x, y, this);
         g.drawImage (walkl, x, y, this);
         g.drawImage (walkr, x, y, this);
         g.drawImage (stand, x, y, this);
         else if (di.equals ("walka")){
         g.drawImage (walkt, x, y, this);
         g.drawImage (walkl, x, y, this);
         g.drawImage (walkr, x, y, this);
         g.drawImage (stand, x, y, this);
         g.drawImage (walka, x, y, this);
         else if (di.equals ("walkt")){
         g.drawImage (walkl, x, y, this);
         g.drawImage (walkr, x, y, this);
         g.drawImage (stand, x, y, this);
         g.drawImage (walka, x, y, this);
         g.drawImage (walkt, x, y, this);
         else if (di.equals ("walkl")){
         g.drawImage (walkt, x, y, this);
         g.drawImage (walkr, x, y, this);
         g.drawImage (stand, x, y, this);
         g.drawImage (walka, x, y, this);
         g.drawImage (walkl, x, y, this);
         else if (di.equals ("walkr")){
         g.drawImage (walkt, x, y, this);
         g.drawImage (walkl, x, y, this);
         g.drawImage (stand, x, y, this);
         g.drawImage (walka, x, y, this);
         g.drawImage (walkr, x, y, this);
    public void move(int xCo, int yCo, String direction){
         di = direction;
         x = xCo;
         y = yCo;
         repaint();
    public void addNotify(){
         super.addNotify();
    public void update (Graphics g){
         if (offscreen == null){
         offscreen = createImage (w, h);
    og = offscreen.getGraphics ();
         paint (og);
         g.drawImage (offscreen, 0, 0, this);
    }

  • How to change the default structure when exporting data in CSV format?

    Hello,
    can some one tell us how to change the default structure in CRM when exporting lists in CSV format (with Option "Always use unformatted list format (CSV) for download" ? Because we want to add a new structure for our own -is it possible ?
    If it is possible where can we find these structure ? In the blueprint customizing ?
    Thank you very much,
    Christian

    There is a workaround to move from 1.5 version to the older 1.4 version. But this could be specific to the browser setting the JRE version.
    Excerpts from sun docs:
    However, a user can still run older versions. To do so, launch the Java Plug-in Control Panel for the older version, then (re)select the browser in the Browser tab.
    Example:
    Assume you are running on Microsoft Windows with Microsoft Internet Explorer, have first installed version 1.4.2, then version 5.0, and you want to run 1.4.2.
    Go to the j2re1.4.2\bin directory where JRE 1.4.2 was installed. On a Windows default installation, this would be here: C:\Program Files\Java\j2re1.4.2\bin
    Double-click the jpicpl32.exe file located there. It will launch the control panel for 1.4.2.
    Select the Browser tab. Microsoft Internet Explorer might still appear to be set (checked). However, when 5.0 was installed, the registration of the 1.4.2 JRE with Internet Explorer was overwritten by the 5.0 JRE.
    If Microsoft Internet Explorer is shown as checked, uncheck it and click Apply. You will see a confirmation dialog stating that browser settings have changed.
    Check Microsoft Internet Explorer and click Apply. You should see a confirmation dialog.
    Restart the browser. It should now use the 1.4.2 JRE for conventional APPLET tags.
    Details are here
    http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/jcp.html
    My system (Windows XP) has the version 1.5_09 set as the default. However i just installed JRE 1.5_06 and would like to revert back to _06 as the default JRE..
    Will update if i find more information

  • How to change the default text title of Detached table/treetable

    Hi,
    Is anybody know How to change the default text title of Detached table/treetable.
    I have already read the post on "http://vtkrishn.com/2010/07/28/how-to-change-the-default-text-title-of-detached-tabletreetable/"
    as per this post It will change the title throughout the application.
    I wanted to change only for one particular table.
    Thanks,
    Charu
    Edited by: Charu on Sep 13, 2012 4:14 AM

    Hi,
    please don't double post and instead continue with your original threat. In the previous post you got the correct answer to use skinning. You did not like the solution as it doesn't allow per-instance titles. I agree with this and a logical consequence is to file an enhancement request instead of re-posting the question. I'll file the ER, so no need to follow up for you anymore
    Frank

  • How to change the default sorting in iTunes

    Hi,
    Does anyone know how to change the default sorting method for all items in iTunes?  I use the third option for organizing the library as a whole (the one that has a list of icons for bands that you double click to show only that band's songs).  The only sorting method I use is to sort by Album by Year (ascending), this makes the most sense to me.  I can tell that iTunes is attempting to remember when I do this for certain artists, but it epically fails at maintaining this sorting pattern.
    To be clear, say I open Radiohead and click through to have it sort with the above method.  Everything works great, but when I return a few days later to play Radiohead again, the sorting is not maintained.  It could be as simple as sorting in a descending direction, or could even be trying to sort by the number it was added in my library.
    I'd really appreciate it if someone knew of a way (maybe even through scripts if possible / the only solution) to eliminate this problem and have every (NOT just the artists who I've told iTunes to sort a specific way) artist sort that way.
    I don't know if my copy is just corrupt?  It may be, since for some artists it's started playing them in the above mentioned order they were added to my library even if I force a sort by album by year (i.e. it will go from playing a 2007 album to a 2002 album and not the 2008 album).
    Thanks!

    Andrew, I know I am extremely late to the party but I too use Grid View.  I had the same problem that you had but have found this to work for me.  I used it and it is still holding as my default sorting even after switching between the Artist page and Grid View.
    Once you are inside of the Artist page continue to click on the Album column until it shows Album by Artist/Year.
    That will give you each album sorted by the year instead of it randomly sorting it for you each time you leave an Artist's page and then back again.
    Hope this helps.

  • How to change the default JRE when there are several version of JRE in Sys

    How to change the default JRE when there are several version of JRE in System?
    i have installed j2sdk1.5.0 then installed j2ee1.4,then installed Weblogic6.1 which use jdk1.3
    Now the JRE is jdk1.3\bin
    When run class that was compiled with jdk1.5,throw:
    java.lang.UnsupportedClassVersionError
    How can i change the jre to 1.5?

    There is a workaround to move from 1.5 version to the older 1.4 version. But this could be specific to the browser setting the JRE version.
    Excerpts from sun docs:
    However, a user can still run older versions. To do so, launch the Java Plug-in Control Panel for the older version, then (re)select the browser in the Browser tab.
    Example:
    Assume you are running on Microsoft Windows with Microsoft Internet Explorer, have first installed version 1.4.2, then version 5.0, and you want to run 1.4.2.
    Go to the j2re1.4.2\bin directory where JRE 1.4.2 was installed. On a Windows default installation, this would be here: C:\Program Files\Java\j2re1.4.2\bin
    Double-click the jpicpl32.exe file located there. It will launch the control panel for 1.4.2.
    Select the Browser tab. Microsoft Internet Explorer might still appear to be set (checked). However, when 5.0 was installed, the registration of the 1.4.2 JRE with Internet Explorer was overwritten by the 5.0 JRE.
    If Microsoft Internet Explorer is shown as checked, uncheck it and click Apply. You will see a confirmation dialog stating that browser settings have changed.
    Check Microsoft Internet Explorer and click Apply. You should see a confirmation dialog.
    Restart the browser. It should now use the 1.4.2 JRE for conventional APPLET tags.
    Details are here
    http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/jcp.html
    My system (Windows XP) has the version 1.5_09 set as the default. However i just installed JRE 1.5_06 and would like to revert back to _06 as the default JRE..
    Will update if i find more information

Maybe you are looking for

  • Combined Report for Purchasing and Inventory Management.

    Hi All, Is there any standard SAP Report available where I can get all the information related to Purchasing and Inventory Management in one. Like Material,Purchasing details of the material (vendor, price etc ) and Inventory Management (Stock qty an

  • Help putting a scriplet in a jsp

    I have the following jsp page which i have created a scriplet inside which should go around the arraylist and pull the data into a table but i am getting a error message when trying this the jsp is: <BODY BGCOLOR>      <jsp:usebean id="pricePassed"  

  • API / Interface for Global BPA enable organization

    For Global Blanket Purchase Agreement (GBPA) , this is "Enable Organizations" Form : BPA -> Tools ->Enable Organizations Is there API or Interface for this data conversion/import? PS. the table for this data is "po_ga_org_assignments" Regards! Lumen

  • DaqMX - Access TDMS dt and timestamp Before "Stop Task" is called

    When using DaqMX to store sampled data to a TDMS file, how can I access the Start Time and dt? Is there a property Node, etc I can read from? The TDMS file does not include the datestamp and dt until AFTER the "Stop Task" is called (looks like anothe

  • Regarding Varrays (Urgent)

    Dear Experts, Please tell me how to store emp_name in varray. and I need to pass that varray to another procedure. so please send code .