Results 1 to 4 of 4
  1. #1
    xp_vista007 is offline Member
    Join Date
    Mar 2011
    Posts
    6
    Rep Power
    0

    Default Help me making letter

    Hi, can anyone help me making letters, i have the example, but i need to make other letters , ex. O or V or L .
    Here's the example of letter C :

    Java Code:
     import java.awt.*;
    import java.awt.geom.*;
    public class SimpleLetterC extends Frame
    {
    
      public SimpleLetterC()
      {
        addWindowListener(new MyFinishWindow());
      }
    
    
      public void paint(Graphics g)
      {
    
        Graphics2D g2d = (Graphics2D) g;
    
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
    
        BasicStroke bs = new BasicStroke(3.0f);
        g2d.setStroke(bs);
    
        int xc1 =  50;
        int yc1 = 250;
    
        int xc2 = 250;
        int yc2 =  50;
    
        int xc3 =  50;
        int yc3 =  50;
    
        int xc4 =  250;
        int yc4 =  450;
    
        int xc5 =  50;
        int yc5 = 450;
    
        QuadCurve2D.Double d1 = new QuadCurve2D.Double(xc1,yc1,xc3,yc3,xc2,yc2);
        g2d.draw(d1);
    
        QuadCurve2D.Double d2 = new QuadCurve2D.Double(xc1,yc1,xc5,yc5,xc4,yc4);
        g2d.draw(d2);
    
        drawSmallRect(xc1,yc1,g2d);
        drawSmallRect(xc2,yc2,g2d);
        drawSmallRect(xc3,yc3,g2d);
        drawSmallRect(xc4,yc4,g2d);
        drawSmallRect(xc5,yc5,g2d);
    
        g2d.setFont(new Font("serif",Font.PLAIN,24));
        g2d.drawString("P1'",xc1+10,yc1+5);
        g2d.drawString("P2'",xc2+10,yc2+10);
        g2d.drawString("P3'",xc3-35,yc3+4);
        g2d.drawString("P4'",xc4+10,yc4+10);
        g2d.drawString("P5'",xc5+10,yc5+10);
      }
    
      public static void drawSmallRect(int x, int y, Graphics2D g2d)
      {
        Rectangle rect = new Rectangle(x-4,y-3,8,8);
        g2d.fill(rect);
      }
    
    
      public static void main(String[] argv)
      {
        SimpleLetterC f = new SimpleLetterC();
        f.setTitle("The letter C");
    
        f.setSize(420,500);
        f.setVisible(true);
      }
    
    
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    It's probably best if you try to solve this yourself first as you'll gain much more by doing it this way. All that you need to know is present in the example code, you just have to modify it to your own ends.

  3. #3
    xp_vista007 is offline Member
    Join Date
    Mar 2011
    Posts
    6
    Rep Power
    0

    Default

    hmmmm. It's very difficult, i'm trying this , no results .

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,559
    Rep Power
    25

    Default

    Use a piece of grid paper to draw out the figure/letter you want to draw. That will give you the coordinates of each of the lines that you must draw to create the figure.

Similar Threads

  1. Repeating a letter
    By passingTime in forum New To Java
    Replies: 3
    Last Post: 03-13-2011, 09:43 PM
  2. Firt letter with T
    By globo in forum New To Java
    Replies: 4
    Last Post: 02-25-2011, 09:04 PM
  3. Letter view
    By wide in forum NetBeans
    Replies: 1
    Last Post: 07-02-2009, 02:40 PM
  4. Printing Out Every Other Letter
    By Agent in forum New To Java
    Replies: 4
    Last Post: 11-20-2008, 12:43 AM
  5. Letter with Letters
    By elgatoboricua in forum New To Java
    Replies: 7
    Last Post: 09-16-2008, 02:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •