How to make an image transparent?

Hi everybody,
I need to build a complex chart in my applet, for this I want at first to create some painted area and then to put a map over it. The map is an image, which consists basically of black lines for state borders, main rivers and lakes on the white background. What I need is to put just these black lines, not the white background which will kill previously painted area.
Can anyone give me an idea?
Thanks,
Alexandre

Here's a class that implements this. I need a "transparent" object that has a big red arrow that I can point at stuff, so it gets its parents context and paints that then paints the red arrow stuff. The only problem with this is that it is not a glass pane. The "transparent" object must be contained in one object so you can only "paint over" one object.
public class KiaTutorialArrow extends Panel
     public static final int WEST = 0, EAST = 1, NORTH = 2, SOUTH = 3;
     private int direction = 0;
     private Polygon arrow;
     //public Color foreground;;
     ////////constructors/////////////////////////////////////
     public KiaTutorialArrow()
          super();
          setSize(40,25);
     ////////////////get and set functions////////////////////
     public int getDirection()
          return direction;
     public void setDirection(int index)
          this.direction = index;
          arrow = null;
          repaint();
     public String getName()
          return super.getName();
     public void setName(String name)
          super.setName(name);
          repaint();
     public Color getBackground()
          return super.getBackground();
     public void setBackground(Color c)
          super.setBackground(c);
          repaint();
     public void paint(Graphics g)
          // TRANSPARENCY IS THE DEFAULT     
          Container c = getParent();
          Graphics graphics = g.create(- getLocation().x, - getLocation().y, c.size().width, c.size().height);
          c.paint(graphics);
          g.setColor(Color.red);
          switch (direction)
               case WEST: drawWest(g); break;
               case EAST: drawEast(g); break;
               case NORTH: drawNorth(g); break;
               case SOUTH: drawSouth(g); break;
               default: return;
     private void drawWest(Graphics g)
          if (arrow == null)
               arrow = new Polygon();
               arrow.addPoint(2,12);
               arrow.addPoint(12,5);
               arrow.addPoint(12,8);
               arrow.addPoint(27,8);
               arrow.addPoint(27,17);
               arrow.addPoint(12,17);
               arrow.addPoint(12,20);
          g.drawPolygon(arrow);
          g.fillPolygon(arrow);
     private void drawEast(Graphics g)
          if (arrow == null)
               arrow = new Polygon();
               arrow.addPoint(7,8);
               arrow.addPoint(22,8);
               arrow.addPoint(22,5);
               arrow.addPoint(32,12);
               arrow.addPoint(22,20);
               arrow.addPoint(22,17);
               arrow.addPoint(7,17);
          g.drawPolygon(arrow);
          g.fillPolygon(arrow);
     private void drawNorth(Graphics g)
          if (arrow == null)
               arrow = new Polygon();
               arrow.addPoint(8,0);
               arrow.addPoint(15,10);
               arrow.addPoint(12,10);
               arrow.addPoint(12,25);
               arrow.addPoint(3,25);
               arrow.addPoint(3,10);
               arrow.addPoint(0,10);
          g.drawPolygon(arrow);
          g.fillPolygon(arrow);
     private void drawSouth(Graphics g)
          if (arrow == null)
               arrow = new Polygon();
               arrow.addPoint(8,25);
               arrow.addPoint(0,15);
               arrow.addPoint(3,15);
               arrow.addPoint(3,0);
               arrow.addPoint(12,0);
               arrow.addPoint(12,15);
               arrow.addPoint(15,15);
          g.drawPolygon(arrow);
          g.fillPolygon(arrow);
}

Similar Messages

  • How to make a completely transparent button in Flash Builder

    I am making a mobile application, and I am wondering how to make a completely transparent button. I've tried using
    <s:Button x="-5" y="0" width="410" height="1504"
                                    skinClass="spark.skins.mobile.TransparentNavigationButtonSkin" click="navigator.pushView(Sun)"/>
    But it still has one line on the side. I need a way to make it completely transparent.
    Thanks,
         8th grade student

    Try this alpha="0.001"
    Also add useHandCursor="true" and buttonMode="true" if you wish to have the hand cursor appear on hover.
    example  x="10" y="10" width="169" height="54" label="Button" alpha="0.001" useHandCursor="true" buttonMode="true" 
    HTH

  • How to make keynote images full screen?

    Question:  how to make keynote images full screen?  I just noticed. after many successful full screen shows with Keynote 09  5.1.1 that I am no longer seeing the show full screen, at 1280, but only using the center part of my macbook pro 13 inch screen (which will mirror just like that on the projection screen, as far as I know).  Did I hit a setting I do not know about to keep the images so small?
      Thanks

    Keynote  >  Preferences  >  Slideshow:    Scale slides to fit display

  • How to make mirror image on officejet pro 8600

    how to make mirror image on officejet pro 8600

    Hi,
    You can not make mirror images with printers but you can print mirror images on printers. This is how to print mirror images on a normal printer:
    http://h10025.www1.hp.com/ewfrf/wc/document?cc=us&dlc=en&docname=bpu02032&lc=en&product=61561
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • How to make slide images with Dreamweaver CS6?

    How to make slide images with Dreamweaver CS6? Please teach me.

    Hello
    in addition to Jon's hint, I'll send you some links to nice sliders (have fun with the different representations ):
    http://sandbox.scriptiny.com/javascript-slideshow/
    http://jquery.malsup.com/cycle/
    http://wowslider.com/best-jquery-slider-crystal-linear-demo.html
    http://www.jcoverflip.com/demo
    http://www.jacksasylum.eu/ContentFlow/
    http://addyosmani.com/blog/jqueryuicoverflow/
    You only need to use the source code to implant these shows there where you want. In my eyes it would be the best that you use first a very new and blank DW file to perform (maybe in LiveView) the one or the other.
    Hans-Günter

  • Anyone know how to make an "Index Transparent" gif

    I have successfully made transparent PNGs and GIFusing an Alpha transparency but now I need to make images which would be the same as ueing fireworks / Photoshop to make a colour transparent. i.e. indexed transparency.
    Does anyone know how to do this.
    My code is as follows :
    // configure all of the parameters
    String text = "ABC abc XYZ xyz ["+ new Date()+"]";
    String font_file = "./tst/Maiandb.TTF";
    font_file = request.getRealPath(font_file);
    float size = 30.0f;
    Color background = Color.white;
    Color color = Color.black;
    Font font = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(font_file));
    font = font.deriveFont(size);
    buffer = new java.awt.image.BufferedImage(1,1,java.awt.image.BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = buffer.createGraphics();
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    java.awt.font.FontRenderContext fc = g2.getFontRenderContext();
    java.awt.geom.Rectangle2D bounds = font.getStringBounds(text,fc);
    // calculate the size of the text
    width = (int) bounds.getWidth();
    height = (int) bounds.getHeight();
    // prepare some output
    buffer = new java.awt.image.BufferedImage(width, height, java.awt.image.BufferedImage.TYPE_INT_ARGB);
    g2 = buffer.createGraphics();
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
    g2.setFont(font);
    // actually do the drawing
    Color transparent = new Color(0, 0, 0, 0);
    g2.setColor(transparent);
    g2.fillRect(0,0,width,height);
    g2.setColor(color);
    g2.setComposite(AlphaComposite.SrcOver);
    g2.drawString(text,0,(int)-bounds.getY());
    File file = new File ("./jsp1/tst/fred1.gif");
    com.gif4j.light.GifImage gifImage = new com.gif4j.light.GifImage();
    com.gif4j.light.GifFrame gifFrame = new com.gif4j.light.GifFrame(buffer);
    gifImage.addGifFrame(gifFrame);
    GifEncoder.encode(gifImage, file);Thanks in advance

    ^^EDIT^^
    System admins updated iMac to OS X Mountain Lion (10.8.4).

  • [iPhone] How to make one color transparent on a UIImage?

    On my iPhone app I have a UIImage instance. I want to get a derived a UIImage that is the result of the first UIImage where one of its colors (e.g. magenta) is made transparent. How can I do this?
    NOTE: I cannot make the color transparent in Photoshop, the UIImage is created on the fly by the user. I need to do the "postprocessing" on the phone itself, after the user is done "drawing" the image.

    jubgb
    I still do not know your version of Premiere Elements and  your computer operating system, but here is a plan that would probably work for Premiere Elements 11, 12/12.1, and 13/13.1 on Windows 7, 8, or 8.1 64 bit.
    But you say that you are starting with a black and white image. If you could start with the color version of the image, I think we have a promising path to have the fake blood appear in color on a black and white image.
    This would be done by applying the Color Pass effect to the color photo version. Color Pass Effect is  found under fx Effects/Image Control/Color Pass.
    Then you would edit the Color Pass effect under Applied Effects Tab/Appied Effects Palette/Color Pass Panel expanded. But I find that the most effective editing of that effect is done using the Setup whose icon appear to the right of the Color Pass Panel.
    Have you used the Color Pass effect before?
    https://helpx.adobe.com/premiere-elements/using/effects-reference.html
    I will offer how to suggestion for its use if interested. As for starting with the black and white, then I need to think about that some more.
    ATR

  • How to make a JPanel transparent? Not able to do it with setOpaque(false)

    Hi all,
    I am writing a code to play a video and then draw some lines on the video. For that first I am playing the video on a visual component and I am trying to overlap a JPanel for drawing the lines. I am able to overlap the JPanel but I am not able to make it transparent. So I am able to draw lines but not able to see the video. So, I want to make the JPanel transparent so that I can see the video also... I am posting my code below
    import javax.media.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import java.lang.Math;
    import javax.media.control.FramePositioningControl;
    import javax.media.protocol.*;
    import javax.swing.*;
    class MPEGPlayer2 extends JFrame implements ActionListener,ControllerListener,ItemListener
         Player player;
         Component vc, cc;
         boolean first = true, loop = false;
         String currentDirectory;
         int mediatime;
         BufferedWriter out;
         FileWriter fos;
         String filename = "";
         Object waitSync = new Object();
         boolean stateTransitionOK = true;
         JButton bn = new JButton("DrawLine");
         MPEGPlayer2 (String title)
              super (title);
              addWindowListener(new WindowAdapter ()
                   public void windowClosing (WindowEvent e)
                            dispose ();
                            public void windowClosed (WindowEvent e)
                         if (player != null)
                         player.close ();
                         System.exit (0);
              Menu m = new Menu ("File");
              MenuItem mi = new MenuItem ("Open...");
              mi.addActionListener (this);
              m.add (mi);
              m.addSeparator ();
              CheckboxMenuItem cbmi = new CheckboxMenuItem ("Loop", false);
              cbmi.addItemListener (this);
              m.add (cbmi);
              m.addSeparator ();
              mi = new MenuItem ("Exit");
              mi.addActionListener (this);
              m.add (mi);
              MenuBar mb = new MenuBar ();
              mb.add (m);
              setMenuBar (mb);
              setSize (500, 500);
              setVisible (true);
         public void actionPerformed (ActionEvent ae)
                        FileDialog fd = new FileDialog (this, "Open File",FileDialog.LOAD);
                        fd.setDirectory (currentDirectory);
                        fd.show ();
                        if (fd.getFile () == null)
                        return;
                        currentDirectory = fd.getDirectory ();
                        try
                             player = Manager.createPlayer (new MediaLocator("file:" +fd.getDirectory () +fd.getFile ()));
                             filename = fd.getFile();
                        catch (Exception exe)
                             System.out.println(exe);
                        if (player == null)
                             System.out.println ("Trouble creating a player.");
                             return;
                        setTitle (fd.getFile ());
                        player.addControllerListener (this);
                        player.prefetch ();
         }// end of action performed
         public void controllerUpdate (ControllerEvent e)
              if (e instanceof EndOfMediaEvent)
                   if (loop)
                        player.setMediaTime (new Time (0));
                        player.start ();
                   return;
              if (e instanceof PrefetchCompleteEvent)
                   player.start ();
                   return;
              if (e instanceof RealizeCompleteEvent)
                   vc = player.getVisualComponent ();
                   if (vc != null)
                        add (vc);
                   cc = player.getControlPanelComponent ();
                   if (cc != null)
                        add (cc, BorderLayout.SOUTH);
                   add(new MyPanel());
                   pack ();
         public void itemStateChanged(ItemEvent ee)
         public static void main (String [] args)
              MPEGPlayer2 mp = new MPEGPlayer2 ("Media Player 2.0");
              System.out.println("111111");
    class MyPanel extends JPanel
         int i=0,j;
         public int xc[]= new int[100];
         public int yc[]= new int[100];
         int a,b,c,d;
         public MyPanel()
              setOpaque(false);
              setBorder(BorderFactory.createLineBorder(Color.black));
              JButton bn = new JButton("DrawLine");
              this.add(bn);
              bn.addActionListener(actionListener);
              setBackground(Color.CYAN);
              addMouseListener(new MouseAdapter()
                             public void mouseClicked(MouseEvent e)
                   saveCoordinates(e.getX(),e.getY());
         ActionListener actionListener = new ActionListener()
              public void actionPerformed(ActionEvent aae)
                        repaint();
         public void saveCoordinates(int x, int y)
                    System.out.println("x-coordinate="+x);
                    System.out.println("y-coordinate="+y);
                    xc=x;
              yc[i]=y;
              System.out.println("i="+i);
              i=i+1;
         public Dimension getPreferredSize()
    return new Dimension(500,500);
         public void paintComponent(Graphics g)
    super.paintComponent(g);
              Graphics2D g2D = (Graphics2D)g;
              //g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
              g2D.setColor(Color.GREEN);
              for (j=0;j<i;j=j+2)
                   g2D.drawLine(xc[j],yc[j],xc[j+1],yc[j+1]);

    camickr wrote:
    "How to Use Layered Panes"
    http://java.sun.com/docs/books/tutorial/uiswing/components/layeredpane.html
    Add your video component to one layer and your non-opaque panel to another layer.Did you try that with JMF? It does not work for me. As I said, the movie seems to draw itself always on top!

  • How to make the images show up on a linked file in Muse?

    I am wondering how to get my images to show up on the linked files in Muse.  Basically, in Muse, I have a page that links to other pages I designed in Dreamweaver.  I put the images in the image folder and when I upload the site, the page links to the Dreamweaver page ok but the images are missing.  This is a vital part of the site.  Any suggestions?

    If you made the pages with Dreamweaver then they should be on your system some place and you could make a "dreamweaver" folder inside your Muse site and upload the pages to that folder using the upload files option... see this thread talks about sound files but almost any file can be imported to muse
    I need a recommendation for a slick way to embed audio
    Another option is to link across to an online resource using the built in muse html editor but that has pit falls because once you link yourself outside the site you also lose some control of the content;
    For an example of this have a look at an old demo page I made http://chec-garry2.businesscatalyst.com/index.html
    When you click on the Brahminy Kite bird you are looking at what used to be called an Iframe but the problem of control is highlighted when you click the Blue Wren and sometimes get pop up adds… I could import the Blue Wren page into my Muse site to fix this issue and in your case that’s a good option but I didn’t because I don’t have copyright over that pages contents and didn’t want to steal someone else’s work.
    p.s. if you have got a demo of the  website/ pages online someplace that would help us see your problem.

  • How to make an Image in Adobe Muse  100% height ?

    100% width, it's ok; but I don't find how to make a 100% height image (wich follows my browser height)?
    I work with adobe Muse CC 2014
    thanks !

    You can use the image as browser fill and then set the position of image such that it remains to its position. This can be used as a workaround for using image as browser height.
    Thanks,
    Sanjit

  • DVD burned on one G4 will not open up on another. How to make an image?

    Hello,
    This is a bit of a desperate problem, I have a dvd that was created of a 1.4 hour program and burned using iDVD3.0.1 on a G4 500 Mhz machine. Once the dvd is created I am able to play it on that computer using dvd player. I am running Tiger on that machine.
    Once I take that dvd over to my G4 1GHz machine also running tiger, the machine will simply not accept the dvd and keep ejecting the dvd; dvd player does not even open up in order for me to look at the video.
    The main purpose of me having to look at the dvd on the G4 1Ghz machine is to copy the dvd. Can you also briefly describe how to make a copy of a video dvd created using iDVD? I believe I have to make an image first. I cannot remember how to do that, please help. Once the image is made how do I copy that image onto a fresh dvd?
    Thanks,
    Vidur

    Hi Vidor
    first:
    I use DVD-R disks
    And Verbatim brand
    second
    iDVD 3.xx doesn't create Disk Images. Neither does iDVD 4
    (if iDVD prior HD/5 You have to add a hack to make this possibly
    named HPfurz and install it)
    Works on iDVD 4 - for iDVD 3 I don't know.
    Test this with Apple DVD-player - OK then burn it with iDVD
    or Toast if You have and don’t want to re-code the movie.
    third
    To make a DVD copy You need
    - a NON copy protected DVD
    - a program that can make it into a Disk Image eg. Roxio Toast™ (costs)
    - a new blanc DVD-R disk
    If Apple Disk Util tool - can make a disk image is out of my knowledg.
    Yours Bengt W

  • How to make opaque white transparent?

    I have a JPEB, black words, hand lettered, on white.
    When I place it into an InDesign doc, on a solid color, the white background, being opaque, covers the solid color.
    How do I make that opaque white into a transparent background? Two manuals do not give me a clue.
    Thanks.

    larry red miller wrote:
    So if I go back to the original .psd file, a transparency option will
    materialize in one of the menus?
    No.. Photoshop transparency is automatically seen in Indesign for .psd files. All you need to make the background transparent in Photoshop.
    larry red miller wrote:
    Well, uhh, that is what I wanted to k now. Where do I find those methods?
    If you Google for "remove background in Photoshop" you will literally find THOUSANDS of tutorials.

  • How to make background image scalable

    I am working on my site and I am constructing it using only
    external CSS. I am looking for a different look than I have
    previously done and want to use an actual image for the back ground
    of one of the DIV containers rather than just a color. My problem
    has been since I want my site to be fluid I need to find a way to
    have the image scale with the container. I could have sworn I saw
    how to change this attribute during some online reading I had done
    but I can not find it. Can anyone here help?
    Dara

    Scaling images is usually a bad thing - they will lose both
    aspect ratio and
    image quality when you do.
    However, if you are willing to suffer these indignities, you
    can place an
    image into a div that is 100% height/width (of whatever the
    <div> tag's
    contaner is), and make the image 100% height/width as well.
    Depending on
    the layout, that could accomplish your goals.
    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
    ==================
    "Dara_BSI" <[email protected]> wrote in
    message
    news:f4vm0n$kei$[email protected]..
    >I am working on my site and I am constructing it using
    only external CSS. I
    >am
    > looking for a different look than I have previously done
    and want to use
    > an
    > actual image for the back ground of one of the DIV
    containers rather than
    > just
    > a color. My problem has been since I want my site to be
    fluid I need to
    > find a
    > way to have the image scale with the container. I could
    have sworn I saw
    > how to
    > change this attribute during some online reading I had
    done but I can not
    > find
    > it. Can anyone here help?
    >
    > Dara
    >

  • How to make background image editable in a template

    I have built a template and would like to make the background
    image editable, but not the rest of the settings in the body style.
    (I'm not sure of my terminology yet.) The background image is
    currently set in the locked part of the page. I've tried to insert
    an editable region in the html code, as I cannot get to the
    background image by clicking on it or selecting on the Design page.
    But I am not allowed to change the code in this way.
    What is the best way to do this? I'm not sure how to make a
    div of this one setting. Or even if that is what is needed.
    Thanks for any suggestions.

    So to give a different background image to different pages using CSS.
    Create a CSS file in your Dreamweaver site.
    Link it to your pages.(in your head tag like so: <link href="path/to/stylesheet.css" rel="stylesheet" type="text/css" />)
    In your HTML code find the body tag and give it an id (like so: <body id="myUniqueID">)
    In your stylesheet write the following code:
    #myUniqueID{
    background: #color, url("path/to/image.jpeg") repeat);
    And now extrapolate the above steps and code to your other pages and voila, you now have different background images for your different pages.
    To learn more about CSS - visit your local web search engine.
    To see the power of CSS, check out http://csszengarden.com/ where the exact same HTML file is styled by different CSS stylesheets.

  • How to make a Frame transparent?

    Hi everyone:
    I want to make a Frame transparent,it is possible?I find all the API but no result : (
    More, I want to increate my Frame's Height ,but it can't work. code is:
    Frame f=new Frame("Test");
    for(int i=0;i<6;i++){
    f.setSize(40,i * 10);
    }If I change to code to
    f.setSize(40,10);
    f.setSize(40,20);
    f.setSize(40,30);
    ...................It can work well.But why ? It is so complicated . : (
    Please help me

    More
    How to add a hyperlink Text in Frame? When I click it which can open a web site?

Maybe you are looking for

  • How to populate data in table control  .

    hi all, i put matnr no. in screen no. 103 validation is done at that screen only. now when i want to modify dat record when i put matnr no. at screen 103 so how i will get all  data of dat number to table control screen.

  • Admin Console browser problem

    Hi, This is a peculiar problem that I am facing. I am working with iPS3.0SP3 on solaris8. My installation went fine. But when I try to access Admin console(thru Netscape 4.7 or 4.75), I have the login screen displayed. But, after I provide User and P

  • CS5 Animation Presets MIA?

    In CS5 I don't see the animation presets in the Effects Control Panel. Have they moved elsewhere? Its convenient to see the presets I've created for several effects here rather than searching the Effects and Presets Panel for them.

  • Image error :-Failed to load *.eps file

    Hi , We have loaded some *.eps files in data manger.. Issues:- 1. We cannot see the thumbnail of this image (which is in .eps format) . 2. Also we had created variant to convert this *.eps file to *.jpeg but when we try to do so we get the error "Fai

  • Error when previewing in Browser

    I am using Captivate 8. My projects work as they should, but when I try to Preview in Browser, for some reason Captivate is triggering Microsoft Word to open. I am totally stumped on this and could really use some input.