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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:34:06+00:00 2026-06-08T11:34:06+00:00

I wanted to add one scrollbar into the RoundedRectangle. I have 3 Rounded rectangle

  • 0

I wanted to add one scrollbar into the RoundedRectangle. I have 3 Rounded rectangle in the root figure. Now I want to add scrollbar to each of the rounded rectangle. Is it possible to
add the scrollbar to the rounded rectangle or rectangle figure? I used the following way . But it does not show any figure to me. How to make it work? In the below example, I have added only one rectangle.

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.draw2d.LightweightSystem;
import org.eclipse.draw2d.RoundedRectangle;
import org.eclipse.draw2d.ScrollPane;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class RoundedRectangleTest {

    public static void main(String args[]) {

        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setLayout(new FillLayout());
        shell.setText("Scrollpane Example");

        // Create a root figure and simple layout to contain all other figures
        Figure root = new Figure();
        root.setFont(shell.getFont());
        root.setLayoutManager(new XYLayout());

        ScrollPane scrollPane = new ScrollPane();

        RoundedRectangle r = new RoundedRectangle();
        r.setBackgroundColor(ColorConstants.yellow);
        Rectangle rect = new Rectangle(10, 10, 50, 50);
        r.setBounds(rect);

        scrollPane.setContents(r);

        root.add(scrollPane);

        FigureCanvas canvas = new FigureCanvas(shell, SWT.DOUBLE_BUFFERED);
        canvas.setBackground(ColorConstants.white);
        //canvas.setContents(scrollPane);
        LightweightSystem lws = new LightweightSystem(canvas);
        lws.setContents(root);

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

    }

}
  • 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-08T11:34:07+00:00Added an answer on June 8, 2026 at 11:34 am

    I did not manage to get rounded rectangles, but the following at least works for regular rectangles:

    public class RoundedRectangleTest {
        public static void main(String args[]) {
            Display d = Display.getDefault();
            final Shell shell = new Shell(d);
    
            LightweightSystem lws = new LightweightSystem(shell);
            final Figure contents = new Figure();
            lws.setContents(contents);
            contents.setLayoutManager(new GridLayout());
    
            IFigure rectangleFigure = createFigure();
            ScrollPane pane = new ScrollPane();
    
            /* delete following two lines if scrollbars not always visible */
            pane.setHorizontalScrollBarVisibility(ScrollPane.ALWAYS);
            pane.setVerticalScrollBarVisibility(ScrollPane.ALWAYS);
            pane.setContents(rectangleFigure);
            contents.add(pane);
    
            shell.open();
            shell.setText("Scrollpane Example");
            while (!shell.isDisposed()) {
                if (!d.readAndDispatch())
                    d.sleep();
            }
        }
    
        private static IFigure createFigure() {
            RectangleFigure rectangleFigure = new RectangleFigure();
            rectangleFigure.setBackgroundColor(ColorConstants.yellow);
            rectangleFigure.setSize(100, 100);
            return rectangleFigure;
        }
    }
    

    Maybe you can use this as a starting point and create a Figure like RectangleFigure but with rounded corners.

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

Sidebar

Related Questions

I have a WinForms application, and wanted to add some nice WPF controls, one
For a silly bbcode parser I wanted to add two definitions into one, my
I wanted to add a new property to one of my model (table). Basically
Initially i wanted to add trailing / in my url (lighttpd) which is possible
I have a UIImageView and I wanted to add a black overlay on top
I have a photologue site set up and I really wanted to add an
Wanted to add an alias for one of the charsets that PayPal may use
Basically, I wanted to add a few custom methods to google.maps.Map and Rectangle classes.
I wanted to add one item in the popup when I right click all
In Common-Lisp CLOS Is it possible to dynamically add one more super class in

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.