How to set the width and height of the displayed image in a button

How can I please specify the size of the image that I display in a button which I create dynamically.
            HtmlCommandButton button = new HtmlCommandButton();
            button.setImage(image.getUrl());Thanks in advance
Message was edited by:
WebService

Follow some CSS tutorials to learn more about it.
Here is a page with some links: http://www.google.com/search?q=css+tutorial
Then you're doing or interpreting something wrong. The methods are actually there. I can play with them in my playground and they are also described in the the HtmlCommandButton API: http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/component/html/HtmlCommandButton.html

Similar Messages

  • How to set field width and height at runtime programatically?

    Hi all,
    I want to set the width and height of a report field by reading its values from the database table.
    Is it possible in Oracle reports?
    How to achieve this in Oracle reports 10g?
    Any help will be highly appreciated.
    Thanks .... Best Regards
    Bilal

    You cannot give it a specific value. During design you can set Horizontal and Vertical Elasticity properties to Variable, so the items are automatically scaled when running the report.

  • How to set the a  graphic ( 3 radio buttons ) in the report ?

    Hi  Exports,
    1.  How to set the a  graphic ( 3 radio buttons ) in the report ?
    Acutely  I  want to  fetch the record from MCHB-CLABS and MCHB-CSPEM , if the data read from MCHB-CLABS will show the green light otherwise if read from MCHB-CSPEM, it will show red light.
    (e.g :  if syntax error in report  it is showing red light signal , like that how to set in report program)
    Thanking you.
    Subash

    Hi,
    In your internal table declaration, include yet another field for lights..
    DATA: begin of itab,
               lights type light,
              end of itab.
    DATA: GV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    GV_LAYOUT-LIGHTS_FIELDNAME = 'LIGHTS'.
    Use the GV_LAYOUT in your FM to display the ALV.
    IS_LAYOUT                         = GV_LAYOUT
    If itab-lights = 1 => Error
      itab-lights = 3 => Success
      itab-lights =2 => Warning

  • Setting canvas width and height objectdraw

    I would like to kno how to set the window height and width so users cannot resize it. I would like the methods to be out of the library objectdraw
    Thanks

    motherboarddude wrote:
    [http://eventfuljava.cs.williams.edu/library/objectdrawJavadocV1.1.2/index.html] no clue
    What does 'no clue' mean? That you have no clue if it is J2SE? The answer is no, it is not J2SE (or even a Sun standard extension like JavaHelp or JOGL). We know nothing about that API and can provide no help with it.
    (And in future, try to make your replies specific enough that people do not have to 'guess' what you mean. That becomes irritating, very quickly.)
    OTOH a brief perusal of the JavaDocs suggests the API has no component that extends Frame or JFrame, so the answer to your request that it use one of the methods of your custom library is "No, it provides no functionality to restrict the size of the frame the user is offered - since that frame will come from the J2SE".
    Of course, if you simply wanted to ensure the drawing canvas is never resized, simply add it as a 'no args' element in a GridBagLayout with no other GUI components in it. If the GBL is used as described, the component will be centered within it. Add a JScrollPane to the component in case the user shrinks the frame smaller than the preferred size of the drawing area. In Java 1.6+, call setMinimumSize() after packing, and you can afford to lose the scroll pane.

  • Java returning incorrect values for width and height of a Tiff image

    I have some TIFF images (sorry, I cannot post them b/c of there confidential nature) that are returning the incorrect values for the width and height. I am using Image.getWidth(null) and have tried the relevant methods from BufferedImage. When I open the same files in external viewers (Irfanview, MS Office Document Imaging) they look fine and report the "correct" dimensions. When I re-save the files, my code works fine. Obviously, there is something wrong with the files, but why would the Java code fail and not the external viewers? Is there some way I can detect file problems?
    Here is the code, the relevant section is in the print() routine.
    * ImagePrinter.java
    * Created on Feb 27, 2008
    * Created by tso1207
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.print.PageFormat;
    import java.awt.print.PrinterException;
    import java.io.File;
    import java.io.IOException;
    import java.util.Iterator;
    import javax.imageio.ImageIO;
    import javax.imageio.ImageReader;
    import javax.imageio.stream.FileImageInputStream;
    import javax.imageio.stream.ImageInputStream;
    import com.shelter.io.FileTypeIdentifier;
    public class ImagePrinter extends FilePrintable
       private final ImageReader _reader;
       private final int _pageCount;
       private final boolean _isTiff;
       //for speed we will hold current page info in memory
       private Image _image = null;
       private int _imgWidth = 0;
       private int _imgHeight = 0;
       private int _currentPage = -1;
       public ImagePrinter(File imageFile) throws IOException
          super(imageFile);
          ImageInputStream fis = new FileImageInputStream(getFile());
          Iterator readerIter = ImageIO.getImageReaders(fis);
          ImageReader reader = null;
          while (readerIter.hasNext())
             reader = (ImageReader) readerIter.next();
          reader.setInput(fis);
          _reader = reader;
          int pageCount = 1;
          String mimeType = FileTypeIdentifier.getMimeType(imageFile, true);
          if (mimeType.equalsIgnoreCase("image/tiff"))
             _isTiff = true;
             pageCount = reader.getNumImages(true);
          else
             _isTiff = false;
          _pageCount = pageCount;
       public int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
          throws java.awt.print.PrinterException
          int drawX = 0, drawY = 0;
          double scaleRatio = 1;
          if (getCurrentPage() != (pageIndex - getPageOffset()))
             try
                setCurrentPage(pageIndex - getPageOffset());
                setImage(_reader.read(getCurrentPage()));
                setImgWidth(getImage().getWidth(null));
                setImgHeight(getImage().getHeight(null));
             catch (IndexOutOfBoundsException e)
                return NO_SUCH_PAGE;
             catch (IOException e)
                throw new PrinterException(e.getLocalizedMessage());
             if (!_isTiff && getImgWidth() > getImgHeight())
                pf.setOrientation(PageFormat.LANDSCAPE);
             else
                pf.setOrientation(PageFormat.PORTRAIT);
          Graphics2D g2 = (Graphics2D) g;
          g2.translate(pf.getImageableX(), pf.getImageableY());
          g2.setClip(0, 0, (int) pf.getImageableWidth(), (int) pf.getImageableHeight());
          scaleRatio =
             (double) ((getImgWidth() > getImgHeight())
                ? (pf.getImageableWidth() / getImgWidth())
                : (pf.getImageableHeight() / getImgHeight()));
          //check the scale ratio to make sure that we will not write something off the page
          if ((getImgWidth() * scaleRatio) > pf.getImageableWidth())
             scaleRatio = (pf.getImageableWidth() / getImgWidth());
          else if ((getImgHeight() * scaleRatio) > pf.getImageableHeight())
             scaleRatio = (pf.getImageableHeight() / getImgHeight());
          int drawWidth = getImgWidth();
          int drawHeight = getImgHeight();
          //center image
          if (scaleRatio < 1)
             drawX = (int) ((pf.getImageableWidth() - (getImgWidth() * scaleRatio)) / 2);
             drawY = (int) ((pf.getImageableHeight() - (getImgHeight() * scaleRatio)) / 2);
             drawWidth = (int) (getImgWidth() * scaleRatio);
             drawHeight = (int) (getImgHeight() * scaleRatio);
          else
             drawX = (int) (pf.getImageableWidth() - getImgWidth()) / 2;
             drawY = (int) (pf.getImageableHeight() - getImgHeight()) / 2;
          g2.drawImage(getImage(), drawX, drawY, drawWidth, drawHeight, null);
          g2.dispose();
          return PAGE_EXISTS;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since version XXX
        * @return
       public int getPageCount()
          return _pageCount;
       public void destroy()
          setImage(null);
          try
             _reader.reset();
             _reader.dispose();
          catch (Exception e)
          System.gc();
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public Image getImage()
          return _image;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getImgHeight()
          return _imgHeight;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getImgWidth()
          return _imgWidth;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param image
       public void setImage(Image image)
          _image = image;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setImgHeight(int i)
          _imgHeight = i;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setImgWidth(int i)
          _imgWidth = i;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getCurrentPage()
          return _currentPage;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setCurrentPage(int i)
          _currentPage = i;
    }Edited by: jloyd01 on Jul 3, 2008 8:26 AM

    Figured it out. The files have a different vertical and horizontal resolutions. In this case the horizontal resolution is 200 DPI and the vertical is 100 DPI. The imgage width and height values are based on those resolution values. I wrote a section of code to take care of the problem (at least for TIFF 6.0)
       private void setPageSize(int pageNum) throws IOException
          IIOMetadata imageMetadata = _reader.getImageMetadata(pageNum);
          //Get the IFD (Image File Directory) which is the root of all the tags
          //for this image. From here we can get all the tags in the image.
          TIFFDirectory ifd = TIFFDirectory.createFromMetadata(imageMetadata);
          double xPixles = ifd.getTIFFField(256).getAsDouble(0);
          double yPixles = ifd.getTIFFField(257).getAsDouble(0);
          double xRes = ifd.getTIFFField(282).getAsDouble(0);
          double yres = ifd.getTIFFField(283).getAsDouble(0);
          int resUnits = ifd.getTIFFField(296).getAsInt(0);
          double imageWidth = xPixles / xRes;
          double imageHeight = yPixles / yres;
          //if units are in CM convert ot inches
          if (resUnits == 3)
             imageWidth = imageWidth * 0.3937;
             imageHeight = imageHeight * 0.3937;
          //convert to pixles in 72 DPI
          imageWidth = imageWidth * 72;
          imageHeight = imageHeight * 72;
          setImgWidth((int) Math.round(imageWidth));
          setImgHeight((int) Math.round(imageHeight));
          setImgAspectRatio(imageWidth / imageHeight);
       }

  • How to set the DISPLAY variable to run admsi.pl?

    Dear Experts,
    I'm trying to patch Oracle apps R12 using admsi.pl.
    hostname: black
    APPS db: VIS
    But I keep getting the error:
    Please set the DISPLAY variable and re-run this script
    This is what I did:
    VIS database and listener are already running.
    login to the linux server as unix user: applmgr
    cd /oapps/applmgr/VIS/apps/apps_st/appl/
    . APPSVIS_black.env
    cd /oapps/applmgr/VIS/apps/apps_st/appl/ad/12.0.0/bin/
    admsi.pl
    Invoking Oracle Patch Application Assistant....
    Please set the DISPLAY variable and re-run this script
    huh ?
    set | grep -i "display"
    DISPLAY=:0.0
    set | wc
    435 486 25235
    I notice that there are 36 .env files!
    For applmgr alone!!
    find /oapps/applmgr/ -type f -name "*.env" | wc
    36 36 2626
    For oracle, there are another 7 .env files!
    find /oapps/oracle/ -type f -name "*.env" | wc
    7 7 513
    Did I get the environment (env) file correct?
    Or do I need to run a few more env first?
    If so, which ones?
    What would the order of operations be?
    sqldeveloper has given me problems with Display sometimes.
    But even sqldeveloper works fine.
    What is the secret to get admsi.pl to run in the normal manner?
    Thank a lot!

    Thanks a lot, that worked! So the perl script was wrong.
    In the meantime, I had done this, and it seemed to work:
    admsi.pl -debug
    Gathering Information..
    Enter the patch_top : /oappsinstall/update12.1.1/7303030
    Enter the APPS user password:
    Logfile for this session is located at admsi.log
    Generating installation instructions for patch 7303030..
    Updating database....
    install_7303030.html generated successfully
    install_7303030.txt generated successfully
    cat /oapps/applmgr/VIS/apps/apps_st/appl/ad/12.0.0/bin/admsi.log
    Executing begin :value := ad_manual_step_object.is_step_already_done('per_hrglobal','120.2.12010000.1'); end;
    Generating installation instructions for patch 7303030..
    Updating database....
    install_7303030.html generated successfully
    install_7303030.txt generated successfully
    Performing final cleanup..
    Do you think this worked ok?
    Thanks again!

  • How to set the short cut key for buttons

    Hi
    I dont know how to set the short cut keys for the button...can u pls help me out

    Do you mean a short cut key for buttons at client side (web browser)? If yes, you could do it with JavaScript~~~ ^o^

  • How to set the value of an radio button using set_radio_button_property

    I'd like to set the value of an radio button dynamically, depending of the situation.
    (=> the value which the object returns to the radio group)
    Means: the 'radio button value' of my object 'rb_1' shall be 1, in other circumstances 99 and so on.
    Is it possible to set this value at runtime ?

    the problem is as Gerd wrote:
    there are two or more radio buttons in an option group.
    Their value depends on the text objext t_field.
    If t_field is "car" the value of radio button 1 shall be 75, button 2: 90 and button 3 115.
    if t_field is "bus" the value of radio button 1 shall be 250, button 2: 275 and button 3 300 and so on.
    My problem is to set the value of the radio buttons at runtime after choosing/typing the value of the text field t_field.
    Message was edited by:
    PatrickM

  • How to set the display size of the PDF - in percent?

    Hi, I wonder if anyone knows if it is possible to set
    the display size of the PDF document, so that it always
    shows in, let´s say 100%, in the viewers browser window?
    Much grateful for any help!
    /Anni

    In Acrobat, under Document Properties (Ctrl+D), you can edit the Initial
    View settings, including the zoom level.

  • How to set the display ratio of master and detail view

    Currently, I use SplitApp that contain the master and detail view. And I would like to show the master view on the left half and detail view on the right half. Is there any proper way to adjust this?
    Thank you in advance.

    You can set the width ratio by adding css. Check this,
    http://jsbin.com/dakir/1

  • Please guide how to set the mask image

    Hi All,
    i want to set camera images as a background of greeting image( those already in .png formate with white color background ), so when i am trying with following code in my app it is showing the color image in black and white color .
    Please guide me how it is work.
    I am using following code
    -(UIImage)maskImage:(UIImage)image withMask:(UIImage*)mask {
    CGImageRef imgRef = image CGImage;
    CGImageRef maskRef = mask CGImage;
    CGImageRef actualMask = CGImageMaskCreate(CGImageGetWidth(maskRef),
    CGImageGetHeight(maskRef),
    CGImageGetBitsPerComponent(maskRef),
    CGImageGetBitsPerPixel(maskRef),
    CGImageGetBytesPerRow(maskRef),
    CGImageGetDataProvider(maskRef), NULL, false);
    CGImageRef masked = CGImageCreateWithMask(imgRef, actualMask);
    return UIImage imageWithCGImage:masked;
    }

    Hi,
    Thank you for the reply.
    My problem is related to Oracle Forms. So I go on Help ->Diagnostics ->custom code -> personalize. There I choose my field and PROMPT_TEXT property. But I do not know how to set it properly, so that it allows e.g. only numbers.
    Please help me to solve this issue.
    Thank you

  • How to set the "display name" of an customized property

    Hi,
    I've created a customzied property of KM file with KM API, and display it in KM navigation iview. It is ok, except the Column head show the technical name of the property. But what i want is some specify display name and even can support multi language, how this can be done?? Any hint?? Thanks!!
    Best Regards,
    Xiaoming Yang

    you must change the collection render and the resource render in order to show the properties you want.
    For translation propourses check this link
    http://help.sap.com/saphelp_nw04/helpdata/en/75/e000861cb8ad4b8e4f19dd6416346d/frameset.htm
    You must deal with resource bundle

  • How to set the display color of string?

    I want to display several lines of text string with different colors. Does anybody know how to do that?
    a simple example would be great.
    thanks in advance

    depends on how you go about it ...
    if you use labels you can use the labels setForeground(Color c); method.
    you also do this in the paint() method,
    using setPaint() , and the drawString() method og Graphics instance

  • How to set the display value of subtotal

    Hi,
    I'd like to ask a problem,
    I'm using BIEE11.1.1.6, I created a table in BIP layout,there are 3 column,
    YEAR-------COMPANY----------SALES
    2009--------A----------------------100
    2009--------B----------------------100
    2010--------A----------------------100
    2010--------B----------------------100
    2010--------C----------------------100
    I want to add a subtotal row,like
    YEAR-------COMPANY----------SALES
    2009--------A----------------------100
    2009--------B----------------------100
    2009 total------------------------200
    2010--------A----------------------100
    2010--------B----------------------100
    2010--------C----------------------100
    2010 total------------------------300
    by default, it is
    YEAR-------COMPANY----------SALES
    2009--------A----------------------100
    2009--------B----------------------100
    ---------------------------------------200
    2010--------A----------------------100
    2010--------B----------------------100
    2010--------C----------------------100
    ---------------------------------------300
    how can it show the YEAR value||' total' ? like showing '2009 total'?
    thank you!

    Hi Christian,
    Have a look at this thread Re: Default the Date Picker to Today
    It covers this issue in detail.
    Regards
    Paul

  • Changing video frame width and height...

    In Adobe Premiere Pro CS 5 I cannot seem to produce (output) a video larger than frame width: 720 and frame height: 480. The video is recorded in full HD 1920 x 1080p but after editing and adding effects in Premiere Pro CS5, the video changes to only 720 x 480.
    1) Where are the settings in Premiere Pro changed to produce a video size of frame width: 1280 and frame height: 720 or even frame width: 1920 and height: 1080?
    2) Is it possible to produce a video at 1920 x 1080 or is 720 x 480 the max?
    Your time is appreciated.

    John,
    For now I will be using the videos for youtube promos and viewing on desktops but if I were, I would more likely output to DVD.  From what I understand it doesnt matter if I output 720 x 480 or 1920 x 1080 if it's going on youtube, however I would like the best quality video possible given that these videos wont be very long. (Elaborate on this if you can clear some stuff up for me).
    Also, I may have mislead readers with my thread title "Changing video frame width and height."  I guess a more accurate title would be "How to Change frame width and height of Video Output."  Don't get me wrong 720 x 480 looks great on my desktop, but I would also like to output one at 1280 x 720?

