Package java.text

Examples of java.text.DecimalFormat.format()


    document.setMinimumFractionDigits(4);
    document.setMaximumFractionDigits(6);
    Assert.assertEquals("1.2340", formatter.format(1.234));
    Assert.assertEquals("1.234568", formatter.format(1.23456789));
    Assert.assertEquals("9.8760", formatter.format(9.876));
    Assert.assertEquals("9.876543", formatter.format(9.87654321));
  }

  @Test
  public void writePathContent() throws Exception {
    StringWriter writer = new StringWriter();
View Full Code Here


            total = counter.getCount();
            entries = counter.getEntries();
         }
         double avg = ((double)total)/((double)entries);
         String descrip = key+": total="+total+" on "+entries+"entries for "+
         "an average of "+format.format(avg)+"<br>\n";
         retVal += descrip;
      }
      return retVal;
   }
  
View Full Code Here

    protected String getLength(int length) {
        if (length != -1) {
            int minutes = length / 60;
            int sec = (length - minutes * 60);
            DecimalFormat fmt = new DecimalFormat("00");
            return fmt.format(minutes) + ":" + fmt.format(sec);
        }
        return "??";
    }

    /**
 
View Full Code Here

    protected String getLength(int length) {
        if (length != -1) {
            int minutes = length / 60;
            int sec = (length - minutes * 60);
            DecimalFormat fmt = new DecimalFormat("00");
            return fmt.format(minutes) + ":" + fmt.format(sec);
        }
        return "??";
    }

    /**
 
View Full Code Here

    if (length != -1) {
      int minutes = length / 60;
      int sec = (length - minutes * 60);
      DecimalFormat fmt = new DecimalFormat("00");

      return fmt.format(minutes) + ":" + fmt.format(sec);
    }
    else
      return "timeformat error";
  }

View Full Code Here

    if (length != -1) {
      int minutes = length / 60;
      int sec = (length - minutes * 60);
      DecimalFormat fmt = new DecimalFormat("00");

      return fmt.format(minutes) + ":" + fmt.format(sec);
    }
    else
      return "timeformat error";
  }

View Full Code Here

    FontRenderContext frc = c.getFontRenderContext();
        Font f = c.getFont();
       
        for(double d = min; d <= max; d += tick) {
            if(paint) {
                String sb = df.format(d);
                Rectangle2D r = f.getStringBounds(sb, frc);
               
                height = Math.max(height, (int)r.getHeight());               
            }
            paint = !paint;
View Full Code Here

    FontRenderContext frc = c.getFontRenderContext();
        Font f = c.getFont();
   
        for(double d = min; d <= max; d += tick) {
            if(paint) {
                String sb = df.format(d);
                Rectangle2D r = f.getStringBounds(sb, frc);
               
                width = Math.max((int)r.getWidth(), width);
            }
            paint = !paint;
View Full Code Here

            v = at.transform(p, null);
           
            ticks.setLine(v.getX(), v.getY() - marginOffset/2, v.getX(), v.getY() + marginOffset/2);
            g.draw(ticks);
            if(paint && paintLabels) {
                String sb = df.format(d);
                Rectangle2D r = f.getStringBounds(sb, frc);
               
                g.drawString(sb, (float)(v.getX() - r.getWidth() / 2),
              (float)(v.getY() + r.getHeight() + marginOffset));
            }
View Full Code Here

                g.draw(ticks);
                g.setColor(backupColor);
            }
           
            if(paintLabels && (paint || !c.isPaintAltTick())) {
                String sb = df.format(d);
                Rectangle2D r = f.getStringBounds(sb, frc);
               
                g.drawString(sb, (float)(v.getX() - r.getWidth() - marginOffset),
                            (float)(v.getY() + r.getHeight() / 2));
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.