Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6801773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:08:28+00:00 2026-05-26T19:08:28+00:00

I am writing a graphical application using SWT. Firstly I created a shell with

  • 0

I am writing a graphical application using SWT. Firstly I created a shell with image background (shell.setBackgroundImage(image)) then I put a composite with another background image, so that I could use it(composite) to place labels inside it. The problem is that I cannot get rid of the gray border around composite. Is it possible to do at all or perhaps there are others way to do that?

Here is the code:

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class Test {

    protected static int gap = 20;

    public static void main (String[] args) {

       Display display = new Display();
       Shell shell = new Shell(display);   
       Image bg_Image = new Image(display, "bg_full.png"); 
       shell.setBackgroundImage(bg_Image);
       shell.setBackgroundMode(SWT.INHERIT_FORCE);  
       shell.setFullScreen(true);

       Image bg = new Image(display, "bg.png");
       Image border = new Image(display, "bg_info.png");
       Image b1 = new Image(display, "button_total_active.png");
       Image b2 = new Image(display, "button_terminal.png");
       Image b3 = new Image(display, "button_operator.png");
       Image b4 = new Image(display, "button_contract.png");

       Composite composite = new Composite(shell, SWT.NONE);
       composite.setBackgroundImage(bg);
       composite.setBackgroundMode(SWT.INHERIT_FORCE);
       composite.setBounds(80, 220, bg.getBounds().width, bg.getBounds().height);

       Label label1 = new Label(composite, SWT.NONE);
       label1.setImage(b1);
       label1.setBounds(gap, gap, b1.getBounds().width, b1.getBounds().height);

       Label label2 = new Label(composite, SWT.NONE);
       label2.setImage(b2);
       label2.setBounds(gap, gap*2+b1.getBounds().height, b2.getBounds().width, b2.getBounds().height);

       Label label3 = new Label(composite, SWT.NONE);
       label3.setImage(b3);
       label3.setBounds(gap, gap*3+b1.getBounds().height*2, b3.getBounds().width, b3.getBounds().height);

       Label label4 = new Label(composite, SWT.NONE);
       label4.setImage(b4);
       label4.setBounds(gap, gap*4+b1.getBounds().height*3, b4.getBounds().width, b4.getBounds().height);

       Label label5 = new Label(composite, SWT.NONE);
       label5.setImage(border);
       label5.setBounds(gap*2+b1.getBounds().width, gap, border.getBounds().width, border.getBounds().height);

       shell.open();
       while (!shell.isDisposed()) {
           if (!display.readAndDispatch())
                display.sleep();      
       }
       display.dispose();

   }
}

Here is a sample image

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:08:29+00:00Added an answer on May 26, 2026 at 7:08 pm

    These are not gray borders (you removed them by SWT.INHERIT_FORCE), these are transparent corners of the image that are not transparent because there is a composite behind them. As far as I know you cannot remove the corners of the image using it as a background of a Composite. If these corners are transparent (and not white), you can draw this image on the Shell (without creating any Composite) using GC as shown here.
    When placing transparent images, put them on the object you expect to see behind. Hope I helped u. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a graphical application using Objective-C for the front end and C++ for
I am writing a client-side Swing application (graphical font designer) on Java 5 .
I'm writing a Direct3D application, using DirectX 9. Although it works on my PC,
I am writing an AR application on iOS and am using CATransform3D transforms on
I am writing a desktop application and trying to decide between using AIR (FLex)
When writing a graphical interface, using Java, what's the appropriate way of switching between
In my Android application I have created an SVG image converter class. It parses
I am writing jython application with eclipse SWT/JFace. I have to pass float array
I'm writing an application which as part of it draws an image on a
I'm using this example project's XNA 4.0 form control in an application I'm writing:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.