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

  • Home
  • SEARCH
  • 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 8819191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:17:37+00:00 2026-06-14T05:17:37+00:00

I am trying to take the following method of Swing code and migrate to

  • 0

I am trying to take the following method of Swing code and migrate to SWT for my application.

I know some of it.

SWT SWING
Label JLabel
Button JButton
Dialog JDailog
??? Box

The method looks like it is creating a status dialog and has a cancel button.

How could I do the same but in SWT?
I am not sure what Swing Box is doing?
Is this basically a simple dialog with a cancel button and some labels?

 private void createPrintDialog() {
    pd = new JDialog((Frame) null, "Printing...", false);
    Container top = pd.getContentPane();
    Box lines = Box.createVerticalBox();
    Box line = Box.createHorizontalBox();
    line.add(new Label("Now printing: "));
    Label title = new Label("file.pdf");
    line.add(title);
    lines.add(line);

    line = Box.createHorizontalBox();
    line.add(Box.createHorizontalStrut(10));
    line.add(new Label("page "));
    pagenumlabel = new JLabel("1");
    line.add(pagenumlabel);
    line.add(new JLabel(" of "));
    JLabel totalpages = new JLabel(String.valueOf(file.getNumPages()));
    line.add(totalpages);
    lines.add(line);

    top.add(lines, BorderLayout.CENTER);

    Box cancelbox = Box.createHorizontalBox();
    cancelbox.add(Box.createHorizontalGlue());
    cancel = new JButton(new AbstractAction("Cancel") {

        public void actionPerformed(ActionEvent evt) {
            doCancel();
        }
    });
    cancelbox.add(cancel);
    top.add(cancelbox, BorderLayout.SOUTH);
}
  • 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-14T05:17:38+00:00Added an answer on June 14, 2026 at 5:17 am

    Use org.eclipse.jface.dialogs.MessageDialog. ( There are static method open Error,Info…etc. use it as per your needs)

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

Sidebar

Related Questions

I'm trying to run the following code: import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Reflection
I'm trying to synchronize the following code in iOS5: an object has a method
I'm trying to do the following: http://www.pastebin.org/113337 I'm wondering why the scrolling won't take
While trying to take some arguments for C. I found it really difficult to
I have the following Action Method that I'm trying to redirect from if the
I am trying to pass a List<string> to a method that will take it
I am working with someone else's code and trying to make some modifications. So
I am trying to take table backup before making any change, following this link
I'm trying to design an application following Misko Heverys insights . It's an interesting
I'm trying to test-drive some Scala code using Specs2 and Mockito. I'm relatively new

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.