<i id='wrnbQ'><tr id='wrnbQ'><dt id='wrnbQ'><q id='wrnbQ'><span id='wrnbQ'><b id='wrnbQ'><form id='wrnbQ'><ins id='wrnbQ'></ins><ul id='wrnbQ'></ul><sub id='wrnbQ'></sub></form><legend id='wrnbQ'></legend><bdo id='wrnbQ'><pre id='wrnbQ'><center id='wrnbQ'></center></pre></bdo></b><th id='wrnbQ'></th></span></q></dt></tr></i><div id='wrnbQ'><tfoot id='wrnbQ'></tfoot><dl id='wrnbQ'><fieldset id='wrnbQ'></fieldset></dl></div>

<small id='wrnbQ'></small><noframes id='wrnbQ'>

<legend id='wrnbQ'><style id='wrnbQ'><dir id='wrnbQ'><q id='wrnbQ'></q></dir></style></legend>
    <bdo id='wrnbQ'></bdo><ul id='wrnbQ'></ul>

<tfoot id='wrnbQ'></tfoot>
      1. 如何制作在所有窗口分辨率下显示相似行为(布局)的 SWT/JFace 对话框

        How to make SWT/JFace dialogs which show similar behaviour(layouts) under all window resolutions(如何制作在所有窗口分辨率下显示相似行为(布局)的 SWT/JFace 对话框)
        <i id='BiipC'><tr id='BiipC'><dt id='BiipC'><q id='BiipC'><span id='BiipC'><b id='BiipC'><form id='BiipC'><ins id='BiipC'></ins><ul id='BiipC'></ul><sub id='BiipC'></sub></form><legend id='BiipC'></legend><bdo id='BiipC'><pre id='BiipC'><center id='BiipC'></center></pre></bdo></b><th id='BiipC'></th></span></q></dt></tr></i><div id='BiipC'><tfoot id='BiipC'></tfoot><dl id='BiipC'><fieldset id='BiipC'></fieldset></dl></div>
          • <bdo id='BiipC'></bdo><ul id='BiipC'></ul>
          • <tfoot id='BiipC'></tfoot>

                <small id='BiipC'></small><noframes id='BiipC'>

                <legend id='BiipC'><style id='BiipC'><dir id='BiipC'><q id='BiipC'></q></dir></style></legend>
                  <tbody id='BiipC'></tbody>
                1. 本文介绍了如何制作在所有窗口分辨率下显示相似行为(布局)的 SWT/JFace 对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我创建的 JFace 对话框在不同分辨率下显示布局差异.如何在 JFace 或 SWT 中创建在所有分辨率下显示相同布局的对话框,就像在 Eclipse 中使用的对话框一样.

                  The JFace Dialogs I have created show difference in layouts under different resolutions.How to create dialog in JFace or SWT which show same layout under all resolutions just like the dialogs used in Eclipse.

                  我的意思是,在将屏幕分辨率更改为 800x600 像素并选择超大字体时,对话框的布局会受到干扰,而 Eclipse IDE 对话框并非如此.请查看我的对话框的屏幕截图.

                  i mean that on changing the screen resolution to 800x600 pixels and choosing extra large fonts the layout of the dialog gets disturbed which is not the case with Eclipse IDE dialogs.Just check out the screenshot of my dialog.

                  推荐答案

                  好的,根据聊天中的讨论,之前编写此代码的人似乎限制了单个小部件的大小.我创建了一个类似于您问题中的虚拟对话框.它不限制小部件的大小.相反,布局负责调整大小:

                  Ok, based on the discussion in chat, it seems like the guys previously working on this code restricted the size of the individual widgets. I created a dummy dialog which resembles the one in your question. It does not restrict widget sizes. Instead the layouts take care of the sizing:

                  import org.eclipse.jface.dialogs.Dialog;
                  import org.eclipse.jface.dialogs.IDialogConstants;
                  import org.eclipse.swt.SWT;
                  import org.eclipse.swt.layout.GridData;
                  import org.eclipse.swt.layout.GridLayout;
                  import org.eclipse.swt.widgets.Button;
                  import org.eclipse.swt.widgets.Combo;
                  import org.eclipse.swt.widgets.Composite;
                  import org.eclipse.swt.widgets.Control;
                  import org.eclipse.swt.widgets.Group;
                  import org.eclipse.swt.widgets.Label;
                  import org.eclipse.swt.widgets.List;
                  import org.eclipse.swt.widgets.Shell;
                  import org.eclipse.swt.widgets.Text;
                  
                  public class DummyDialog extends Dialog {
                  
                      private Composite composite;
                  
                      public DummyDialog(Shell parentShell)
                      {
                          super(parentShell);
                          setShellStyle(parentShell.getStyle() | SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
                          setBlockOnOpen(true);
                      }
                  
                      protected Control createDialogArea(Composite parent) {
                          this.composite = (Composite) super.createDialogArea(parent);
                  
                          GridLayout layout = new GridLayout(1, false);
                          layout.marginHeight = 5;
                          layout.marginWidth = 10;
                  
                          composite.setLayout(layout);
                  
                          createContent();
                  
                          return composite;
                      }
                  
                      private void createContent()
                      {
                          createTopContent();
                  
                          createMiddleContent();
                  
                          createBottomContent();
                      }
                  
                      private void createTopContent()
                      {
                          Composite top = new Composite(composite, SWT.NONE);
                  
                          top.setLayout(new GridLayout(2, false));
                          top.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
                  
                          Label firstLabel = new Label(top, SWT.NONE);
                          firstLabel.setText("X-Ref Library");
                          Text firstText = new Text(top, SWT.BORDER);
                          firstText.setText("MANISH2XA");
                          firstText.setEditable(false);
                          firstText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
                  
                          Label secondLabel = new Label(top, SWT.NONE);
                          secondLabel.setText("Text");
                          Text secondText = new Text(top, SWT.BORDER);
                          secondText.setText("Test Lib for Manish");
                          secondText.setEditable(false);
                          secondText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
                      }
                  
                      private void createMiddleContent()
                      {
                          Composite middle = new Composite(composite, SWT.NONE);
                          middle.setLayout(new GridLayout(3, false));
                          middle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                  
                          Group leftGroup = new Group(middle, SWT.NONE);
                          leftGroup.setText("Object Library(s)");
                          leftGroup.setLayout(new GridLayout(1, false));
                          leftGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                  
                          List leftList = new List(leftGroup, SWT.BORDER);
                          leftList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                          leftList.add("DUMMY");
                  
                          Composite buttons = new Composite(middle, SWT.NONE);
                          buttons.setLayout(new GridLayout(1, false));
                  
                          Button moveUp = new Button(buttons, SWT.PUSH);
                          moveUp.setText("Move up");
                          moveUp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
                          Button moveDown = new Button(buttons, SWT.PUSH);
                          moveDown.setText("Move down");
                          moveDown.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
                          Button modify = new Button(buttons, SWT.PUSH);
                          modify.setText("Modify");
                          modify.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
                          Button remove = new Button(buttons, SWT.PUSH);
                          remove.setText("Remove");
                          remove.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
                  
                          Group rightGroup = new Group(middle, SWT.NONE);
                          rightGroup.setText("Source Library(s)");
                          rightGroup.setLayout(new GridLayout(1, false));
                          rightGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                  
                          List rightList = new List(rightGroup, SWT.BORDER);
                          rightList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                          rightList.add("DUMMY");
                      }
                  
                      private void createBottomContent()
                      {
                          Composite bottom = new Composite(composite, SWT.NONE);
                          bottom.setLayout(new GridLayout(3, false));
                          bottom.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
                  
                          Label leftLabel = new Label(bottom, SWT.NONE);
                          leftLabel.setText("Library");
                  
                          Label rightLabel = new Label(bottom, SWT.NONE);
                          rightLabel.setText("Type");
                  
                          new Label(bottom, SWT.NONE);
                  
                          Text leftText = new Text(bottom, SWT.BORDER);
                          leftText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
                  
                          Combo combo = new Combo(bottom, SWT.NONE);
                          combo.add("Object Library");
                          combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
                  
                          Button add = new Button(bottom, SWT.PUSH);
                          add.setText("Add");
                          add.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
                      }
                  
                      protected void configureShell(Shell newShell)
                      {
                          super.configureShell(newShell);
                          newShell.setText("Application Library List");
                      }
                  
                      @Override
                      protected void createButtonsForButtonBar(Composite parent) {
                          super.createButtonsForButtonBar(parent);
                  
                          Button ok = getButton(IDialogConstants.OK_ID);
                          ok.setText("Apply Changes");
                          setButtonLayoutData(ok);
                  
                          Button cancel = getButton(IDialogConstants.CANCEL_ID);
                          cancel.setText("Cancel");
                          setButtonLayoutData(cancel);
                      }
                  
                      public void okPressed()
                      {
                          this.close();
                      }
                  
                      public static void main(String[] args)
                      {
                          new DummyDialog(new Shell()).open();
                      }
                  }
                  

                  这是它的外观:

                  这篇关于如何制作在所有窗口分辨率下显示相似行为(布局)的 SWT/JFace 对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Bytecode features not available in the Java language(Java 语言中不可用的字节码功能)
                  ClassCastException because of classloaders?(ClassCastException 因为类加载器?)
                  How can I add a Javaagent to a JVM without stopping the JVM?(如何在不停止 JVM 的情况下将 Javaagent 添加到 JVM?)
                  Cannot load 64-bit SWT libraries on 32-bit JVM ( replacing SWT file )(无法在 32 位 JVM 上加载 64 位 SWT 库(替换 SWT 文件))
                  Encourage the JVM to GC rather than grow the heap?(鼓励 JVM 进行 GC 而不是增加堆?)
                  Why a sawtooth shaped graph?(为什么是锯齿形图形?)

                  • <small id='BuHOJ'></small><noframes id='BuHOJ'>

                          <bdo id='BuHOJ'></bdo><ul id='BuHOJ'></ul>
                          <tfoot id='BuHOJ'></tfoot>
                          <i id='BuHOJ'><tr id='BuHOJ'><dt id='BuHOJ'><q id='BuHOJ'><span id='BuHOJ'><b id='BuHOJ'><form id='BuHOJ'><ins id='BuHOJ'></ins><ul id='BuHOJ'></ul><sub id='BuHOJ'></sub></form><legend id='BuHOJ'></legend><bdo id='BuHOJ'><pre id='BuHOJ'><center id='BuHOJ'></center></pre></bdo></b><th id='BuHOJ'></th></span></q></dt></tr></i><div id='BuHOJ'><tfoot id='BuHOJ'></tfoot><dl id='BuHOJ'><fieldset id='BuHOJ'></fieldset></dl></div>
                          <legend id='BuHOJ'><style id='BuHOJ'><dir id='BuHOJ'><q id='BuHOJ'></q></dir></style></legend>
                            <tbody id='BuHOJ'></tbody>