Making JTextPanel transparent

Hi,
I am trying to put a JTextPanel that is transparent.
using setOpaque(false) does not work for me. Gray background is still displayed instead of the background color image of the panel in which I have put the JTextPanel. The transparent JTextField shows up fine!
here is the code
public ChatPanel(GameController gc, iSnakeConfiguration isc, UIResources uir) {
        setGameController(gc);
        setConf(isc);
        setUiResources(uir);
        setPreferredSize(getConf().getChatFieldPanelDim());
        setMinimumSize(getConf().getChatFieldPanelDim());
//        setOpaque(false);
        // initialize the chat area text attributes
        initChatAreaAttributes();
        localPlayerMessage = new javax.swing.JTextField();
        chatScrollPane = new javax.swing.JScrollPane();
        chatMessagePane = new JTextPane();
        chatScrollPane.setViewportView(chatMessagePane);
        setMinimumSize(new java.awt.Dimension(380, 380));
        localPlayerMessage.setForeground(new java.awt.Color(255, 255, 255));
        localPlayerMessage.setText("hey, why aren't you starting the game?");
        localPlayerMessage.setToolTipText("Enter Chat message and press ENTER key to send");
        localPlayerMessage.setBorder(null);
        localPlayerMessage.setCaretColor(new java.awt.Color(255, 255, 0));
        localPlayerMessage.setOpaque(false);
        localPlayerMessage.setPreferredSize(new java.awt.Dimension(220, 18));
        localPlayerMessage.setSelectionColor(new java.awt.Color(255, 255, 0));
        localPlayerMessage.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                textFieldMouseEntered(evt);
            public void mouseExited(java.awt.event.MouseEvent evt) {
                textFieldMouseExited(evt);
        localPlayerMessage.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sendChatActionPerformed(evt);
        localPlayerMessage.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                textFieldFocusLost(evt);
        chatMessagePane.setToolTipText("Chat Messages Sent/Received");
        chatMessagePane.setBorder(null);
        chatMessagePane.setEditable(false);
        chatMessagePane.setOpaque(false);
        localPlayerMessage.setSelectionColor(new java.awt.Color(255, 255, 0));
        StyledDocument doc = chatMessagePane.getStyledDocument();
        String initString[] =
                { "Use the mouse to place the caret.",
                  "Ctrl-f, Ctrl-b, Ctrl-n, Ctrl-p." };
        try {
            for (int i = 0; i < initString.length; i++) {
                doc.insertString(doc.getLength(), initString[i] + "\n",chatAreaAttributes);
} catch (BadLocationException ble) {
System.err.println("Couldn't insert initial text.");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(129, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(localPlayerMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 307, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(chatScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 338, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(43, 43, 43))))
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(76, 76, 76)
.addComponent(chatScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(15, 15, 15)
.addComponent(localPlayerMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(90, Short.MAX_VALUE))
Edited by: thelinuxmaniac on Sep 23, 2007 7:48 PM

Hi,
It works :)
thank you very much
Could you please tell me why do I need to do
chatScrollPane.getViewport().setOpaque(false);when I have already done that for the JTextPanel which is in the viewport of ScrollPane?
Another thing, i do not want any type of border (or shading around the JTextPane). I tried using
chatMessagePane.setBorder(null);But there is still a white shaded line. How can I remove it?

Similar Messages

  • How do I remove white jagged edges after making image transparent?

    How do I remove white jagged edges after making image transparent?  Is there a feature to help out with this?

    It's a file format limitation. GIF supports 1 bit of transparency.  That is 2^1 (which equals 2 total) levels of transparency.  This equates to either NO transparency at all, or specifying 1 single color of the 256 total possible values to being fully transparent.
    This will leave a very ugly fringe around the edge no matter what; it will only not be visible in color that match or are close to the fringe color; and then, that's a perception issue.
    Try creating an alpha channel and saving the image as a PNG.  That supports 8 bits of transparency, which equals 2^8 or 256 total different levels of transparency.  This will let your image have very smooth edges with no jagged transitions.

  • How to remove/hide 3d object template (start point) when making object transparent

    When making 3d object then making it transparent i still see form of witch i made it.
    How to remove it?
    I made square then from it 3d object and made it round so i could put on it beer botle label BUT when i put latel and then make transperancy full then i still see square from witch object is made.. Its still showing up. Why or better- how to remove it? Cant find any button to click it off.

    I'm also not so sure I understand what you're trying to do.
    If you share  an observablecollection then removing an item from that collection would remove it from any ListBox whose itemssource was bound to it.
    I get the impression that might not be what you want though.
    Hope that helps.
    Recent Technet articles: Property List Editing;
    Dynamic XAML
    for example:i have 3 listboxs,binding itemssource named list1,list2,list3
    in my way
    <ListBox Height="138" Margin="58,30,60,0" VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemContainerStyle="{StaticResource ListBoxItemStyle1}" ItemsSource="{DynamicResource list1}">
    </ListBox>
    <ListBox Height="138" Margin="58,30,60,0" VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemContainerStyle="{StaticResource ListBoxItemStyle1}" ItemsSource="{DynamicResource list2}">
    </ListBox>
    <ListBox Height="138" Margin="58,30,60,0" VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemContainerStyle="{StaticResource ListBoxItemStyle1}" ItemsSource="{DynamicResource list3}">
    </ListBox>
    in ListBoxItemStyle1 the method textBlock_MouseDown,i have no way to get the list correctly because the 3 listBox's ItemStyle is the same.if i can get the lists from listboxitem,i can use only one style

  • 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.

  • Making windows transparent

    Hi, i did have the option once to make any window as transparent as i liked, i cant remember what the software was called though.
    anyway, i was wondering if anyone knew of any software?
    i have tried afloat, windowshade X and Invisiray and i cant get any of them to work
    thanks

    anyone?

  • Flash: Making a Transparent Background

    Don't ever tell me that its the window mode set to transparent in the html setting in publish settings and don't tell me I need to change the html code of the published product in dreamweaver because I don't have dreamweaver.
    How is one to make an swf file file that has no background in it without Dreamweaver and without a publish setting that doesn't work?
    After that can be answered, how then are you to make an avi. file thats transparent?
    Advice told me that I need to convert the swf to avi. How is one to this?
    And last, I'm new to the discussions...
    How do you edit your discussion so I don't have to post the same topic twice with new information?

    You can use any text editor (such as Notepad) to edit an html file, you don't need Dreamweaver.
    You cannot edit an intitial posting after you have posted it, so it is important to prepare it carefully ahead of posting it so that you are sure it has all the information you intend.  If you need to clarify something afterwards, then you can only post a response afterwards to attempt to clear things up.

  • Illustrator CS3 : making a transparent polygone

    Hi everybody,
    This is my first topic in this forum.
    I want to know if there is any way to make a colored transparent polygone using illustrator CS3 or by any other adobe's family softs ?
    Thank you

    There's a polygon tool under the rectangle tool in the toolbar. Click and hold on the rectangle to see a sub-toolbar. The polygon tool looks like a hexagon. Click-and drag to start drawing a polygon. Press the up and down arrows before you let go of the mouse button to add or remove sides.
    You can fill the polygon using the Color or Swatches panels. That's also where you can set the stroke colour. The stroke thickness is set in the Stroke panel.
    You'll have to give a more thorough explanation of what you mean by transparent, but transparency is usually set in the Transparency panel (whodathunkit?).
    Also, what are you doing with this graphic? Are you adding the polygon to existing art in Illustrator, importing the polygon into another program, saving an image for a web page, printing, or something else?

  • Illustrator making objects transparent when shouldn't

    I just recently upgraded to CS5 from 3 on Windows XP.  I created a graphic with some design elements to make it a little 3D looking and exported to a PNG with transparent background for powerpoint. When the graphic overlays another, parts are transparent where they should not be. There is not a single object (grouped or individual) that has the transparency less than 100%. The parts that are transparent are where an overlayed object has a multiply setting in the Transparency palette. Does this make sense? I basically designed three puzzle pieces that are going to be animated in powerpoint and float over eachother. I am happy with the area around the puzzle to be transparent, just not the puzzle piece itself.
    Thanks in advance.

    I checked the settings of a built in button from the symbols palette and saw no difference in setup.
    I ended up duplicating the entire object and removing the "effect" object and sending to back which made the object non transparent.

  • .png and making background transparent

    Hello all; I'm new at this, so please bear with me. I have a
    .png of a logo that someone created for me. The problem is that the
    logo has a square white background behind it and I'd like to place
    the logo on a background of a different color. My question is, how
    would I eliminate the white background so I'd just have the logo?
    The logo is pretty intricate, so I'm not sure that cutting around
    the edges would work very well...
    Thank you!

    what is the png? fireworks png? if it is , you can change it
    via accessing changing the canvas color to transparent, if not ,
    you could use the magic wand tool and select the white background,
    press delete. Then you change the color of the background

  • Making a transparent image

    Hi Everyone,
    I created a text in Photoshop cs and am trying to superimpose that over a video in FCE 4, how can I make the text background transparent so I don't have to mess with key adjustments in FCE 4?
    Thank you

    Hi(Bonjour)!
    Start from a new document in Photoshop with a transparent background.
    Design your title and save in PNG image format (interlaced or not).
    This specific format preserve transparency.
    Michel Boissonneault

  • Doing something wrong making JScrollPane transparent

    I'm trying to make a transparent JScrollPane that contains a JTextArea.
    here's what I'm doing [wrong] :
           // this all takes place in a class that extends JPanel
           JTextArea taskOutput = new JTextArea(5, 20);
           taskOutput.setPreferredSize(new Dimension(w, h));
           taskOutput.setEditable(false);
           taskOutput.setCursor(null);
           taskOutput.setLineWrap(true);
           taskOutput.setWrapStyleWord(true);
           taskOutput.setOpaque(false);
           JScrollPane scroller = new JScrollPane(taskOutput);
           scroller.setPreferredSize(new Dimension(w, h));
           scroller.setOpaque(false);
           Container c = getContentPane();
           c.setLayout( new FlowLayout() );
           // this shows up fine, the background is transparent
           c.add(taskOutput);
           // this doesn't work, the background is grey
           c.add(scroller);thanks!

    scroller.getViewport().setOpaque(false);that did it!
    thanks!

  • Flash: Solutions for Making a Transparent Movie?

    I have searched for an hour now so I might as well start a question.
    I'm trying to make a simple text animation but the background won't go away from my exports. I need to make a movie file (.avi or .mov) and nothing is letting me remove the white space in the background.
    Things I have tried:
    Go to Publish settings > HTML > Window mode: Trasparent Windowless
         Result: White background remains
    Make a .mov and in Quicktime Export Settings checkmark Ignore Stage Color (generate alpha)
         Result: This time, everything was black (text was black too so it probably blended withthe background
    Make a .avi and in Export Windows AVI set video format to 32 bit color w/ alpha
         Result: White background remains
    Make a .gif image sequence and just use the images in your video editer to make the animation
         Result: Even after changing the GIF publish settings to transparent, the gif images are still not transparant
    So far nothing works so what is the deal with flash not comprehending with a clear background in movie files?
    Any help will work, as long as it isn't something I've already tried.

    Just out of interest, how do you convert the SWF to an AVI?
    Is this a capability available in Flash by default?
    This could help me fix my problem I outlined here:
    http://forums.adobe.com/thread/738017?tstart=0
    I tried using Adobe Media Encoder to export a SWF to AVI, but it tells me that SWF is not a supported format.

  • Making background transparent...no color ?

    I want to move stills around & bring them into FCP ontop of video. In Motion what is the setting so that the background is transparent (no background color) in the resulting QT export movie. What is the setting/prefs for this ?
    Regards...Ray
    G5   Mac OS X (10.4.2)  

    I can not bring the Motion file into FCP, it gives me an error message when I try and import it into FCP browser. Also, I still can't export my project out of Motion with a transparent background, I tried all of the above. 0% opacity background, None or animation option in codec export, I'm still getting a black ground with my Quicktime Export movie. In the View Menu of Motion I was able to set the Channel option to transparent, so I see a transparent background in the timeline of Motion, but it does not translate to a transparent background on export. Still perplexed on this one, still seem to be missing something here.
    Thanks for further assistance with this.
    Regards
    Ray

  • Making things transparent

    Hi,
    I have an Illustrator file of the below image, the image will be used for different bits of my webpage with only the turquoise color changing depending on where you are (so it could be red/blue etc).
    My idea was to take out the colored bits and make them transparent, so in my css all I would have to do is set a background color.
    But how would I actually do this in Illustrator, if it is even possible? I'm not sure how when I delete the colored layer it would also delete the same section in the grey background layer? Or am I going about this the wrong way?
    Thanks:

    Ahhh. Got it now - sorry, I had to read twice.
    1. Start with splitting the text objekt into two texts (maybe it would also work with one, I haven't tried). But do so in isolation mode, so that the whole thing remains grouped and both texts are in the group. It helps when you turn on transparency grid.
    2. It's fine that all of the objects are grouped already. Make that a knockout group.
    2. Then select all the turquoise objekts with direct selection tool and turn their opacity down to zero
    5. You still have to export as PNG to get alpha transparency. Then the background color doesn't matter for the image.

  • Making treenodes transparent...

    Hi,
    I downloaded a lookandfeel for my app which looks really great. My problem is that the treenodes block the background image of the panel created by the lookandfeel so that I get ugly white space around each treenode.
    How can I make each treenode transparent?
    V

    vermelh0,
    Try creating your own gif images with transparent background, and supplying those to the JTree.
    --A                                                                                                                                                                                                                               

Maybe you are looking for

  • MSI Neo4 Platinum with MSI GF6600GT PCI-e Freezes on games

    I'm having this serious problem that my new build system freezes on games. Sometimes I can play for a few hours and sometimes I can play only a few minutes before the system freezes completely. Only a hardware reset helps in this case. This is my har

  • Why in case of parent child relation iterator fetching one duplicate record

    Hi, JDev Ver : 11.1.1.2.0 Technology : JPA/TopLik Service Facade Data Control (Without using BC4J) I have created JPA/TopLink service facade from DB Tables and on facades I have crated DataControl which I have draged and droped on my screen to create

  • Can't close folio in Content Viewer on iPad

    Hi all, Uploaded a student's folio to test it. Didn't realise he had one image sequence that covered the entire screen. This means I can't navigate out of the folio, to get back to library, to delete it - as all I'm doing is activating the image sequ

  • PO Approval Delegation

    Hi guys can anyone tell me, if the final approver delegates approval authority to the approver below him,does that approver (approver below) need to have the same limit(monetary) of approval as the final approver

  • How do you make photos handicap accessible?

    How do you make photos handicap accessible?