Making a button transparent

I'm designing a Japplet with JButton but i dont know how to make my buttons background transparent
i read the color class tutorial but i actualy didnt understand it
it gives lots of values like fload arrays or something
can somebody tell me how can i make my buttons background transparent?
Thanks

It's always good to send an example as you finally did.
That helps to find a solution:
package applet;
import javax.swing.*;
import java.awt.*;
public class backgammon extends JApplet{
    public Icon pulicon,bgIcon;
    private Image pul_s,background;
    public JButton b1;
    public void init(){
        //set layout:
        getContentPane().setLayout(null);
        this.setSize(744, 536);
        //set button:
        pul_s = getImage(getCodeBase(),"images/pul_sari.gif");
        pulicon = new ImageIcon(pul_s);
        b1 = new JButton(pulicon);
        b1.setBounds(50,50,42,42);
        b1.setContentAreaFilled(false);
        b1.setBorderPainted(false);
        getContentPane().add(b1);
        //set background:
        background = getImage(getCodeBase(),"images/background.jpg");
        bgIcon = new ImageIcon(background);
        JLabel bg = new JLabel(bgIcon);
        bg.setBounds(0,0,getWidth(),getHeight());
        getContentPane().add(bg);
}

Similar Messages

  • What would the CODE be, in Flash, for making buttons transparent on MOUSEOVER?

