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 8217905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:36:17+00:00 2026-06-07T12:36:17+00:00

I was thinking if there’s a way to apply a style like this onto

  • 0

I was thinking if there’s a way to apply a style like this onto a swt checkbox.
I looked for custom components, but didn’t found anything.
Thank you guys

  • 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-06-07T12:36:19+00:00Added an answer on June 7, 2026 at 12:36 pm

    You can use the following:
    Create a custom button with SWT

    as a starting point. Within the PaintListener you can paint the button in the way you want it to look.

    Here is a small example i just tried:

    import org.eclipse.swt.events.MouseAdapter;
    import org.eclipse.swt.events.MouseAdapter;
    import org.eclipse.swt.events.MouseEvent;
    import org.eclipse.swt.events.PaintEvent;
    import org.eclipse.swt.events.PaintListener;
    import org.eclipse.swt.widgets.Canvas;
    import org.eclipse.swt.widgets.Composite;
    
    public class ImageButton extends Canvas {
        private boolean checked = false;
        private final ImageButton button = this;
    
        public ImageButton(Composite parent, int style) {
            super(parent, style);
    
            this.addPaintListener(new PaintListener() {
                @Override
                public void paintControl(PaintEvent e) {
                    if(checked)
                    {
                        e.gc.drawImage(Icons.ON, 0, 0);
                    }
                    else
                    {
                        e.gc.drawImage(Icons.OFF, 0, 0);
                    }
                    button.setSize(WIDTH_OF_IMAGE, HEIGHT_OF_IMAGE);
                }
            });
            this.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseUp(MouseEvent e) {
                    checked = !checked;
                    redraw();
                }
            });
        }
    }
    

    where Icons.ON and Icons.OFF are the two images and WIDTH_OF_IMAGE and HEIGHT_OF_IMAGE are the width and height of the image you use.

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

Sidebar

Related Questions

I was doing this in a manual way, but i was thinking there may
This might seem as silly question but I am thinking there might be the
This is probably just wishful thinking... Is there any way to check to see
I've been thinking of implementing this system, but can't help but feel there's a
I keep thinking there should be a function for this, but I've searched the
I have this mysql which works, but I can't help thinking there's a better
I'm thinking there's got to be a better way to do this. I'm trying
I have successfully used custom UITableViewCells using separate classes, but I keep thinking there
I'm thinking if there's a way (a component or reference) to breakdown an adodb.recordlist
I'm thinking if there is a way to use javascript to pick up ANY

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.