How to display a jpeg in corner of a frame or change default bg colour?

I am having problems of a different sort regarding display of an image in a frame. I wish to display a jpeg in a frame such that it sits exactly in the top left corner. As it is, it always sits a few pixels left and down from the corner, leaving an annoying white border. The only way to get rid of the border is to create an individual html file for every image so that the bg colour can be set to match the rest of the page - but surely there is a way to either change the default bg colour in the users browser when viewing the site or to sit the image dead in the corner so that there is no need.
It's driving me nuts!

Hi Greystar69 ,
Try the following code. this code helps to understand easily how to bring it.
acknowledge me
import java.awt.* ;
import javax.swing.* ;
public class FrameBg extends Frame {
     private Image img ;
     public FrameBg() {
          super( "Test" ) ;
          img = new ImageIcon( "D:/images/rose.png" ).getImage() ;
          if( img == null ) {
               System.out.println( "Image is null" );
               System.exit( 0 ) ;
          setLayout( new FlowLayout() ) ;
          add( new JButton( "How   is   it?" ) ) ;
          add( new Button( "Is   it    ok?" ) ) ;
          setSize( 400 , 300 ) ;
          setVisible( true ) ;
     public void drawBackground( Graphics g ) {
          int w = getWidth() ;
          int h = getHeight() ;
          int iw = img.getWidth( this ) ;
          int ih = img.getHeight( this ) ;
          for( int i = 0 ; i < w ; i+=iw ) {
               for( int j = 0 ; j < h ; j+= ih ) {
                    g.drawImage( img , i , j , this ) ;
     public void paint( Graphics g ) {
          drawBackground( g ) ;
          super.paint( g ) ;
     public static void main(String[] args) {
          new FrameBg() ;
}

Similar Messages

  • How do you change default greyscale colouring of graphs in illustrator CS4

    I've been trying to format graphs in illustrator CS4 and can't figure out how to change the defualt colour from Greyscale to be a swatch of my own choice without having to change it manually once the data is entered.
    Is there a way of changing the settings? This is driving me nuts!!!

    You really can't but you can recolor the chart using a color group you define.
    Describing in written words how the recolor art feature  works is not practical for me so it is by a movie
    http://mysite.verizon.net/wzphoto/recolor.mov
    BTW if you want the colors to be the value of one color just make a color group of one color and apply it or choose a one color job from the drop down.
    Like this

  • How to display uploaded jpeg in jsp

    hi all,
    i am uploading image(jpeg) using FormFile in ..............
    then i am trying to display into the jsp but its display bytes only...........
    my code is as below
    jsp
    <html:form action="/viewImage.do" method="post"     enctype="multipart/form-data">
         <table cellpadding="0" cellspacing="0" border="0" summary="Image table">
              <tr>
                   <td align="right">Image </td>
                   <td align="left">
                        <html:file property="image" />
                   </td>
              </tr>
              <tr>
                   <td align="center" colspan="2">
                        <html:submit property="saveImage">Upload Image</html:submit>
                   </td>
              </tr>
    </table>
    </html:form>
    ------------------------my action is
    public void disImage(ActionMapping mapping,
                   ActionForm form, HttpServletRequest request,
                   HttpServletResponse response) throws Exception {
              CompanyImageForm companyImageForm = (CompanyImageForm)form;
              FormFile myFile = companyImageForm.getImage();
         String contentType = myFile.getContentType();
         String fileName = myFile.getFileName();
         int fileSize = myFile.getFileSize();
         byte[] fileData = myFile.getFileData();
    InputStream in = new ByteArrayInputStream(fileData);
         BufferedImage image=javax.imageio.ImageIO.read(in);
    response.setContentType(contentType);
    OutputStream sos = response.getOutputStream();
    ImageIO.write(image,"jpeg",sos);
    }

    Well here is an idea for you...
    1).Upload a File.Now this would be associated with an object like FileItem or FormFile whatsoever implementation we are using make sure the View Object we are using for this implementation is Serializable.
    2).Save the View Object (Form Bean) under the scope of session and forward/redirect it to a JSP.
    3).In the redirected/fprward JSP use <img> tag or equivalent framework tag and make sure you refer the src to a dedicated ImageServlet / Backing Bean(FormAction) Action or etc as per URL settings you are using.
    4).Use the logic which my fellow poster Balus has asked you to apply.
    Hope that might give you some idea.
    REGARDS,
    RaHuL

  • HOW TO DISPLAY VIDEO PODCAST ARTWORK NOT VIDEO FIRST FRAME

    How do I get the photo for my video podcast to display? Feed: http://drcraigjohnson.net/podcasts/video/podcast.xml I only see the first frame of the video in cover flow. Code validates. The image is 600 x 600 per iTune specs, but testing with 300 x 300 didn't help. Thank you!

    The coverflow art equals the album coverart. That art MUST be embedded to show. It doesn't matter if you are actually listed in the iTunes store or not. Now the picture that shows in the store along with website info, customer reviews, etc. is pulled from the iTunes image tags (<itunes:image href="http://yourpictureURL.jpg" /> within your podcast xml file.
    I found the following link within the podcast maker forum with more info from a forum moderator: http://homepage.mac.com/rfwilmut/notes/faq.html#coverart
    BTW when a picture is embedded (whether using iTunes to embed or something else), the actual image, NOT a link to the image is "built into" the file whether mp3 audio or m4v video. I did extensive tests embedding a 50k picture and saw the file's size increase substantially, though not exactly matching the photo size.
    Embedding solved my video coverflow picture issue too. Changing/uploading a new image to your server will NOT change the picture shown in album coverart. Thus your "channel" can have a changeable image (the one in the iTunes tag) but each episode can have its own logo/album art.

  • How to display a alv using in a html frame?

    Hi,
      Is it possible to show a ALV grid in a html frame? Please suggest. Thanks in advance.

    hi,
    Refer this links, it will be helpful to you...
    https://wiki.sdn.sap.com/wiki/display/ABAP/ALVeasytutorial
    https://wiki.sdn.sap.com/wiki/display/ABAP/100%20abap%20questions
    https://wiki.sdn.sap.com/wiki/display/ABAP/Types%20of%20Reports
    Regards,
    Ahamed.

  • How to display the actual reading alone the dot and conditional change the color of the dot/figure if it is over / below an alert figure

    Hi,
    Please help on how to achive the subjected... Thanks

    Hi,
    You have to explain your problem clearly with as much details as possible including the version of the SQL you are using so that everyone here can understand. From the title of your post it looks like that you want to change the color of the data series
    marker (the dot in the picture above) in a SSRS chart.
    If I have understood you correctly then here is how you can do it.
    1. Select the data series properties. Select and right click on the line in the chart in design mode. Then click on "Series Properties" and go to the properties tab for "Markers". Under "Marker Color" drop down select the expression
    and set the expression as shown in the picture. Replace "Field!Qty.Value" with appropriate field and the criteria for the upper and lower bound you want with their respective color.
    2. You can see in the snapshot below that the color of January Month has changed to Red since the qty value is less than 300 as set in the expression above.
    --sIbu

  • How do i set the abilitilty to Maximize a frame and change his Size ?

    to false
    Thanks
    i found it:
    setResizable(false);
    Message was edited by:
    deviance

    depends on the "View" style you have chosen in the Finder. This is "Columns" view 'Tool' location and is selected
    In this View, single clicks Select items. The Sidebar is a top level with the Desktop (folder) selected > a folder therein selected > a  folder within selected > yet another folder within selected > a file selected therein > and finally with the preview of the file displayed
    One could Double click the hilited file to open it here OR click > slight pause > click to edit the filename
    Double clicking folders in this view jumps straight to edit the foldername
    If you want the traditional double-click to open everything you choose you must use one of the other two view tools.
    or
    All the icons in this area ARE single click to open or activate
    is get info and
    is Move to the Trash
    The rest are either Apps or files that you place there by drag and drop from the Finder window lists
    In this case
    iTunes, Grab --------- two TextEdit files, a Macromedia Director 'player' file/miniApp, CalculatorApp, ChessApp
    Some things change... and some things never do!
    CCC

  • How to display jpeg until user click play?

    I am new to Flash 8 and am trying to get up to speed. I have
    a flash video (inside a swf) on a website that displays a blank
    screen until the view presses play. Instead of the blan screen, how
    could I display a jpeg on the screen (via URL) until the user
    presses play, at which point the jpeg dissappears and the movie
    starts.
    I would appreciate anyone who could point me to an example of
    how to do this. Thanks!

    I am new to Flash 8 and am trying to get up to speed. I have
    a flash video (inside a swf) on a website that displays a blank
    screen until the view presses play. Instead of the blan screen, how
    could I display a jpeg on the screen (via URL) until the user
    presses play, at which point the jpeg dissappears and the movie
    starts.
    I would appreciate anyone who could point me to an example of
    how to do this. Thanks!

  • How to display JPEG in JSP w/o IMG tag?

    I have a working application where a jpeg image is ecoded on the server via a JavaBean. The bean is then forwarded to a JSP, which gets the unique jpeg filename from the bean and displays it with an html <IMG> tag. All's fine and well, but I'd like to get away from having lots of image files laying around on the server and just display the image encoded in the current request. I tried creating a custom tag to encode and display the jpeg using the com.sun.image.codec.jpeg.* package in this manner:
    ServletResponse res = pageContext.getResponse();
    OutputStream os = res.getOutputStream();
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
    encoder.encode(imageRef); //-- imageRef is instance of BufferedImage
    and in the JSP:
    html, other tags, etc.
    <graph:image imageRef='<%= imageBean.getImage() %>'/>
    The image displays, but nothing else in the JSP (ie. html, other custom tags). In all other tags I've written, JSPWriter is used for output, but I need an OutputStream for the createJPEGEncoder() method.
    Can anyone tell me if what I want to do is possible? I'm chasing my tail at the moment.
    TIA Mark

    Would this work for you:
    Create the IMG tag in the JSP with the SRC as a servlet.
    Also, add any parameters you may need to tell the servlet what image to send back.
    Something like this:out.print("<IMG SRC=\"/servlet/ImageProducerServlet?WhichImage=");
    out.print("MySpecialImage");
    ...The ImageProducerServlet can be setup to send back the JPEG image file.

  • How to display an image in a window ?

    Hi all,
    Could someone point me to a document that explains (preferably with code samples) how I go about displaying a JPEG image in a window.
    What I'm eventually trying to create is a slideshow, but for now, I just want to add an image to a JFrame and have that display, and even this simple first step is beyond me. There seem to be quite a few different classes to deal with images, but I'm just looking for the simplest one.
    With a view to my future requirements, I will want to be able to dynamically shrink an image so that it fits in the window, as well as cropping images so that the full resolution is displayed, but anything that doesn't fit in the window is chopped off.

    hi,
    how to place an image in the cells of a grid and to drag and drop that image. i have the code to locate the postion of each cell on mouse click. now i want to place an image in particular cell and i want to drag and drop that particular image to other cells of grid.
    is it possible.
    pls give me a suggestion.
    here my code:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class Grid
    public Grid()
    GridPanel gridPanel = new GridPanel();
    CellSelector cellSelector = new CellSelector(gridPanel);
    gridPanel.addMouseListener(cellSelector);
    JFrame f = new JFrame();
    //ImageIcon ii= create ImageIcon("C:/Documents and Settings/sreehari.m/Desktop/new/java //pgm/new");
    //cellSelector.addImageIcon();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(gridPanel);
    f.setSize(400,400);
    f.setLocation(200,200);
    f.setVisible(true);
    public static void main(String[] args)
    new Grid();
    class GridPanel extends JPanel
    double xInc, yInc;
    final int
    GRID_SIZE = 4,
    DRAW = 0,
    FILL = 1,
    PAD = 20;
    int[][] cells;
    public GridPanel()
    initCells();
    protected void paintComponent(Graphics g)
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D)g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
    RenderingHints.VALUE_ANTIALIAS_ON);
    double w = getWidth();
    double h = getHeight();
    xInc = (w - 2*PAD)/GRID_SIZE;
    yInc = (h - 2*PAD)/GRID_SIZE;
    // row lines
    double x1 = PAD, y1 = PAD, x2 = w - PAD, y2 = h - PAD;
    for(int j = 0; j <= GRID_SIZE; j++)
    g2.draw(new Line2D.Double(x1, y1, x2, y1));
    y1 += yInc;
    // col lines
    y1 = PAD;
    for(int j = 0; j <= GRID_SIZE; j++)
    g2.draw(new Line2D.Double(x1, y1, x1, y2));
    x1 += xInc;
    // fill cells
    g2.setPaint(Color.red);
    for(int row = 0; row < cells.length; row++)
    for(int col = 0; col < cells[0].length; col++)
    if(cells[row][col] == FILL)
    x1 = PAD + col * xInc + 1;
    y1 = PAD + row * yInc + 1;
    g2.drawString("("+row+","+col+")" , (int) x1+50, (int)y1+50);
    //g2.drawString("("+Grid("+row+","+col+")+")" , (int) x1+50, (int)y1+50);
    // g2.drawString("("")" , (int) x1+50, (int)y1+50);
    // g2.fill(new Rectangle2D.Double(x1, y1, xInc - 1, yInc - 1));
    public void toggleCellColor(int row, int col)
    int mode = DRAW;
    if(cells[row][col] == DRAW)
    mode = FILL;
    cells[row][col] = mode;
    repaint();
    private void initCells()
    cells = new int[GRID_SIZE][GRID_SIZE];
    for(int row = 0; row < cells.length; row++)
    for(int col = 0; col < cells[0].length; col++)
    cells[row][col] = DRAW;
    class CellSelector extends MouseAdapter
    GridPanel gridPanel;
    public CellSelector(GridPanel gp)
    gridPanel = gp;
    public void mousePressed(MouseEvent e)
    Point p = e.getPoint();
    int col = 0, row = 0;
    double x = gridPanel.PAD + gridPanel.xInc;
    // find column
    for(int j = 0; j < gridPanel.GRID_SIZE; j++)
    if(p.x < x)
    col = j;
    break;
    x += gridPanel.xInc;
    // find row
    double y = gridPanel.PAD + gridPanel.yInc;
    for(int j = 0; j < gridPanel.GRID_SIZE; j++)
    if(p.y < y)
    row = j;
    break;
    y += gridPanel.yInc;
    gridPanel.toggleCellColor(row, col);
    }

  • How to display the index of current desktop when enable multiple spaces

    I was using 10.6 before and used to using Spaces and puts applications into different desktops.
    Now I'm using 10.8 and I know that the Spaces has been integrated into Mission Control.
    The problem is, I can see the current desktop on the top bar in 10.6, but in 10.8 I cannot see it so I usually forget where I am.
    Does anyone know how to display the index of current desktop?

    Does anyone know how to display the index of current desktop?
    Brute force - - I have written the number of the Desktop directly onto the wallpaper picture I am using for each Desktop  (easy to do with Preview).
    All Desktops are using different wallpaper photos, so they are easily recognized by the color scheme, and in the upper left corner is the number.
    Regards
    Léonie

  • How to display BLOB image column with WEB application, JSF, ADF BC

    I looking for a way to display the content from a blob column on a WEB application, JSF, ADF BC
    The blob column contains a JPEG image.
    About the application
    The model contains a viewobject where the blob column attribute (photoimg) type is of type : BlobDomain
    Now I have to create the view to display the content of photoimg inside a JSF-JSP page.
    Any advice ?

    Search is your friend
    How to display the content of a BLOB column in a ADF/BC pages ?
    John

  • Anyone know how to send a jpeg file to Windows via Mail without it being embedded into the receivers email

    The plain text feature in Mail application does not seem to be working. I noticed this when I send jpg attachments to Windows machines, the receiver gets the attached jpg file embedded in their email and they have no way to save the jpg image. This type of behaviour is normal when when sending rich text emails to Windows machines, but selecting plain text used to eliminate this problem in Snow Leopard.
    I have 'always send window-friendly attachemnts' selected.
    I spoke to Apple about this and they say it was designed this way.
    Can you tell me how I can send jpeg images from Lion to Windows machines so that they can save and reomve the file from their email application?

    Perhaps the boolean expression isn't working because it needs to be all caps: YES instead of yes
    In any case, a simple 1 or 0 works just fine for me without -bool:
    The command to disable in-line attachments (all attachments appear as icons)
    defaults write com.apple.mail DisableInlineAttachmentViewing 1
    To command to (re-)enable in-line attachments once disabled (all attachments appear as images or documents displayed in-line)
    defaults write com.apple.mail DisableInlineAttachmentViewing 0
    Also, when composing a new message with an attachment, be certain that 'Send Windows-Friendly Attachments' is checkmarked at the bottom of the new message screen:

  • How to display PSA screen capture on Front Panel

    Any one know how to display screen capture of PSA series specturm analyzer on front panel. I can save the JPEG file in the C drive, but I can't display on the front pannel. Please see my labview code.
    Solved!
    Go to Solution.
    Attachments:
    Capture screen E4446A.vi ‏21 KB
    reading and writing binary number.vi ‏22 KB
    yumg.jpg ‏20 KB

    Do you actually need to save the front panel image?  Or do you want to save a graph of the signal (spectrum) that you acquired?  If the latter will do the trick, you can simply read the waveform over GPIB (or whichever means you control the analyzer) into an array that is plotted to a waveform graph in LabVIEW.  You then save the image of the waveform graph as an image.
    Since you have all the data, you can even save the data which can be viewed later (and not only by LabVIEW).

  • How to display UNICODE characters in a Widget control

    Hi,
    I am working on a widget. Some of the contents (descriptions) are Chinese.
    How to display these Chinese characters in a Widget control. I am currently using Table as the control for this.
    Thanks in advance.
    Regards,
    Ram.

    You don't need to use CIDFonts and CMaps for Cyrillic (though you can). The crucial thing to realise is that displaying Latin1 (that is, English and related text) leaves you in a very simple corner of PDF. Doing anything with other encodings instantly makes a project more complex, perhaps 10 times more complex. Far eastern fonts perhaps 10 times more complex again.
    The principle is the same for all of them. To use any character you need
    1. A font containing that character. PDF has built in fonts containing Latin1, such as Helvetica, but there is no such luxury for other encodings.
    2. The right (license) to embed the font.
    3. The technical ability to embed the font. In many case this isn't just a case of embedding a file as a stream, but also you need to analyse the tables in the font, and sometimes trim or modify them.
    4. An encoding for the font.
    5. Text streams which use character positions in the encoding to show the text.
    Basically you need to read and read and reread the chapter on text, and its references (such as font formats). This will become your constant friend or tormenter for the many months of the project.
    If you don't like the sound of that, or it doesn't make ecomomic sense to do that, there are many PDF libraries which have taken the necessary months or years to do this.

Maybe you are looking for

  • No batches/stocks were found - determination is performed online MFBF

    Hi Gurus, Can anybody please help me why we are getting this message in MFBF. When the user is trying to turn in production for material A in MFBF, and when they hit post with correction in the home screen of MFBF, in the next screen the system gives

  • ABAP-HR performance Doc

    Hi, Does any body has a doc which can guid me to avoid issues regarding coding in ABAP-HR. Thanks in advance. Thanks & Regards,   V.K.

  • Mail only works in fullscreen

    my mail only opens in fullscreen when i try it make it smaller the screen diapers. when i open mail it says its open but nothing comes up on the screen and then i have to enter fullscreen to read my emails

  • Behaviour of post increment/decrement operator

    int i = 1; i = ++i; System.out.println( i ); //output is 2 i = i++; System.out.println( i ); // output is 2, WHY?

  • Unable to uninstall AnyConnect Version 2.5.0217

    I can't uninstall this or upgrade to another version because of missing msi file, also found the anyconnect-win-2.5.0217-pre-deploy-k9.msi file on the internet and cannot uninstall with that either.