???今天在修改Editor的實(shí)現(xiàn)方式時(shí)出現(xiàn)了不能顯示的問題,經(jīng)多次跟蹤調(diào)試發(fā)現(xiàn)問題如下,現(xiàn)記錄在此,已備不時(shí)之需:
???在實(shí)現(xiàn)方法public void createPartControl(Composite parent)時(shí)需要以下幾個(gè)設(shè)置,保證Editor的顯示。
1、parent.setLayout(new FillLayout());? //保證Editor中的內(nèi)容全部顯示在parent中
2、??
???Composite shell = new Composite(parent, SWT.EMBEDDED | SWT.MAX??| SWT.SCROLL_PAGE);
??shell.setLayout(new FillLayout()); //這里也必須設(shè)置Layout
3、
??Frame mainframe = SWT_AWT.new_Frame(shell);
??mainframe.setVisible(true); //如果要嵌入Swing/AWT的UI界面必須設(shè)置為可見
4、
??JPanel mainPanel = new JPanel();
??mainPanel.setBackground(Color.WHITE);
???mainframe.add(mainPanel);
??mainPanel.repaint();//其中加入的Panel必須repaint
OK,That's All
???在實(shí)現(xiàn)方法public void createPartControl(Composite parent)時(shí)需要以下幾個(gè)設(shè)置,保證Editor的顯示。
1、parent.setLayout(new FillLayout());? //保證Editor中的內(nèi)容全部顯示在parent中
2、??
???Composite shell = new Composite(parent, SWT.EMBEDDED | SWT.MAX??| SWT.SCROLL_PAGE);
??shell.setLayout(new FillLayout()); //這里也必須設(shè)置Layout
3、
??Frame mainframe = SWT_AWT.new_Frame(shell);
??mainframe.setVisible(true); //如果要嵌入Swing/AWT的UI界面必須設(shè)置為可見
4、
??JPanel mainPanel = new JPanel();
??mainPanel.setBackground(Color.WHITE);
???mainframe.add(mainPanel);
??mainPanel.repaint();//其中加入的Panel必須repaint
OK,That's All