Border around a label

I am trying to create a black border around a label using awt. Is there any way to do this? I have been trying to do it by creating two labels, one black and one white, with the black one slightly larger and putting the white one on the same cell (am using GridBagLayout) as the black one, but that doesn't work, only the black one is visible.
Perhaps there is a different approach that someone knows about?
Thanks for any assistance!

I suggest using swing instead of awt, and then use the JComponent.setBorder method. You can find the types of borders you can create in javax.swing.border package. You can also use the BorderFactory class to create these borders for you.
The problem with trying to put two items in the same position in the gridbag layout is that the gridbag layout (can) resize the components to fill the space, for one, so it might be resizing both components to the same size. Also, there is not concept of a z-index, so there is no guarantee which one will be painted first.
- Adam

Similar Messages

  • Border around Label?

    Hi all!
    How to I draw a border around a label?
    I appreciate your support and insight!
    Best regards,
    -Tony

    You could make a re-usable simple MXML component.

  • Draw a thin border around an inputText box????

    Hi,
    I would like to draw a thin border around an inputText box but when I use the following, I am getting a thin border around the inputText box as well as the label (text) associated with it. I don’t really want this border around the label.
    border-width:thin; border-style:solid
    So how can I draw a thin border just around a inputText box only (Not around the label associated with the inputText) ?
    Regards
    V.Piraba

    Hi
    I found the answer. Just do the following to draw a thin border around a inputText box.
    border-width:thin; border-color:rgb(0,0,0)
    ---------------------------------------------

  • Add a border around an AWT Label

    I need to add a border around an AWT label like I would for a Swing Label. I do not have BorderFactory available in AWT. Is there an easy way to do this?
    Thanks,
    Chris

    Bump

  • How to add a Border around an ImageView

    Hi all,
    I'm adding a row of photos in my application which are being resized to fit into some constrained space with Preserve Ratio true. They are put in a TilePane, with a Label below each photo.
    Basically, I give all my ImageViews a fitHeight of 120 pixels, and let them determine how wide they will become themselves in order to preserve the ratio.
    It looks great.
    However, I would like to add a Border around these images, as they sometimes fade too much into the background to clearly see the edges. ImageViews themselves donot support borders, so I'm forced to wrap these ImageViews inside another container.... but, no matter what container I use, the container itself refuses to resize itself to fit exactly around the image -- it seems to be completely oblivious of the real size of the Image -- with some parameters the ImageView will simply render itself outside the edges of its container, and with other parameters the container is wider than the ImageView leaving a gap on the right side.
    This is yet another instance where I want my ImageViews to resize themselves to fit the available space, resulting in a huge struggle to force these components into their proper straight-jacket. Anyone got any solutions for this?

    I'm afraid that also won't work, as the Image needs to be scaled, and the dimensions you are using are from the unscaled image.
    I've however am now using this class to get what I want, together with a stylesheet to specify the border it works and I get nice borders.
    package hs.mediasystem.util;
    import javafx.beans.property.BooleanProperty;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.geometry.Bounds;
    import javafx.geometry.Insets;
    import javafx.geometry.Pos;
    import javafx.scene.Node;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.layout.Region;
    import javafx.scene.layout.StackPane;
    public class ScaledImageView extends Region {
      private final ImageView imageView = new ImageView();
      private final StackPane effectRegion = new StackPane();
      private final ObjectProperty<Pos> alignment = new SimpleObjectProperty<>(Pos.TOP_LEFT);
      public ObjectProperty<Pos> alignmentProperty() { return alignment; }
      public final Pos getAlignment() { return this.alignment.get(); }
      public final void setAlignment(Pos pos) { this.alignment.set(pos); }
      public ScaledImageView(Node placeHolder) {
        getChildren().add(imageView);
        getChildren().add(effectRegion);
        getStyleClass().add("scaled-image-view");
        effectRegion.getStyleClass().add("image-view");
        if(placeHolder != null) {
          effectRegion.getChildren().add(placeHolder);
          placeHolder.getStyleClass().add("place-holder");
          placeHolder.visibleProperty().bind(imageView.imageProperty().isNull());
      public ScaledImageView() {
        this(null);
      @Override
      protected void layoutChildren() {
        Insets insets = effectRegion.getInsets();
        double insetsWidth = insets.getLeft() + insets.getRight();
        double insetsHeight = insets.getTop() + insets.getBottom();
        imageView.setFitWidth(getWidth() - insetsWidth);
        imageView.setFitHeight(getHeight() - insetsHeight);
        layoutInArea(imageView, insets.getLeft(), insets.getTop(), getWidth() - insetsWidth, getHeight() - insetsHeight, 0, alignment.get().getHpos(), alignment.get().getVpos());
        Bounds bounds = imageView.getLayoutBounds();
        effectRegion.setMinWidth(bounds.getWidth() + insetsWidth);
        effectRegion.setMinHeight(bounds.getHeight() + insetsHeight);
        effectRegion.setMaxWidth(bounds.getWidth() + insetsWidth);
        effectRegion.setMaxHeight(bounds.getHeight() + insetsHeight);
        layoutInArea(effectRegion,  0, 0, getWidth(), getHeight(), 0, alignment.get().getHpos(), alignment.get().getVpos());
      @Override
      protected double computePrefWidth(double height) {
        return 0;
      @Override
      protected double computePrefHeight(double width) {
        return 0;
      public final ObjectProperty<Image> imageProperty() { return imageView.imageProperty(); }
      public final Image getImage() { return imageView.getImage(); }
      public final void setImage(Image image) { imageView.setImage(image); }
      public final BooleanProperty preserveRatioProperty() { return imageView.preserveRatioProperty(); }
      public final boolean isPreserveRatio() { return imageView.isPreserveRatio(); }
      public final void setPreserveRatio(boolean preserveRatio) { imageView.setPreserveRatio(preserveRatio); }
      public final BooleanProperty smoothProperty() { return imageView.smoothProperty(); }
      public final boolean isSmooth() { return imageView.isSmooth(); }
      public final void setSmooth(boolean smooth) { imageView.setSmooth(smooth); }
    }

  • Border around image links

    What the heck is it with a blue border around image links in
    CS3???? I discovered I can get rid of it by setting the border to 0
    in properties but what a pain. I also noticed tables have a 1
    border by default. I'm sure there is a place to change the default
    but I can't find it.
    Any suggestions?
    thanks,
    CJ

    On Fri, 1 Jun 2007 13:11:16 +0000 (UTC), "SeaJaye"
    <[email protected]> wrote:
    >Win,
    >I like the way you think. For those of us who are cake
    baking challenged, could you put up a recipe for said cake?
    >thanks,
    >cj
    Sure. This set of stuff:
    *zeroes out the margins and paddings
    * guarantees a vertical scrollbar (so no jumping between
    short and
    long pages)
    * establishes colours and fonts etc. for the tags I tend to
    use
    * gives me a way to float images left or right
    * defines a tag that I can use to clear floats (the hr tag,
    in this
    case, since I never use an hr as a visual element: I always
    define
    borders when I need them)
    * styles the form and form elements
    I customize these to suit.
    /* CSS Document */
    margin: 0;
    padding: 0;
    html {
    height: 100%;
    margin: 0;
    padding: 0;
    body {
    min-height: 101%;
    font: 100.01%/130% "Trebuchet MS", Verdana, Helvetica,
    sans-serif;
    color: #000;
    background: #4f865b url(../images/bgTexture.png) repeat;
    margin: 0;
    padding: 0;
    hr {
    height: 0;
    line-height: 0.0;
    font-size: 0;
    margin: 0;
    padding: 0;
    clear: both;
    visibility: hidden;
    h1, h2, h3 {
    font-size: 150%;
    color: #4f865b;
    margin: 20px;
    font-weight: bold;
    h2 {
    font-size: 120%;
    color: #cc6600;
    h3 {
    font-size: 100%;
    color: #4f865b;
    font-style: italic;
    p {
    font-size: 90%;
    margin: 10px 20px;
    ul {
    margin: 10px 20px 10px 40px;
    font-size: 90%;
    a:link {
    color: #cc6600;
    a:visited {
    color: #4f865b;
    a:hover, a:active, a:focus {
    color: #7dd08f;
    .imgLeft {
    border: 1px solid #dfdabd;
    padding: 5px;
    float: left;
    margin-right: 10px;
    .imgRight {
    border: 1px solid #dfdabd;
    padding: 5px;
    float: right;
    margin-left: 10px;
    /***** CONTACT FORM STYLES *****/
    #content form{
    margin: 0;
    width:450px;
    #content fieldset{
    border: 1px solid #d69400;
    margin-bottom: 10px;
    padding:5px 5px 20px 20px;
    #content legend {
    font-size: 120%;
    margin: 12px 0 0 0;
    color: #18006a;
    #content textarea{
    background-color: transparent;
    border: 1px solid #18006a;
    height:200px;
    margin:0 30px 0 0;
    #content label{
    display:block;
    font-size:80%;
    padding-top:5px;
    #content button{
    background-color: #ecc97d;
    display:block;
    width:80px;
    /* sets the enquiry box to the right of the input fields */
    .labelfloat{
    padding-top:20px;/* float:right;*/
    #content input:text, #content select{
    /*background-color: #E8E2C2;*/
    background-color: transparent;
    border: 1px solid #18006a;
    display:block;
    margin:0 0 0 0;
    width:200px;
    /* END FORM STYLES */
    Win
    Win Day, Wild Rose Websites
    http://www.wildrosewebsites.com
    [email protected]
    Skype winifredday

  • Create border around Grid/GridItem

    Hi,
    I am stuck with a problem and no idea on how to proceed on this.
    I have created a Grid and want to draw border around it so its appearance is like table. The borders are just not appearing. Can someone provide any direction what I may be missing.
    Here is the code
    [PHP]
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Style>
            Grid
                horizontal-gap:-1;
                vertical-gap:-1;
                border-color:#000000;
                border-style:solid;
                border-thickness:5;
            GridItem
                border-color:#000000;
                border-style:solid;
                border-thickness:5;
        </mx:Style>
        <mx:Grid x="31" y="24">
            <mx:GridRow>
                <mx:GridItem width="100" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="100" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="100" colSpan="2" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
            </mx:GridRow>
            <mx:GridRow>
                <mx:GridItem width="100" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="120" colSpan="2" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="100" colSpan="3" height="11">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
            </mx:GridRow>
            <mx:GridRow>
                <mx:GridItem width="100" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="100" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
                <mx:GridItem width="120" colSpan="3" height="30">
                    <mx:Label text ="Nitin">
                    </mx:Label>
                </mx:GridItem>
            </mx:GridRow>
        </mx:Grid>
    </mx:Application>
    [/PHP]

    I even tried using the graphics to create border but it is not working
    private var bgColor:uint 
    = 0x000000;
    private var borderColor:uint  = 0x666666;
    private var borderSize:uint   = 2;
    private var cornerRadius:uint = 0;
    var grid:Grid = new Grid();
    grid.graphics.beginFill(bgColor);
    grid.graphics.lineStyle(borderSize, borderColor);
    grid.graphics.drawRoundRect(0, 0, grid.width, grid.height, cornerRadius);
    grid.graphics.endFill();

  • Removing the border around a PopUpButton

    Hi,
    Is there a way to remove the border around a PopUpButton,
    especially the vertical border between the label and the "down"
    arrow (such that it looks like one button, not two)? Thanks in
    advance.
    -los

    My response by email got garbled.
    It should look something like this:
    Button.blankButton{
        upSkin: Embed(source='assets/blank_btn_up.png');
        overSkin: Embed(source='assets/blank_btn_over.png');
        downSkin: Embed(source='assets/blank_btn_down.png');
        disabledSkin: Embed(source='assets/blank_btn_disabled.png');
    Harbs

  • How do I print multiple (4) photos on one page with a border around each?

    How do I print multiple photos on one page with a border around each? I've gone the contact sheet route and adjusted the number of columns but there's only outer margins and very little white space between the photos down the middle of the page.

    Ok, now I feel stupid! I always thought I was printing 6 x 4 but now I realise I can't have done!!
    The photos that I used to print are approx. 5.2" x 4" (i.e. 4 fitted nicely on a page & I had to cut the boarder off).
    I guess I just need to play with different sizes under the 'custom' option in order to get the biggest possible picture!
    Thanks for the help

  • How can I create a white border around figures that are in an image? (CS 6; examples+image included)

    Hi,
    I have CS6 and am wondering how to create a white ("comic style"?) border around figures in an image, as in the examples below. I don't wish to include the black shadow of the border, just the white part.
    Examples:
    Here's the image I'd like to alter, making a white border around the outline of all five figures:
    I researched for quite a while but could find no instructions. It would be very much appreciated if someone knows and would be kind enough to share the technique! Thank you.

    If you make the image a layer (opposed to Background)...
    You could Select the blue with the Magic Wand as Semaphoric says, then fill with white.  Then choose Select - Modify Selection - Contract, and mask or delete the remaining pixels.  The Contract operation will give you a nice border the size you choose.
    For extra credit, you could use Refine Edge to make the selection more accurate.
    Click to see the image  against a dark background.
    -Noel

  • When I have a border around a group of cellsand remove it, it also removes the grid lines. When I go to print the sheet, there are blank spaces where the border had been. I'm sing a MacBook.

    When I have  a border around a group of cell, how do I remove it. If I outline the cells again and then show in the Inspector NO BORDER, it removes not only the borderbut when I go to print it also the grid lines.

    What application are you using? Numbers? Excel? Something else?
    For help with Numbers spreadsheets go to this forum.
    If you are using Excel, Microsoft has a forum to help you.
    If it is something else, let us know what and we will try to point you in the right direction.
    Best of luck.

  • How can I print with black border around edge of image?

    I'd like to add a black border around the edge of certain images I'm printing. I know it's fairly trivial in Lightroom, but I can't see where this option is in Aperture. Is this lacking in Aperture, or am I just missing it? Many thanks.
    PS -- I'm aware there are some plug-ins that claim to do this, so if Aperture can't do this, please feel free to chime in with comments on the best plug-in for this task.

    Rich Hayhurst wrote:
    Here's what you need:
    http://www.apple.com/downloads/macosx/aperture/apertureborderfx.html
    Aperture BorderFX 1.1
    Thanks, Rich. That's a good plug-in, and does cover what I need (with lots of other features, too). The problem, though, is it requires an export of the image, which I then have to either print from another application, or reimport to Aperture to print. I was hoping to find something that will either just apply the border to the print job, or that would serve as more of an Edit With . . . type of plug-in than an Export plug-in, so I can keep everything in one place. Thanks again.
    Message was edited by: jeffd55

  • How to get rid of the black border around the artboard

    Hopefully my last question for tonight.
    I need to get rid of the black border around the artboard. The two images show my drawing lined up with the art board and then inside the artboard. The dark gray is not the artboard.
    As you see, the artboard has a black border. I need to get rid of it. It shows up in my project when my color key is green. The black won't go to transparent.
    So how-to get rid of the border? Thanks
    ***Update***
    I figured it out. View > Hide Artboards. Maybe this will help someone. Doesn't change the fact my spider looks like a tick:)

    Doesn't change the fact my spider looks like a tick:)
    Try to get hold of a real spider and take a look at its anatomy, specially where the legs sprout from :-)

  • Thin white border around image in browser

    In Firefox and Safari a thin white border appears around a
    black image. My background is black so.....is it a matter of the
    blacks being slightly different? I'd like the image to appear
    seamless on the page. How can I fix this?
    http://wall-eye.com/about.html
    (it's the Walleye eye navigation image)
    keith

    Hi, Even when you assign 100% to width and height you will notice one black border around applet in case of IE5.0 When I go in to full srceen mode in IE 5.0 It should not show me scrollbars.
    But because of this border scrollbar remains

  • How to make a round border around my picture?

    I am trying to design a logo that would fit into the center of a Frisbie, yet I cannot figure out how to make a round border around the picture. I have tried using the eliptical tool, and have also tried using the cookie cutter. The only option I can get to work with the eliptical tool, is the feather, yet I can't change the pixel number for some reason, so it just makes a thin circle around the picture. I thought I could cut and paste it, but the copy and cut options were grayed out and didn't work. When I used the cookie cutter, it made a nice border, and I pasted the picture into it, but, there are four sections that need to be filled in with the background color and the paintbucket didn't work in those spaces (they are the gray and white checked areas. (the picture ends up looking like a rectangle inside of a circle). So I made a new blank file and filled it in with the color of the picture's background, hoping to use the cookie cutter tool around the picture that was now pasted into the new blank file (I chose another color for the round border) and I used the cookie cutter around the picture, but when it was finished, the whole picture ended up being white. All I want to do is to make a border around a picture (a round border). Nothing I have done has worked though. What am I doing wrong, or what are some other options for trying to do this? Thanks.

    Here is a simple way to add a border. Select the item, add a blank layer, choose the border size and color and the Outside option:
    Here is the result:
    Note that you don't even need to do the Stroke on a blank layer. You can Stroke directly on the picture layer. However having the blank layer preserves the picture in case you want to start again with different Stroke options.
    If this is not what you are looking to do, please clarify.

Maybe you are looking for

  • Issue with pictures changing from light to dark

    This is hard to explain, I finish editing my pictures, save as PSD and a 2nd as jpeg. i view the picture in windows live gallery (windows 7 64bit) and it has changed to a dark deep contrast. I open the jpeg or the PSD file and they both appear as i o

  • Repeat credit checking for released sales orders

    Hi, We are implementing FSCM Credit management in our project. In our system, when the sales order is created, the credit check will happen and the failed orders will go to VKM1. Till the order is released, any change to that order will trigger the c

  • FBL5N - AR customer line item display

    Hi all, Is it possible to format the layout of FBL5N so that a customers purchase order number is displayed? I have attempted to find 'your ref' and 'purchase order number' as hidden fields to reveal but they don't seem to be reporting options. Is th

  • Finder freezes with WD My Book Studio drive

    About 14 months ago, I bought a 1TB Western Disk Digital My Book Studio external disk drive to use with Time Machine and it works fine. Two months ago, I bought a 750GB Western Digital My Book Studio disk drive to store my photos and other files. It

  • Displayport audio vs USB audio

    I have pre-Thunderbolt 27 display that is offering my 2011 Mac Mini 2 audio options : Display Port vs USB audio Now, I beleive if I will have to plug in the USB cable either way, to ge the USB hub, microphone, camera to work. So I don't believe I can