Draw fct with float

Does someone know why all draw fonction like drawArc, drawLine use int instead of float or double? it would not be more precise to draw with float or double?
thx

fonction? LOL!
Seriously though, the method you want is java.awt.Graphics2D.draw(Shape) and fill(Shape). You would use it like this:
protected void paintComponent(Graphics g) {
  Graphics2D g2 = (Graphics2D) g;  // cast required to get Graphics2D functionality
  // Now make a shape, any shape
  Shape shape = new Rectangle2D.Double(2.5, 3.0, 30.0, 40.0);
  g2.setColor(Color.yellow);
  g2.fill(shape);
  g2.setColor(Color.black);
  g2.draw(shape);
}Hope this helps.

Similar Messages

  • Draw line with float values possible

    Hi,
    Using Canvas drawing is possible to draw line with float values.
    graphics.drawLine(int,int,int,int);
    graphics.drawLine(float,float,float,float);Thanks and regards,
    Rakesh.

    not possible
    graphics.drawLine(float,float,float,float);...there's no such method in MIDP API: [click here for javadoc of Graphics class methods|http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Graphics.html#drawLine(int,%20int,%20int,%20int)]

  • Can j2me draw line with double values.

    Hi,
    Can any body know how to darw line in j2me with double values.
    I don't want use draw Line with int.
    Shall i use svg or j2me has solution.
    Thanks and regards,
    Rakesh.

    not possible
    graphics.drawLine(float,float,float,float);...there's no such method in MIDP API: [click here for javadoc of Graphics class methods|http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Graphics.html#drawLine(int,%20int,%20int,%20int)]

  • What is the issue? When printing a 30x42 drawing PDF with 5 pages. The first drawing prints properly, but none of th eothers do. IF I print each separately, by selecting "current page" they print fine. Oh this is for Acrobat XI Standard.

    RE Acrobat XI Standard. When printing a 30x42 Drawing PDF with more than 1 page only the first page prints properly the rest are not the proper size or centered. Did I miss a setting? For now I can work around it by printing each page using the "Current Page" setting, but this delays me when there is more than 20 pages etc..

    RE Acrobat XI Standard. When printing a 30x42 Drawing PDF with more than 1 page only the first page prints properly the rest are not the proper size or centered. Did I miss a setting? For now I can work around it by printing each page using the "Current Page" setting, but this delays me when there is more than 20 pages etc..

  • "Cannot draw document with negative rows to credit note"

    Hi Experts,
    A General query :
    I create an AR invoice with two items one with qty 1 and the other with qty (-ve 1)  on posting this invoice the second item / row with negative qty gets closed automatically. Now, I require to post a AR Credit note to this invoice i get the following status error message "cannot draw document with negative rows to AR credit note" when copying to a AR Credit note and it is the same the other way when copying from
    How is it possible to create a  AR credit note to the above scenario. Any sugestions
    V.  2007A SP01 PL05
    Regards,
    Rakesh N

    Hi Rakesh N,
    version 8.8 supports fully the scenario you outline & I would recommend you upgrade to benefit from the new functionalities introduced in that version. Please have a look at the [8.8 landing page|https://service.sap.com/~sapidb/011000358700000199032009].
    Using stand-alone documents & internally reconciling in the lower versions works beautifully on the accounting side yet impacts also the stock side, where corrections in stock value & item cost must be carried out manually.
    All the best,
    Kerstin

  • TLF 2/2.1/3 Weird behavior with floating graphics?

    Hi guys,
    I'm working on a chat application running on RED5 / AS3 and I'm struggling to get my client "UI" working perfectly.
    My problem is related to the TL Framework, on every version available.
    Basicly, I want to display a picture ( for user messages ) and icons ( for notifications ) on the left side of my lines, like this :
    So, I'v been messing around with "float=start", "float=left" and such, but i'm always encountering weird behaviors whenever I scroll or resize my containerController. It's quite easy to reproduce with the following code :
    public class Main extends Sprite
              private var controller:ContainerController;
              public function Main():void
                        if (stage) init();
                        else addEventListener(Event.ADDED_TO_STAGE, init);
              private function init(e:Event = null):void
                        stage.scaleMode = StageScaleMode.NO_SCALE;
                        stage.align = StageAlign.TOP_LEFT;
                        removeEventListener(Event.ADDED_TO_STAGE, init);
                        var holder:Sprite = new Sprite();
                        addChild( holder );
                        var tFlow:TextFlow = new TextFlow();
                        for ( var i:int = 0; i < 50; i++ )
                             tFlow.addChild( createLine() );
                        controller = new ContainerController( holder, 400, stage.stageHeight  );
                        tFlow.flowComposer.addController( controller );
                        tFlow.flowComposer.updateAllControllers();
                        stage.addEventListener( Event.RESIZE, resizeController );
              private function resizeController( e:Event ):void
                        controller.setCompositionSize( 400, stage.stageHeight );
                        controller.textFlow.flowComposer.updateAllControllers();
              public function createLine( ):DivElement
                        var d:DivElement;
                        var p:ParagraphElement;
                        var im:InlineGraphicElement = new InlineGraphicElement();
                        im.source = new Bitmap( new BitmapData( 16, 16, true, 0x30FF0000 ) ); // 0x30 Alpha
                        im.float = "left";
                        d = new DivElement();
                        d.clearFloats = "both";
                        p = new ParagraphElement();
                        d.addChild( p );
                        p.addChild( im );
                        return d;
    Basicly, I'm stacking 50 transparent "floating" elements. It works fine most of time, but if I randomly resize my Flash Player Window, I can get the first "invisible" element to overlap the last "visible" :
    It seems to be happening right when the last "floating" element should disappear. Instead, it gets "over" the previous one. It happens upon container resize and scrolls. I'v encountered this issue on lastest 2, 2.1 and 3 TLF builds.
    Beside the visual "bug", it also screws up my container.getContentBounds().height calls - which can make scrolling "trembling", as the height gets reajusted.
    I'm running out of ideas about how to handle this. This bug appears whenever I use "floating" graphics and I can't think of any other way to display graphics on the left side of my chat-lines.
    Maybe someone ran into this very problem and figured out a way to make it work?
    Excuse my english, thanks in advance,
    Lionel.

    Thank you for your report. And I have found the root cause.
    In BaseCompose.as
    protected function composeFloat(elem:InlineGraphicElement, afterLine:Boolean):Boolean
    if (!floatFits && (_curParcel.fitAny || _curParcel.fitsInHeight(totalDepth, int(logicalFloatHeight))) && (!_curLine || _curLine.absoluteStart == floatPosition || afterLine))
                    floatFits = true;
    The condition of if is true, only when the weird behavior happens. We need to discuss about how to fix it.

  • Precision with float and double values

    Hi, does anyone knows how can i get more precise calculations with floating point numbers? Let's see an example:
    public class Teste {
    public static void main(String args[]) {
    float i = 0;
    while (i<=10) {
    System.out.println(i);
    i=i+0.1f;
    /* output
    0.0
    0.1
    0.2
    0.3
    0.4
    0.5
    0.6
    0.70000005
    0.8000001
    0.9000001
    1.0000001
    1.1000001
    1.2000002
    1.3000002
    1.4000002
    1.5000002
    1.6000003
    1.7000003
    1.8000003
    1.9000003
    2.0000002
    2.1000001
    2.2
    2.3
    2.3999999
    2.4999998
    2.5999997
    2.6999996
    2.7999995
    2.8999994
    2.9999993
    3.0999992
    3.199999
    3.299999
    3.399999
    3.4999988
    3.5999987
    3.6999986
    3.7999985
    3.8999984
    3.9999983
    4.0999985
    4.1999984
    4.2999983
    4.399998
    4.499998
    4.599998
    4.699998
    4.799998
    4.8999977
    4.9999976
    5.0999975
    5.1999974
    5.2999973
    5.399997
    5.499997
    5.599997
    5.699997
    5.799997
    5.8999968
    5.9999967
    6.0999966
    6.1999965
    6.2999964
    6.3999963
    6.499996
    6.599996
    6.699996
    6.799996
    6.899996
    6.9999957
    7.0999956
    7.1999955
    7.2999954
    7.3999953
    7.499995
    7.599995
    7.699995
    7.799995
    7.899995
    7.9999948
    8.099995
    8.199995
    8.299995
    8.399996
    8.499996
    8.599997
    8.699997
    8.799997
    8.899998
    8.999998
    9.099998
    9.199999
    9.299999
    9.4
    9.5
    9.6
    9.700001
    9.800001
    9.900002
    */

    http://forum.java.sun.com/thread.jsp?forum=31&thread=357174

  • Smart Forms : problem with Float Variable

    Hi  Expert,
       I have a probelm with Float variable. In my smart forms one fields of table QAMV contain value like 8.0000000000000000E+01.
    I have to remove the exponent and display value like 80.
    I have tried wa_qamv-sollwert(E10.4).. but it not working.
    Can U suggest me some solution.
    Regards
    Swati.
    Edited by: Swati Namdev on Apr 27, 2010 12:19 PM

    Hi,
    Please follow the steps.
    1. In your smart form create a variable w_val ,, type,, associate type -->  CHAR10
    2. Now write a code, jsut above your node where u wud like to get this value... For this Create -> Flow Logic -> Program Lines.. Now you have editor..
    3. In input parameters , put i_tab-QAMV.. and in output parameter put w_val... and Code like below
    CALL FUNCTION 'MD_CONV_QUANTITY_FLOAT_TO_PACK'
      EXPORTING
        iv_menge       = i_tab-qamv
      IMPORTING
        EV_MENGE       = w_val.
    4. Now grag and drop this w_val from global data field list...your this w_val will have the rounded value.. Pls try this and check..   It will work.
    Regards,
    Lokesh.
    Edited by: Lokesh Tarey on Apr 27, 2010 9:28 AM

  • JSlider with Floating point values

    I desperatly need to create a JSlider with floating/decimal values. For example between 0 and 1 and ticks within an interval of 0.1.
    The default behaviour of JSlider doesn't allow me to do so, hence is there any other way around ? I know it's possible to programmatically handle the required calculation by divding the values by 10, 100 or anything, but i want to display the actual values (floating/decimal) on the JSlider bar.
    Thanks in advance

    this might do you for the display
    import javax.swing.*;
    import java.awt.*;
    class JSliderLabels extends JFrame
      public JSliderLabels()
        setLocation(400,200);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JSlider slider = new JSlider(0, 100, 1);
        slider.setMajorTickSpacing(25);
        slider.setPaintTicks(true);
        java.util.Hashtable labelTable = new java.util.Hashtable();
        labelTable.put(new Integer(100), new JLabel("1.0"));
        labelTable.put(new Integer(75), new JLabel("0.75"));
        labelTable.put(new Integer(50), new JLabel("0.50"));
        labelTable.put(new Integer(25), new JLabel("0.25"));
        labelTable.put(new Integer(0), new JLabel("0.0"));
        slider.setLabelTable( labelTable );
        slider.setPaintLabels(true);
        JPanel jp = new JPanel();
        jp.add(slider);
        getContentPane().add(jp);
        pack();
      public static void main(String[] args){new JSliderLabels().setVisible(true);}
    }

  • Drawing lines with smooth curves

    Hi,
    I'm trying to make a map for an underground system in a PC game and I want something similar to the one Transport for London has:
    http://www.tfl.gov.uk/assets/downloads/standard-tube-map.gif
    I'm a total newbie with Adobe Illustrator, but I'm trying it as I've heard it's what Transport for London uses.
    My question is then, what would be the easiest way of accomplishing multiple lines with different colours and smooth curves, like the lines in my reference picture?
    Thanks in advance,
    Martin

    Martin,
    In addition to what Kurt said, you may draw paths with straight segments and then round the corners afterwards, using Effect>Stylise>Round Corners (you may Object>Expand Appearance to obtain actual roundings).

  • Cannot Draw Freehand with Tablet in PSE8

    I'm sort of a newbie at Photoshop, so I don't know if I need to enable something or if it's just a bug.
    Anyway, I just installed Photoshop Elements 8 onto my laptop that is running Windows Vista Home Premium. I open the Editor and I can draw freely with my mouse, but not with my Bamboo Pen tablet. When I try to draw something with my tablet, all PSE8 does is show one straight line or not show any lines at all. Am I just doing something wrong?
    By the way, I've uninstalled and reinstalled this software 5 times. No use. It didn't change anything.

    First, make sure the mouse is not on the tablet when attempting to use the stylus (pen).
    Check that you have something checked in the brush options panel. See this page:
    http://www.the-graphics-tablet.com/photoshop-elements.html
    Video on using tablet options:
    http://www.youtube.com/watch?v=ghMvJ1VL79E&feature=channel
    You might also check the Wacom site and see if the driver is up to date.
    http://www.wacom.com/downloads/drivers.php
    BTW, I'm pretty sure you should reboot/restart the computer after updating the drivers.
    You might also check your Bamboo Tablet properties. You'll want to do that anyway. Here's a video on doing that:
    http://www.youtube.com/watch?v=0dgcZpKWQIU

  • Is Draw compatible with iPad 3th gen?

    Is Draw compatible with iPad 3th gen? I can install the app and open it,  but not use it. I have reinstalled Draw, installed iOS 8.3, closed all other apps and restarted the iPad with no result.

    It should work just fine.  The requirement is iOS 7.0 minimum.
    Does the app launch?
    Can you log in with your CreativeCloud ID?
    Can you create a screenshot of the last part that works?
    I would suggest: uninstall it, then reinstall it.  Sometimes apps on my iPad don't finish installing completely - reinstalling from the App store solves the problem.

  • [svn] 4746: User-submitted patch for SDK-16147 - HaloBorder does not take border widths into account when drawing background with rounded corners .

    Revision: 4746
    Author: [email protected]
    Date: 2009-01-29 15:36:59 -0800 (Thu, 29 Jan 2009)
    Log Message:
    User-submitted patch for SDK-16147 - HaloBorder does not take border widths into account when drawing background with rounded corners.
    Bugs: SDK-16147 (bug), SDK-16963 (patch)
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-16147
    http://bugs.adobe.com/jira/browse/SDK-16147
    http://bugs.adobe.com/jira/browse/SDK-16963
    Modified Paths:
    flex/sdk/branches/3.x/frameworks/projects/framework/src/mx/skins/halo/HaloBorder.as

  • Converting Vector with Floats to float[] typecast error?

    Java Developers,
    I am able to convert my String vector to a
    String[] but just can't get the Vector with Floats to be converted to a float[] array. I have looked into google and java.sun.com Forums but still cant seem to find the answer. I would really appreciate your help!
    This is how I am making the conversion from Vector(String) to String[]:
    legendLabelsArray = new String[columnHeads.size()];
    int k=0;
    Iterator e = columnHeads.iterator();
    while(e.hasNext()){
    System.out.println("inside the enumerator");
    legendLabelsArray[k] = e.next().toString();
    System.out.println("Array elements at " + k + " are " + legendLabelsArray[k]);
    System.out.println(k++);
    How can I make something similar to work with a Vector with Floats to float[] instead of Strings?
    Thanks,
    Musaddiq
    [email protected]

    Something like this ...
    float[] floatArray = new float[vectorOfFloats.size()];
    int k=0;
    Iterator e = vectorOfFloats.iterator();
    while(e.hasNext()){
    floatArray[k] = ((Float) e.next()).floatValue();
    k++;

  • Advance level drawing problem with Jframe and JPanel need optimize sol?

    Dear Experts,
    I m trying to create a GUI for puzzle game following some kind of "game GUI template", but i have problems in that,so i tried to implement that in various ways after looking on internet and discussions about drawing gui in swing, but i have problem with both of these, may be i m doing some silly mistake, which is still out of my consideration. please have a look at these two and recommend me one of them, which is running without problems (flickring and when you enlarge window the board draw copies (tiled) everywhere,
    Note: i don't want to inherit jpanel or Jframe
    here is my code : import java.awt.BorderLayout;
    public class GameMain extends JFrame {
         private static final long serialVersionUID = 1L;
         public int mX, mY;
         int localpoints = 0;
         protected static JTextField[][] squares;
         protected JLabel statusLabel = new JLabel("jugno");
         Label lbl_score = new Label("score");
         Label lbl_scorelocal = new Label("local score");
         protected static TTTService remoteTTTBoard;
         // Define constants for the game
         static final int CANVAS_WIDTH = 800; // width and height of the game screen
         static final int CANVAS_HEIGHT = 600;
         static final int UPDATE_RATE = 4; // number of game update per second
         static State state; // current state of the game
         private int mState;
         // Handle for the custom drawing panel
         private GameCanvas canvas;
         // Constructor to initialize the UI components and game objects
         public GameMain() {
              // Initialize the game objects
              gameInit();
              // UI components
              canvas = new GameCanvas();
              canvas.setPreferredSize(new Dimension(CANVAS_WIDTH, CANVAS_HEIGHT));
              this.setContentPane(canvas);
              this.setDefaultCloseOperation(EXIT_ON_CLOSE);
              this.pack();
              this.setTitle("MY GAME");
              this.setVisible(true);
         public void gameInit() {     
         // Shutdown the game, clean up code that runs only once.
         public void gameShutdown() {
         // To start and re-start the game.
         public void gameStart() {
         private void gameLoop() {
         public void keyPressed(KeyEvent e) {
         public void keyTyped(KeyEvent e) {
         public void gameKeyReleased(KeyEvent e) {
              PuzzleBoard bd = getBoard();
              for (int row = 0; row < 4; ++row) {
                   for (int col = 0; col < 4; ++col) {
                        if (e.getSource() == squares[row][col]) {
                             if (bd.isOpen(col, row)) {
                                  lbl_score.setText("Highest Score = "
                                            + Integer.toString(bd.getPoints()));
                                  setStatus1(bd);
                                  pickSquare1(col, row, squares[row][col].getText()
                                            .charAt(0));
         protected void pickSquare1(int col, int row, char c) {
              try {
                   remoteTTTBoard.pick(col, row, c);
              } catch (RemoteException e) {
                   System.out.println("Exception: " + e.getMessage());
                   e.printStackTrace();
                   System.exit(1);
         // method "called" by remote object to update the state of the game
         public void updateBoard(PuzzleBoard new_board) throws RemoteException {
              String s1;
              for (int row = 0; row < 4; ++row) {
                   for (int col = 0; col < 4; ++col) {
                        squares[row][col].setText(new_board.ownerStr(col, row));
              lbl_score.setText("Highest Score = "
                        + Integer.toString(new_board.getPoints()));
              setStatus1(new_board);
         protected void setStatus1(PuzzleBoard bd) {
              boolean locals = bd.getHave_winner();
              System.out.println("local win" + locals);
              if (locals == true) {
                   localpoints++;
                   System.out.println("in condition " + locals);
                   lbl_scorelocal.setText("Your Score = " + localpoints);
              lbl_score
                        .setText("Highest Score = " + Integer.toString(bd.getPoints()));
         protected PuzzleBoard getBoard() {
              PuzzleBoard res = null;
              try {
                   res = remoteTTTBoard.getState();
              } catch (RemoteException e) {
                   System.out.println("Exception: " + e.getMessage());
                   e.printStackTrace();
                   System.exit(1);
              return res;
         /** Custom drawing panel (designed as an inner class). */
         class GameCanvas extends JPanel implements KeyListener {
              /** Custom drawing codes */
              @Override
              public void paintComponent(Graphics g) {
                   // setOpaque(false);
                   super.paintComponent(g);
                   // main box; everything placed in this
                   // JPanel box = new JPanel();
                   setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
                   // add(statusLabel, BorderLayout.NORTH);
                   // set up the x's and o's
                   JPanel xs_and_os = new JPanel();
                   xs_and_os.setLayout(new GridLayout(5, 5, 0, 0));
                   squares = new JTextField[5][5];
                   for (int row = 0; row < 5; ++row) {
                        for (int col = 0; col < 5; ++col) {
                             squares[row][col] = new JTextField(1);
                             squares[row][col].addKeyListener(this);
                             if ((row == 0 && col == 1) || (row == 2 && col == 3)
                             || (row == 1 && col == 4) || (row == 4 && col == 4)
                                       || (row == 4 && col == 0))
                                  JPanel p = new JPanel(new BorderLayout());
                                  JLabel label;
                                  if (row == 0 && col == 1) {
                                       label = new JLabel("1");
                                       label.setHorizontalAlignment(JLabel.LEFT);
                                       label.setVerticalAlignment(JLabel.TOP);
                                  else if (row == 4 && col == 0) {// for two numbers or
                                       // two
                                       // blank box in on row
                                       label = new JLabel("2");
                                       label.setHorizontalAlignment(JLabel.LEFT);
                                       label.setVerticalAlignment(JLabel.TOP);
                                  else if (row == 1 && col == 4) {
                                       label = new JLabel("3");
                                       label.setHorizontalAlignment(JLabel.LEFT);
                                       label.setVerticalAlignment(JLabel.TOP);
                                  else if (row == 4) {
                                       label = new JLabel("4");
                                       label.setHorizontalAlignment(JLabel.LEFT);
                                       label.setVerticalAlignment(JLabel.TOP);
                                  else {
                                       label = new JLabel("5");
                                       label.setHorizontalAlignment(JLabel.LEFT);
                                       label.setVerticalAlignment(JLabel.TOP);
                                  label.setOpaque(true);
                                  label.setBackground(squares[row][col].getBackground());
                                  label.setPreferredSize(new Dimension(label
                                            .getPreferredSize().width, squares[row][col]
                                            .getPreferredSize().height));
                                  p.setBorder(squares[row][col].getBorder());
                                  squares[row][col].setBorder(null);
                                  p.add(label, BorderLayout.WEST);
                                  p.add(squares[row][col], BorderLayout.CENTER);
                                  xs_and_os.add(p);
                             } else if ((row == 2 && col == 1) || (row == 1 && col == 2)
                                       || (row == 3 && col == 3) || (row == 0 && col == 3)) {
                                  xs_and_os.add(squares[row][col]);
                                  // board[ row ][ col ].setEditable(false);
                                  // board[ row ][ col ].setText("");
                                  squares[row][col].setBackground(Color.RED);
                                  squares[row][col].addKeyListener(this);
                             } else {
                                  squares[row][col] = new JTextField(1);
                                  // squares[row][col].addActionListener(this);
                                  squares[row][col].addKeyListener(this);
                                  xs_and_os.add(squares[row][col]);
                   this.add(xs_and_os);
                   this.add(statusLabel);
                   this.add(lbl_score);
                   this.add(lbl_scorelocal);
              public void keyPressed(KeyEvent e) {
              public void keyReleased(KeyEvent e) {
                   gameKeyReleased(e);
              public void keyTyped(KeyEvent e) {
         // main
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   @Override
                   public void run() {
                        new GameMain();
      thanks a lot for your time , consideration and efforts.
    jibby
    Edited by: jibbylala on Sep 20, 2010 6:06 PM

    jibbylala wrote:
    thanks for mentioning as i wasn't able to write complete context here.Yep thanks camickr. I think that Darryl's succinct reply applies here as well.

Maybe you are looking for

  • New video blog: Address Validation and Duplicate Check in IC

    Hello Everyone, Here is a short video discussing "Address Validation and Duplicate Check in the Interaction Center" for CRM 7.0 from Renee Wilhelm of SAP product management. [http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/70e18a60-efc9-2c10-

  • Acrobat - Time limit to open a document

    Hi all, Is there any solution to limit the time during which a document can be read? For exemple, I want a document to be legible from October 6th to Octobre 20th, and then it can't be open anymore? Thanks and best regards. T.U.

  • Silence at start of first two tracks

    Whenever I burn a CD, or bounce the CD, I end up getting silence at the start of the first two tracks. It is not an added pause between songs, but actually silences the music, which should be playing under it. Then about 10 seconds into the track, th

  • My name suleman i have i phone 5 so it's switch off/on not working

    dear i have problem withe my phone 5 a switch off/on is not working

  • Logging broken / crashes  Forms-session in AS10g

    we have running DB10gR2 and Forms+reports-Services and somtimes problems with blockings in the DB (it seems blocking a main Table ,no user can work ) I want to check , if forms-session is broken by lost LAN-Connection or crashing the applicatin-users