    I am building my site in Flash, and I have these thumbnails, that when moused over, a larger version pops up.
    Problem is, they are being obscured by the other thumbs. See for yourself:
    http://www.andreadams.com/Andre_Adams_products_games.htm
    (also attaching a jpeg example of what I'm talkin about)
    I tried to make the buttons transparent, put them on different layers, all this stuff, nothing worked. I figured there must be some code to make it work, like, "on mouseover, make buttons A, B, C transparent." Something like that, just have no idea how to write it.
    If someone could help me out it would be much appreciated! I will reward you with a copy of my Cartoon Express CD collection--500 vector images. No joke!
    cheers, Andre

    The more correct way to deal with this is to manage the depths of the movieclips/buttons so that whichever is currently being rolled over is brought to the top of the pecking order.  It may require a little bit of redesign, but not necessarily.  How you go about mamanging the depths depends on what version of actionscript you're using.  In AS2 you want to look into the swapDepths() method, and in AS3 you want to look into the setChildIndex() method.
    To answer the title question, to make something transparent, like a button or a movieclip, you set the alpha/_alpha (AS3/AS2) property to 0. But in doing that you will probably be creating a problem because transparent objects can still interact with a mouse.  Your better bet is to set the visible/_visible property to false... invisible objects won't interact with mice.

  • [svn:osmf:] 14521: ChromeLibrary: moving live and recording buttons to the left hand side of the control bar , and making the button backdrops a little bigger.

    Revision: 14521
    Revision: 14521
    Author:   [email protected]
    Date:     2010-03-02 12:47:27 -0800 (Tue, 02 Mar 2010)
    Log Message:
    ChromeLibrary: moving live and recording buttons to the left hand side of the control bar, and making the button backdrops a little bigger.
    Modified Paths:
        osmf/trunk/libs/ChromeLibrary/assets/control bar.ai
        osmf/trunk/libs/ChromeLibrary/assets/images/eject_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/fullScreenEnter_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/fullScreenLeave_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/live_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/live_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/live_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/minus_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/minus_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/minus_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/pause_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/play_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/plus_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/plus_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/plus_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/qualityAuto_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/qualityAuto_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/qualityAuto_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/qualityManual_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/qualityManual_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/record_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/record_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/record_up.png
        osmf/trunk/libs/ChromeLibrary/src/org/osmf/chrome/controlbar/ControlBar.as

    Revision: 14521
    Revision: 14521
    Author:   [email protected]
    Date:     2010-03-02 12:47:27 -0800 (Tue, 02 Mar 2010)
    Log Message:
    ChromeLibrary: moving live and recording buttons to the left hand side of the control bar, and making the button backdrops a little bigger.
    Modified Paths:
        osmf/trunk/libs/ChromeLibrary/assets/control bar.ai
        osmf/trunk/libs/ChromeLibrary/assets/images/eject_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/fullScreenEnter_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/fullScreenLeave_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/live_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/live_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/live_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/minus_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/minus_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/minus_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/pause_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/play_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/plus_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/plus_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/plus_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/qualityAuto_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/qualityAuto_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/qualityAuto_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/qualityManual_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/qualityManual_up.png
        osmf/trunk/libs/ChromeLibrary/assets/images/record_disabled.png
        osmf/trunk/libs/ChromeLibrary/assets/images/record_down.png
        osmf/trunk/libs/ChromeLibrary/assets/images/record_up.png
        osmf/trunk/libs/ChromeLibrary/src/org/osmf/chrome/controlbar/ControlBar.as

  • Hello, is there a way for making a photo transparent with iPhoto are another software?

    Hello, is there a way for making a photo transparent with iPhoto are another software?

    Not with iPhoto, but different apps have different capabilities.
    There are a couple of considerations: How is this transparent image to be used? In a Deskop Publishing environment something like Pages' Instant Alpha might be useful. Or if you're trying to overlay one image on another on a photograph then some editor that supports layers would be required.
    Further, Jpegs as a format doesn't support transparency so you'll need to work ina  file format that does.
    But if you can explain what you're hoping to do we might be able to point you in a more useful direction.
    In order of price here are some suggestions for editors:
    Seashore (free)
    The Gimp (free)
    Graphic Coverter ($45 approx)
    Acorn ($50 approx)
    Pixelmator ($50 approx)
    Photoshop Elements ($75 approx)
    There are many, many other options. Search on MacUpdate or the App Store.
    You can set Photoshop (or any image editor) as an external editor in iPhoto. (Preferences -> General -> Edit Photo: Choose from the Drop Down Menu.) This way, when you double click a pic to edit in iPhoto it will open automatically in Photoshop or your Image Editor, and when you save it it's sent back to iPhoto automatically. This is the only way that edits made in another application will be displayed in iPhoto.

  • Making a button rollover change a movie clip's frame

    Hi again everyone,
    I knew how to do this in AS2 but now I am having problems
    with making a button on the stage goto a frame in a movie clip on
    the stage.
    I've attached a sample of my code below, hopefully you'll see
    the error and be able to point it out to me?
    I have a movie clip on the stage that has different
    information in different frames. I want to make it so that when
    someone rolls over the button, the movie clip fades in and goes to
    the correct frame to display the information.
    With this setup the way it is below, I keep getting "Warning:
    3590: void used where a Boolean value was expected. The expression
    will be type coerced to Boolean.
    I know where the problem is happening, "function
    XXX(event:MouseEvent):void {navigateToURL(XXXweb)}"
    How can I write this differently and eliminate this problem?
    Thanks,
    Jeremiah

    I'll give that a shot, thanks!
    A follow up question to that one, is there a way to make it
    so that I can have one rolled over function applied to several
    buttons / frames in the movie clip? This movie clip has 50+ frames
    in it and if I could reduce my coding, it would make life a lot
    easier.
    Thanks,
    Jeremiah

  • Imported image and making white space transparent...

    I need to make the white space around an image transparent without having to use the clipping mask tool. In Freehand, you simply click a button and the white background disappears. I need to use that exact technique to hide the white background.
    How can I do this in InDesign?
    Thank you.

    There's quick, and there's right. They're rarely in the same space.
    To make a transparent background can be a complex and fussy process. While InDesign could include a general tool to do so, it would likely be inferior to actually making the image background transparent in a native image editing tool.
    I've found most such embedded features to be adequate only for low end work - e.g., they leave a background halo on the image, or a noisy edge, or other image problems. I really don't see it as a flaw or omission that ID forces you to use a proper tool to create the background transparency.

  • Making a button in a scrollbar

    Hello,
    First things first. I know my english is not the best but I will try to explain my problem as clearly as I can.
    I have a problem with my Indesign document I am using indesign5.5.
    I am making an ipad version of a newspaper. And I made a scroll section for the menu. So if you wanna see the news you can scroll through the subjects. But if you see a subject you want to read. you have to click on the picture of te articale you want to see.  I can make buttons and I can make a scroll section but I can't make a button in the scroll section. I've tried a lot of ways but it just won't work or it won't scroll with the pictures. I hope you guys can help me to find a solution.
    thank you

    Your English is fine, but you’re in the wrong forum. Please visit the Digital Publishing Suite forum.
    Before posting however please have a look at the FAQs.
    Adding interactivity to scrolling content is a newly added feature that requires the use of the Pan and Zoom overlay instead of scrollable content layers.
    Bob

  • Making custom buttons dissappear when not selected

    I am trying to get around the limitiation of not being able to add audio to a layered menu item.
    Correct me if I am wrong but I think if I create my own buttons (that would reflect the same look as the active layers of the Photoshop file) then I could have audio in the Menu with the same look using the buttons I create.
    Here is my question ... Is it possible to have a button dissappear when its not in the "activated" or "selected" state? I figure that I can create the button to look like the same active state and have the normal state revealed in the background graphic when the button is deselected. I just don't know how to make the button invisible or transparent when its not "selected" or "activated"
    Thanks in advance
    Lou ..

    Yes use overlays for the buttons and do not highlight them in normal state (though you may consider having something showing for normal state so people know it is there as oppossed to totally not visibale)
    Some examples and techniques showing mapping and then some others with video backgrounds also
    http://dvdstepbystep.com/newmap.php
    http://dvdstepbystep.com/rollover.php
    http://dvdstepbystep.com/useelements.php
    http://dvdstepbystep.com/buttons07.php
    http://dvdstepbystep.com/motion.php

  • Making a button with a picture

    I'm trying to make a button with a picture I made in photoshop.. but the problem is that the background is transparent, I just want the main part to be clickable.
    Here is an example.. I just want the purple part to be clickable. The box around that is the actually whole image. So how can I fix this?

    if you are using a simple button with up / over / down / hit frames do the following.
    add a new layer to your button's timeline above the bitmap
    in the up keyframe of this new layer draw a circle the same size and position of the purple starburst.
    select the circle and cut the the circle (cmd-x or cntrl-x)
    delete the layer you just made
    make sure there is a keyframe in the hit frame of the remaining layer (f6)
    if the bitmap is in the hit frame, delete it.
    with the hit frame selected do a paste in place: cmd-shift-v or cntrl-shift-v
    now you should have only the vector circle shape in the hit frame of the button.
    now your button will only respond to mouse events when you rollover where the circle is.
    the reason i had you add a new layer is because when you draw vectors in the same layer / frame as a bitmap, the vectors go behind the bitmaps and are hard to select, see, or modify.

  • Making a button appear on a track

    I've searched here and in the manual but I'm not sure I'm searching for the right thing. How can I make a button appear within a stream so the user can link back to a menu?
    puzzled.....
    Thanks

    It's done in DVDSP by using 'buttons over video'. Basically, you use the subtitle stream to add the text that you want for the button (or graphic, if you import one as a subtitle).
    Once you have set the markers for the start and end point of where the button will appear, click in between them in a spare subtitle stream, type the word you want and then click on the editor window to see it appear. From here on in you can use the window as you would when making buttons on a menu - drag out a button rectangle, set the target and so on.
    Make sure that you force the sub to view...
    On playback, the button will appear as a part of the subtitle. You need only press the 'enter' key on your remote control to activate it, unless you have created more than one button... in which case you need to use the arrow keys to get to where you want to be before you activate the button.

  • Making a color transparent

    Hi all
    i am designing a software that visualises property prices of houses. so i have images of houses all over the map. what i want to do is when i click a certain button, it shades the most expensive houses with dark red and least expenses houses with lighter red.
    the problem i am facing is that, once i try to shade over the area of where a house image is, the house image disappears. the color is put in the fore ground and the house image disappears, so i was wondering if there is any way to make a color transparent so that the shade of red can be seen as well as the image of the house
    thanks in advance
    regards

    Sure, just set an alpha value smaller than 1.0 (float) resp. 255 (int):
    http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Color.html
    -Puce

  • Help making a "button" that appears mid-track

    So... I have a client who's making a French version of a program that has already been made once in English. The English version was not made by me so i'm starting from scratch with some brand new assets.
    The English version has a feature I've not seen before so I'm unsure how to recreate it exactly. Basically, the main program of the disc comes in 2 flavors. the first is just your basic video program with chapter markers for each segment and an end jump to the main menu. the second is whats puzzling me. the program itself is the same video however at certain points during the program a "button" pops up which allows for a jump to another menu. i say "button" in quotes because i'm not sure its the right word.
    what happens is a translucent gray box pops up in the lower left hand corner of the screen that has some text in it with instructions to press the enter button on your remote if you'd like to see a related video. when one presses enter on the remote the DVD then jumps to a sub menu which corresponds to the appropriate supplemental program. the button comes up during the end of one chapter and visually is gone within a few second but the functionality of that button is still available for the first 20 or so seconds of the following chapter and then is disabled until the next instance.
    my question is: what is that gray box button thing? is it scripting or something? i've never seen this before. any suggestions would be greatly appreciated.

    Stolen from DVD Studio Pro Tutorials

  • CP5 - W7 - Button Transparency Yellow color - flooding white areas

    Here are some buttons I made...
    This is the setting in Photoshop made for every saved button
    This is how the different buttons are displayed in "Preview in a browser" (F12)
    These above are ok!
    This one has gone crazy...
    Why? I have really looked at every setting.. and checked that I treated every image the same... Actually, all images are in the same PSD and therefore automatically the same options when saving.
    1. I need to use exactly this yellow color
    2. I need the transparency, because there are effects running in the background that will show around the outer edges.
    3. I can not find any choice that says choose this color as alpha... that might have solved the problem
    Is this a bug? An undeveloped feature to not set the Alpha, or just me that can not understand the tool.
    Please help me with a corect or incorrect way to fix this
    Best Regards // Daniel Perez

    Hi there
    You need to open the image in an image editing application and scrutinize a close up. The transparent color traditionally used in Captivate is based on the color of the pixel at coordinate 0,0 (upper left). It would appear this pixel is the same color as the face.
    Usually a safe trick is to flood fill the area you wish to become transparent with an odd color such as fuschia.
    Cheers... Rick
    Helpful and Handy Links
    Begin learning Captivate 5 moments from now! $29.95
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcererStone Blog
    Captivate eBooks

  • Making multiple buttons out of one picture?

    Ok this is probably a daft question but I'm a complete novice so bear with me. I need to know if it's possible to upload a picture to my Flash stage (a row of buttons I made in photoshop) and then somehow select each of these buttons and turn them into working button symbols? Or do I have to (very annoyingly) upload each button as a seperate picture in a seperate layer before turning it into a button symbol?
    Thanks : )

    kglad knows much, much more than I do and actually helped me out the other day. But, I think I could elaborate a little. Below is exactly what he said, step by step.
    Draw a square> right click> > convert to symbol> name it generic button> ok> double click button> go to the hit frame> right click> insert frame> go to the up frame> right click> insert key frame> click in the up frame again> delete> go back to scene 1
    The button now is transparent (kind of). This generic button is just that a generic button. You can duplicate it or drag it multiple times from the library panel. Place as many as you need on stage. Ex. you have 5 generic buttons on stage. Flash cannot tell the difference between each button. You need to give each button an instance name, so flash knows what button you're talking about when you start writing the code for it.
    Next
    click on a button> properties panel> give instance name (first_btn)> repeat for each button second_btn,, third_btn etc...
    Then write the code to control each button.
    Hope this was helpfull. Just paying it forward.

  • Making a JPanel transparent

    In the application I am writing I want to allow for some popups on my interface. I am using a JLayeredPane, with two JPanels. The main JPanel, on the default layer, holds all the main components. A second JPanel, at the popup layer, will hold any components which should "pop up".
    The layered pane is using a border layout, with both JPanels in the Center.
    Unfortunately the bottom panel cannot be seen. It is covered by the top panel, even after I called setOpague(false) on the top panel.
    Am I taking the wrong approach? Or is it just not possible to make a JPanel transparent?

    It should work.I have fiddled around, but have been unable to get this to work. It seems obvious that I'm doing something wrong. :( Below is an example which mimicks my real code, and hopefully is simple enough.
    I appreciate any help you can provide.
    import java.awt.BorderLayout;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JLayeredPane;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    public class MyPanel extends JPanel
         public MyPanel()
              setLayout(new BorderLayout());
              add(createLayeredPane(), BorderLayout.CENTER);
         private JLayeredPane createLayeredPane()
              JPanel mainPanel = createMainPanel();
              JPanel popupPanel = createPopupPanel();
              JLayeredPane pane = new JLayeredPane();
              pane.setLayout(new BorderLayout());
              pane.add(mainPanel, BorderLayout.CENTER);
              pane.add(popupPanel, BorderLayout.CENTER);
              pane.setLayer(mainPanel, JLayeredPane.DEFAULT_LAYER.intValue());
              pane.setLayer(popupPanel, JLayeredPane.POPUP_LAYER.intValue());
              return pane;
         private JPanel createMainPanel()
              JList list = new JList(new Object[]{"One","Two","Three"});
              JButton button = new JButton("Do Nothing");
              JPanel panel = new JPanel();
              panel.setLayout(new BorderLayout());
              panel.add(new JScrollPane(list), BorderLayout.CENTER);
              panel.add(button, BorderLayout.SOUTH);
              return panel;
         private JPanel createPopupPanel()
              JLabel label = new JLabel("Hello world!");
              label.setOpaque(false);
              JPanel panel = new JPanel();
              panel.setOpaque(false);
              panel.add(label);
              return panel;
         public static void main(String[] args)
              MyPanel panel = new MyPanel();
              JFrame mainFrame = new JFrame("Testing");
              mainFrame.setContentPane(panel);
              mainFrame.pack();
              mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              mainFrame.show();
    }

Maybe you are looking for

  • Problem in uploading BDC

    Hi Experts,   Iam uploading data for the tcode f-02. My flat file is having more than 1500 line items. But it is throwing a message "Item 1000 should be created, a maximum of 999 items are allowed" Could you please telll me the reason........ Regards

  • Timemachine wont backup, gets this message

    This backup is too large for the backup volume. The backup requires 129.4 GB but only 329.3 GB are available. ***?

  • What will happen If I update my factory locked iphone 4 to iOS 7?

    I have a factory locked iphone.I just forgot the passcode now i want to restore it itunes are showing the message that it can restore & update only.i want to know that if i update ios7 what will happen.you can also help me how to restore my iphone wi

  • 15" Studio Display ?

    I was wondering if there is anyway to fix/save a 15" Apple Studio Display (LCD with Blue Back) there is one for sale but it has the display cord cut off.

  • How to adjust plot names visibility in the legend of a XY-graph automatica​lly

    I have a XY garph that shows 3 plots. Sometimes I need to close some plots on the graph. I can do it. But I also want to delete the plot name on the legend of the graph too, I could not do it. How can I do it? The program is attached. Egemen Solved!