Maybe you are looking for

  • Creative Cloud is suddenely a trial version?

    Really? What is Adobe doing? Seems as tho' others are experiencing the same issue. MAC and PC.... [groan] First they launch updates that disable 3D in Ps CS6 EXT and now I'm getting these alerts on other CC apps as well (Ai and Id) to register and bu

  • Uploading a PDF "within" my Captivate project

    Hi, I would like for learners to have the option of clicking an attachments link within my Captivate project so that they can download a file that is relevant to my course WHILE they are watching the video.  Can Captivate do this?  I've used a simila

  • Automation in Crystal Report XI

    Post Author: jchan CA Forum: General Hi all, I am really new to crystal report XI; hopefully someone can point me in the right direction; I currently have 8 report written in crystal report that i have run weekly; i was wonder is there anyway i can a

  • Instant client installation unavailable in ODBC data sources

    I'm trying to install instant client to enable MS Excel to access an Oracle database. OS is Windows 7. After installing instant client plus the odbc package, I can't see a new entry in the odbc data sources - only the standard Microsoft sources (Exce

  • Spry Menus on Spry Tabbed Panels?

    Hi, I'm designing a site that has major tabs at the top, each of which takes the visitor to an appropriate section of the site... each with a default section overview page and a horizontal nav menu that's appropriate for that section. (This design is