Drawing on Buttons

Hi,
I am developing an application, which displays text in Indian local languages. Even the buttons are to have text in the local language. The API provides me to call drawstring(Graphics, String, int, int) to draw a required string on say a canvas.
How can I achieve this on a Button. For compatibility issues, I am to use only java.awt.*; and not swing. Developing my own button might take too much time.... I am not really sure. I also tried searching for "custom buttons" and "drawing on buttons" but couldn' t get anything relevant.
Any help will be appreciated.
Thanks in advance,
Regards,
Vinay

Maybe I'm missing the point here, but ... Why don't you just specify the text you want, whatever the language is, in the constructor for the button? If you want to create a button that says "Wimflicket" because that's the word for "Print" in whatever language, just create the button with new Button("Wimflicket")If you have to support multiple languages, decide what language you are using before you create the button and supply the text in the appropriate language. If for some reason you just must create the button first and decide the language later, use setLabel() to set the text. If you need a special font to render the language, you can do a "setFont" on a Button. While I haven't tried this, I would think that if you set the text and later set the font it should still work correctly.

Similar Messages

  • Hi, i can't click on the 'Draw Inside' button

    i am unable to click on the 'Draw Inside' button at the bottom left to place a pattern into an image that i got off google, how can i place a pattern that i have made into my image?

    Sophie,
    It only works with a single vector object, not a raster image. My guess is that you have the latter.
    https://helpx.adobe.com/illustrator/using/drawing-basics.html

  • Using Path to draw a button

    All
    Has anyone got any good tutorials on using the Path element to draw custom shapes? I would like to draw a button like widget that can have 4 labels inside it and have one rounded corner.

    i did not understand what you are looking for.
    Is it on how to create buttons with a custom style (or controls in general)?
    Then have a look at http://www.drdobbs.com/jvm/a-javafx-20-custom-control/229400781
    If you really want to know how to use the path class to draw anything, just pop up a sample stage and start drawing. The JavaDoc for Path provides some good examples.
    you could as well just phrase your exact problem.

  • How to draw a button like the Close Button ?

    Hello,
    I'm using a JFrame as an undecorated Frame.
    Now I'm trying to add a JButton to close the frame.and I want a button that looks like the current system frame CloseButton.
    How Can I get the specified UI to draw my JButton?
    Or does exist a way to add the system buttons (minimize, maximmize, close) ?
    Thanks

    horfee wrote:
    I said I'm using undecorated frame : it implies i'm already using setUndecorated(true);
    So I'm not kidding... Right !NO KIDDING, but what you are now asking for is a decorated frame, so setUndecorated(false) will give you what you want.
    But if it's just 3 independent buttons you want, then just capture the image and make the buttons and place them where you want them. It's really as simple as that.

  • Drawing Dynamic Buttons Using API

    I am trying to dynamcally create several buttons using the
    Flash API. The following code hnts at the concept. But I can't sem
    to dynamically name and create the MovieClip since the
    attachMovieClip() method does not seem to exist in Actionscript 3.
    Can any one help?

    Sounds great guys and thanks for the quick responses. I get
    how to put the names of the buttons into the array. That is:
    var str:Array = new Array();
    and then use a for loop to fill up the array with the names
    of buttons, from button1 through buttonN, where N equals the number
    of buttons. But then how do I convert the names of the buttons
    insid the Array into MovieClip objects so that I can then use the
    API to take advantage of the drawRoundRect() method, define tweens,
    filters and / or turn on the hand cursor for that object, etc.
    I understand how to get the name of the item into an array
    using for loops, but how do I define that resulting name as a
    MovieClip Object. Does the resulting Array element automatically
    become an object that inherits all the properties and methods of
    MoviClip Objects?
    In Actionscript 2.0, one could use the
    object.createEmptyMovieClip("t"+i, object.getNextHighestDepth());
    Is there a way to do something similar in Actionscript 3.0

  • I created a little software where you can simply draw buttons with..

    Hey guys..
    I created a simple software where you can just draw the button you want like you want it.. The software itself builds and compiles to give you a 100% stable jButton extended .class and .java files.. After that you can just use it on any of your projects.. I also figured a way to get those buttons to the netbeans palette. Check out the site for everything.. It's www.jleeker.simpler.at Well the software is still primitive.. But it does the work i suppose.. He he.. So check it out and let your friends in on it too.. Thank you..
    p.s :-
    Dont think i'm using this forum for marketting purposes.. Cause the software is and will be 100% FREE..

    Hey guys..
    I created a simple software where
    you can just draw the button you want like you want
    it.. The software itself builds and compiles to give
    you a 100% stable jButton extended .class and .java
    files.. After that you can just use it on any of
    your projects.. I also figured a way to get those
    buttons to the netbeans palette. Check out the site
    for everything.. It's www.jleeker.simpler.at Well
    the software is still primitive.. But it does the
    work i suppose.. He he.. So check it out and let
    your friends in on it too.. Thank you..
    p.s :-
    Dont think i'm using this forum for marketting
    purposes.. Cause the software is and will be 100%
    FREE..
    It's still being marketed, though, regardless

  • Making 'attach to email' button as a hyperlink has disappeared in acrobat X pro

    hi
    I have upgraded to Acobat X pro from Acrobat 8 (CS3). I make brochures in indesign and then add some buttons in acrobat that can't be done in indesign. One button I nake is a 'attach to email' button. I can no longer see this option in create a link/custom link/actions/add
    can someone please advise how I can still do this as my client still wants this button on the back page of all their brochures so they customers can easily pass the brochure onto someone else

    no, this is not what I need
    Your screen dumps are to show where you can attach a pdf to an email from the file menu in a pdf. This is not what I want
    I use the draw a button using the 'link' tool in acrobat
    this tool opens a dialogue box called create a link and I choose
    custom link which opens another dialogue box and I choose
    the action tab, selct an action 'add' and choose from the options here except pro x has had the 'attach to email' action removed
    I need to get this in order to make a button on the pdf that a customer can click and then send the pdf to an email address that they enter

  • Not able to draw a layer

    I'm new to DW 8.2 and I'm studying from a couple of books. I
    have an issue that I can't seem to resolve even after extensive
    research. I'm using a Mac running Tiger.
    When I try to draw a layer on either a new doc or one that
    already has some content, there's always an insertion bar blinking
    at the top left of the doc. When I proceed to draw the layer box
    (Insert Panel—Layout—Standard—Draw Layer
    Button—drag to draw) anywhere in the doc, instead I get a box
    as deep as the insertion bar and as wide as the browser. Also the
    new layer does not show up in the Layers Panel. However I do see
    next to the body tag a new tag <div#Layer1>. I can click the
    box to select it but that's it. I don't see the Layer box with
    corner handles to resize or move.
    I've already spent a considerable amount of time trying to
    resolve this (preferences, tech notes, forums, askjeeves, etc) w/o
    any luck.
    Does any one out there has a clue as what is going on?
    Thank, Jose

    It's not a layer really, but you can do much of what you describe if you use a button to display the page as the button's icon. You can make it any size you want and choose from several scaling types. You can also flatten the button when you're done to convert its appearance to regular page contents.

  • Create buttons that fade in on MENU

    Like any comercial DVD, I'd like to be able to have my buttons fade in (not be seen before as a background movie first starts). Then at my desired time, i'd like to be able to have the button be selected and accessed. How do you specify this?
    I thought a work around would be to have the PLAY button right on the MOTION menu i created...but I wouldn't have the interactivity when selecting the Buttons, like underlining..etc.
    Thanks!
    -M

    You could certainly achieve this the way joey848 describes, but you should read up on setting the 'loop point' before you go any further.
    You need to construct the footage for the introduction and fade in all of the elements that you want to appear, including button texts, then hold this for at least 30 seconds as a still. Use FCP, Motion, AE, whatever you like. Take a frame out of this into Photoshop (or similar) and use it as a guide, and create an overlay pict file (as for a standard menu) which has the highlight shapes on it only (not the frame from the sequence). Import that into DVDSP along with your animated sequence.
    Use the sequence in a menu, and use the property inspector to set the loop point slider to a place just after the sequence becomes still. Add the overlay file, draw the button rectangles and set the targets and navigation as you would for a standard menu.
    What will happen is that the entire animated sequence will play and your fade will take place, then the buttons will be active. At the end of the menu the loop will occur - there will be a slight pause as this happens - and then the still section will continue on screen. If you want to go back to the menu and start at the loop point then you'll need to use a short script to do so. The details for this are in the DVDSP user manual.

  • Layout mode in Dreamweaver CS3. Can't draw table

    I did the same exact thing i do in dreamweaver 8, but in cs3,
    it's now working.
    I went to layout mode and with a blank page and the draw
    table button is grayed out.
    what do i do to use it. I'm already in layout mode.

    Get out of Layout mode for starters.
    In my opinion, there are three serious problems with Layout
    Mode -
    1. Perhaps most importantly, it sits between you and *real*
    HTML tables,
    and fools you into believing that concepts like "layout cell"
    and
    "autostretch" really mean something. They do not. As long as
    you use
    Layout Mode, you'll never learn one of the most important
    things for new web
    developers - how to build solid and reliable tables.
    2. Actually, #1 wouldn't be *so* bad, except that the code
    that is written
    by Layout Mode is really poor code. For example, a layout
    table contains
    MANY empty rows of cells. This can contribute to a table's
    instability.
    In addition, if your initial positioning of the table's cells
    is a bit
    complex,
    Layout Mode will throw in col- and rowspans aplenty as it
    merges and splits
    cells willy-nillly to achieve the pixel-perfect layout you
    have specified.
    Again,
    this is an extremely poor method for building stable tables,
    because it
    allows
    changes in one tiny cell's shape (i.e, dimensions) to ripple
    through the
    rest
    of the table, usually with unexpected and sometimes
    disastrous consequences.
    This is one of the primary reasons for the final result's
    fragility - read
    this -
    http://apptools.com/rants/spans.php
    3. The UI for Layout Mode is beyond confusing - many options
    that you might
    want to use are inaccessible, e.g., inserting another table,
    or layer onto
    the page.
    I can understand the new user's desire to use this tool to
    make their life
    easier,
    but the cost is just too heavy in my opinion.
    To make good tables, keep it simple. Put a table on the page,
    and begin to
    load your content. If you would want a different table
    layout, instead of
    merging or splitting cells, consider stacking tables or
    nesting simple
    tables instead, respectively.
    And above all, do not try to build the whole page with a
    single table!
    To read more about this approach, visit the DW FAQ link in my
    sig, and run
    through the table tutorials.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Dreamweaver2k2" <[email protected]> wrote
    in message
    news:[email protected]...
    >I did the same exact thing i do in dreamweaver 8, but in
    cs3, it's now
    >working.
    > I went to layout mode and with a blank page and the draw
    table button is
    > grayed out.
    >
    > what do i do to use it. I'm already in layout mode.
    >

  • Button in a selection screen

    Can someone give an example of create a pushbuttom in a selection screen 1000? I draw the button with screen painter and i assign a function code.
    Which event is triggered when i push the button??? AT-USER COMMAND ??? I think that isn't because is in the selection-screen.
    thanks,
    SILVIa

    Hi
    TABLES: SSCRFIELDS.
    If you need a pushbuttom on the screen:
    SELECTION-SCREEN PUSHBUTTON X(Y) <NAME> USER-COMMAND <COMMAND>.
    X is the distance from the left border and Y is the lenght.
    INITIALIZATION.
    <NAME> = 'My Buttom'.
    If you need it on the status:
    SELECTION-SCREEN FUNCTION KEY N.
    with N is from 1 to 5.
    INITIALIZATION.
    MOVE 'My Buttom' TO SSCRFIELDS-FUNCTXT_0<N>.
    Manage the ok-code in the AT SELECTION-SCREEN event
    AT SELECTION-SCREEN.
      IF SSCRFIELDS-UCOMM = <CODE>.
      ENDIF.
    Max

  • Camera Button just stopped working

    Very strange ... has been flawless since September.  Starting today, when I push the Camera Button, it no longer vibrates and starts my camera APP.  After I manually select the Camera App from my App drawer, the button works fine to take the picture...  I've rebooted.  I've pulled the battery.
    Any ideas??

    Cody21 wrote:
    I press it a looong time - much more than "usual".  Anyway, this is very bazaar ....  I went thru the pain of uninstalling any and all APPS that I recently installed over the last week - including LPP which was a total pain.  1 by 1 uninstalling, rebooting, testing camera ...  It suddenly worked after an uninstall of 1 particular APP ... so I rebooted again, just to verify.  It failed to respond again to pressing the button .. Rebooted again, didn't install anything, tested - it worked this time ..  So honestly, I can't say any particular APP is causing this ... I reinstalled the APPS that I had uninstalled - and it is currently working  ..  So now am nearly convinced this intermittent bug was introduced with the latest OS update ...  ugh ...  It worked perfectly -- 100% of the time prior to this update.
    Anyone else experiencing this ?
    I've have the phone for over a month (yep, folks...past my 30 days.  I'm keeping the Droid X!)  It came with 2.2 (and I went through the latest update with no probs - knock wood), and I've always had to hold the camera button down for a few seconds.  Thought it was inherent to the phone. 

  • Buttons having shape of Sector

    I want to draw three Buttons of Sector shape and arrange them in form of a circle.
    Sector angle must be 120 degree for all the three Buttons.Please help!

    ...hm, okay, i put something together... keep in mind it's pretty late... and maybe i should have let that last bottle of wine be, but anyway, perhaps this will help:
    public class TestFrame extends JFrame {
        private JPanel _cPane;
        private Ellipse2D _oval=new Ellipse2D.Double(40,40,100,100);
        int[] xs={90,90,133,140,140};
        int[] ys={40,90,115,115,40};
        private Area _sector1=new Area(new Polygon(new int[]{90,90,133,140,140}, new int[]{40,90,115,115,40}, 5));
        private Area _sector2=new Area(new Polygon(new int[]{90,90,47,40,40}, new int[]{40,90,115,115,40}, 5));
        private Area _sector3=new Area(new Polygon(new int[]{40,47,90,133,140}, new int[]{140,115,90,115,140}, 5));
        private int _inside=0;
        public static void main(String[] args) {
            new TestFrame();
        public TestFrame() {
            super();
            init();
            initFrame();
        private void init() {
            Area rhs = new Area(_oval);
            _sector1.intersect(rhs);
            _sector2.intersect(rhs);
            _sector3.intersect(rhs);
            _cPane=new JPanel(){
                public void paint(Graphics g) {
                    super.paint(g);
                    Graphics2D g2=(Graphics2D)g;
                    g2.setColor(Color.RED);
                    g2.fill(_oval);
                    g2.setColor(Color.BLUE);
                    g2.draw(_sector1);
                    g2.draw(_sector2);
                    g2.draw(_sector3);
                    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,0.5f));
                    g2.setColor(Color.yellow);
                    if (_inside==1)
                        g2.fill(_sector1);
                    else if (_inside==2)
                        g2.fill(_sector2);
                    else if (_inside==3)
                        g2.fill(_sector3);
            _cPane.addMouseMotionListener(new MouseMotionAdapter(){
                public void mouseMoved(MouseEvent e) {
                    Point point = e.getPoint();
                    if (_sector1.contains(point))
                        _inside=1;
                    else if (_sector2.contains(point))
                        _inside=2;
                    else if (_sector3.contains(point))
                        _inside=3;
                    else _inside=0;
                    repaint();
        private void initFrame() {
            setSize(200, 200);
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            setLocation((screenSize.width - getWidth()) / 2, (screenSize.height - getHeight()) / 2);
            setContentPane(_cPane);
            setVisible(true);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }It's not as bad as it seem, although i hardcoded the coordinates (you should not, but as i said, it's pretty late already). The example above will highlight a sector as soon as you move your mouse above it - i guess you won't have trouble handling a click accordingly, i just thought this would be a bit more visible.

  • Why button can not call its script?

    I did very simple work: open Director MX 2004, click the
    button icon on the Tool Palette, and draw a button on the stage.
    Right click it and menu appear. Click "Scripts..." and script
    window opens. MouseUp() event function is there already. Write
    something in mouseUp(). Anything is OK. Put a breakpoint on some
    line.
    OK, then click menu Control-Play to run the movie. Click the
    button on stage. At this time, it ought to be broken on the
    breakpoint. But it didn't. The mouseUp() was not called!
    On the other hand, other controls are OK, such as Text,
    Shape, etc.. Only botton can not call its script. Is it a bug of
    Director MX 2004?

    It may be that you're creating flash component buttons. Try
    setting the tool palette to 'classic' mode (the dropdown at the top
    of the tool palette). The buttons you create once you've done this
    will be native director buttons.
    I've not really used flash component elements much at all so
    I can't offer advice as to why the mouseup isn't working with it.
    - Ben

  • Drawing pie chart in applet

    Hi,
    The following is an applet I've written as an assignment in school. The applet runs well on appletviewer (here I mean drawing the pie chart). But when I run it on my browser, the pie chart is not drawn. Hope you can help me. Thanks in advance.
    import java.applet.*;import java.text.*;import java.awt.*;import java.awt.event.*;import java.awt.Graphics;public class x2 extends Applet implements ActionListener {               private Button draw,reset;        private TextField thigh,tmedium,tlow,tno;     private Label banner,l1, l2, l3, l4;     double rhigh,rmedium,rlow,rno;     double high, medium, low, no, total, high2=0, medium2=0, low2=0, no2=0,low3, no3;     String something="";          public void paint(Graphics g){     setBackground(Color.white);               if(something=="in"){     try {               rhigh=Double.parseDouble(thigh.getText());     rmedium=Double.parseDouble(tmedium.getText());     rlow=Double.parseDouble(tlow.getText());     rno=Double.parseDouble(tno.getText());     } catch (NumberFormatException nfe) {     }     total=rhigh+rmedium+rlow+rno; high=(rhigh/total)*100; medium=(rmedium/total)*100; low=(rlow/total)*100; no=(rno/total)*100; high2=high*360/100;     medium2=medium*360/100;     low2=low*360/100;     no2=no*360/100;          low3=high2+medium2;     no3=low3+low2;               g.setColor(Color.red);     g.fillArc(100,100,200,200,0,(int)high2);     g.setColor(Color.blue);     g.fillArc(100,100,200,200,(int)high2,(int)medium2);     g.setColor(Color.green);     g.fillArc(100,100,200,200,(int)low3,(int)low2);     g.setColor(Color.pink);     g.fillArc(100,100,200,200,(int)no3,(int)no2);     }     }          public void init(){          draw=new Button("Draw pie chart");     reset=new Button("Reset");     thigh=new TextField("",10);     tmedium=new TextField("",10);     tlow=new TextField("",10);     tno=new TextField("",10);     l1=new Label("High Risk  :$");     l2=new Label("Medium Risk:$");     l3=new Label("Low Risk   :$");     l4=new Label("No Risk    :$");     banner=new Label("Welcome");           add(banner);           add(l1);     add(thigh);          add(l2);     add(tmedium);     add(l3);     add(tlow);     add(l4);     add(tno);                         add(draw);     add(reset);                   draw.setActionCommand("Draw");     draw.addActionListener(this);        reset.setActionCommand("Reset");     reset.addActionListener(this);     }          public void actionPerformed(ActionEvent e){          if(e.getActionCommand() == "Draw") {               something="in";               repaint();                    } else if(e.getActionCommand()== "Reset") {               something="";               thigh.setText("");               tmedium.setText("");               tlow.setText("");               tno.setText("");               repaint();          }     }}

    <code>
    import java.applet.*;
    import java.text.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Graphics;
    public class x2 extends Applet implements ActionListener {
         private Button draw, reset;
         private TextField thigh, tmedium, tlow, tno;
         private Label banner, l1, l2, l3, l4;
         double rhigh,rmedium,rlow,rno;
         double high, medium, low, no, total, high2=0, medium2=0, low2=0, no2=0,low3, no3;
         String something="";
         public void paint(Graphics g) {
              setBackground(Color.white);
              if(something=="in"){
                   try {
                        rhigh=Double.parseDouble(thigh.getText());
                        rmedium=Double.parseDouble(tmedium.getText());
                        rlow=Double.parseDouble(tlow.getText());
                        rno=Double.parseDouble(tno.getText());
                   catch (NumberFormatException nfe) { }
                   total=rhigh+rmedium+rlow+rno; high=(rhigh/total)*100;
                   medium=(rmedium/total)*100;
                   low=(rlow/total)*100;
                   no=(rno/total)*100;
                   high2=high*360/100;
                   medium2=medium*360/100;
                   low2=low*360/100;
                   no2=no*360/100;
                   low3=high2+medium2;
                   no3=low3+low2;
                   g.setColor(Color.red);
                   g.fillArc(100,100,200,200,0,(int)high2);
                   g.setColor(Color.blue);
                   g.fillArc(100,100,200,200,(int)high2,(int)medium2);
                   g.setColor(Color.green);
                   g.fillArc(100,100,200,200,(int)low3,(int)low2);
                   g.setColor(Color.pink);
                   g.fillArc(100,100,200,200,(int)no3,(int)no2);
         public void init(){
              draw=new Button("Draw pie chart");
              reset=new Button("Reset");
              thigh=new TextField("",10);
              tmedium=new TextField("",10);
              tlow=new TextField("",10);
              tno=new TextField("",10);
              l1=new Label("High Risk :$");
              l2=new Label("Medium Risk:$");
              l3=new Label("Low Risk :$");
              l4=new Label("No Risk :$");
              banner=new Label("Welcome");
              add(banner);
              add(l1);
              add(thigh);
              add(l2);
              add(tmedium);
              add(l3);
              add(tlow);
              add(l4);
              add(tno);
              add(draw);
              add(reset);
              draw.setActionCommand("Draw");
              draw.addActionListener(this);
              reset.setActionCommand("Reset");
              reset.addActionListener(this);
         public void actionPerformed(ActionEvent e) {
              if(e.getActionCommand() == "Draw") {
                   something="in";
                   repaint();
              } else if(e.getActionCommand()== "Reset") {
                   something="";
                   thigh.setText("");
                   tmedium.setText("");
                   tlow.setText("");
                   tno.setText("");
                   repaint();
    </code>

Maybe you are looking for

  • Hierarchy selection tab missing in infopackage

    Hi Experts, i am looking how to load multiple hierarchies to Bi so inorder to know available hierarchies from OLTP in hierarchy selection tab in infopackage which was not available at all. i had only data selection tab.i am using version Bi 7.0 how c

  • How can I cancel a purchase, how can I cancel a purchase

    I bought an item that I thought was a film I bought the soundtrack by mistake how do I go abaout returning the soundtrack and getting the film?

  • PDF's from 2002 and 2003 are blank.

    I am using Adobe Reader 7 and Adobe Standard version 7.0.9 on a Dell D620 running XP SP2. When I try to open a pdf from 2002, it is blank. The file has size 50kb, but nothing in it. I have uninstalled and reinstalled Adobe, same thing. Can someone he

  • How do I import GPS information for all of my images from Bridge into Lightroom 5.3?

    After importing my images into Lightroom 5.3, I discovered that the GPS location data was imported for some images, but not for others.  When I checked the metadata files for the same images in Bridge, the location data was present for all of my rece

  • User-exit and FV45KFKD_VBKD_FUELLEN_HVBKD

    Hello, we change the payment term in user-exit MV45AFZZ (FORM userexit_move_field_to_vbap) Everythink worked fine, until we implement the new patch with the routine "FV45KFKD_VBKD_FUELLEN_HVBKD" If we try to create a sales order in relevance to a quo