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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:38:30+00:00 2026-06-09T11:38:30+00:00

How do I read values ​​from the formAttachment in Java? here is my code:

  • 0

How do I read values ​​from the formAttachment in Java?

here is my code:

Text one = new Text(composite, SWT.BORDER);
data = new FormData();
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(100, 0);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(sash, 0);
one.setLayoutData(data);

result:

one is left

  • 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-09T11:38:31+00:00Added an answer on June 9, 2026 at 11:38 am

    FormAttachments are used to position a Control. You can fix the edges of a control by using the FormAttachment for left, top, right or bottom. All remaining edges are calculated automatically.
    The simplest possibility is the percentage positioning relative to the edges of the surrounding composite. Here is an example:

    FormData formData = new FormData();
    // Fix the left edge of the control to 25% of the overall width + 10px offset.
    formData.left = new FormAttachment(25, 10);
    // Fix the lower edge of the control to 75% of the overall height + 0px offset.
    formData.bottom = new FormAttachment(75);
    // Tell the control its new position.
    control.setLayoutData(formData);
    

    Alternativelyyou can use the contructor new FormAttachment(control, offset, alignment) to fix an edge of a control relativ to an edge of another control:

    FormData formData = new FormData();
    // Fix left edge 10px to the right of the right edge of otherControl
    formData.left = new FormAttachment(otherControl, 10, SWT.RIGHT);
    // Fix bottom edge at exactly the same height as the one of otherControl
    formData.bottom = new FormAttachment(otherControl, 0, SWT.BOTTOM);
    control.setLayoutData(formData);
    

    There is a really good Eclipse RCP manual by Ralf Ebert here. Unfortunately it is in German. However, you can find images explaining my examples above on the pages 56-57.

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

Sidebar

Related Questions

I am trying to read values from a text file using the Qt code
I'm trying to read values from a text file into a hashtable, I want
I would like to write a function which will read values from a text
I am using this code to read values from an isolated storage IsolatedStorageFile isoStore
I read some values from text boxes and send them via jQuerys post method
I'm new to Python and I'm trying to read some values from an USB
I am new to MySQLdb. I need to read values from a pre-defined database
I have resource bundle as Java class that read values from database. When i
I read values from an local Access mdb-file. One value is stored as string
i used the code below in the levelManager.m to read values from a plist

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.