Skip to main content



      Home
Home » Newcomers » Newcomers » Problem in viewing "Editor"
Problem in viewing "Editor" [message #267713] Wed, 14 January 2009 06:58
Eclipse UserFriend
Hi,I am developing an "Editor" where i have added widgets in the using
SWT/JFace..When i proceeded with adding "menus" a strange thing is
happening..The window is showing only the menu with the 1 item i
added..but after resizing the window its showing the other widgets.like if
i MAXIMIZE it or RESIZE it with the MOUSE..

Please help me out of this situation..

I have used FormLayout to set the layout.

I am also sending the code along with this document..


import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;



public class EditorTry4 extends ApplicationWindow
{
public EditorTry4()
{
super(null);

}

protected Control createContents(Composite parent)
{
getShell().setText("Graphical Custom Editor ");

getShell().setBounds(100,100,380,500);



int i;


GroupandTabfolder2 GT = new GroupandTabfolder2(parent);


return parent;
}

public static void main(String args[])
{
EditorTry4 ET4 = new EditorTry4();
ET4.setBlockOnOpen(true);
ET4.open();

Display.getCurrent().dispose();

}

}


class GroupandTabfolder2 extends Composite
{
public GroupandTabfolder2(Composite parent)
{
super(parent,SWT.NONE);


FormLayout layout = new FormLayout();
setLayout(layout);

/****************

Here i have added the menu
If you try removing only the menu the
the other widgets appear with ease..

****************** */
Menu menu = new Menu(this.getShell(),SWT.BAR);
MenuItem item1 = new MenuItem(menu,SWT.CASCADE);
item1.setText("&File");

Menu fileMenu = new Menu(item1);
item1.setMenu(fileMenu);

this.getShell().setMenuBar(menu);


Group g;


g = new Group(this,SWT.SHADOW_ETCHED_IN);

FormData form = new FormData();
form.top = new FormAttachment(2);
form.bottom = new FormAttachment(99);
form.left = new FormAttachment(1);
form.right = new FormAttachment(35);

g.setLayoutData(form);
g.setText(" Tables ");


TabFolder TF = new TabFolder(this,SWT.PUSH);
form = new FormData();
form.left = new FormAttachment(g,5);
form.top = new FormAttachment(2);
form.right = new FormAttachment(99);
form.bottom = new FormAttachment(50);
TF.setLayoutData(form);


buildTabWidgets(TF);

TabFolder TF1 = new TabFolder(this,SWT.PUSH);
form = new FormData();
form.left = new FormAttachment(g,5);
form.top = new FormAttachment(TF,5);
form.bottom = new FormAttachment(80);
form.right = new FormAttachment(99);
TF1.setLayoutData(form);

buildTabWidgets1(TF1);

Group g2 = new Group(this,SWT.NONE);
Group g3 = new Group(this,SWT.NONE);
Group g4 = new Group(this,SWT.NONE);

g2.setText("Index_field");

form = new FormData();
form.left = new FormAttachment(g,6);
form.top = new FormAttachment(TF1);
form.bottom = new FormAttachment(99);

g2.setLayoutData(form);

g3.setText("Unique_field");
form = new FormData();
form.left = new FormAttachment(g2,6);
form.top = new FormAttachment(TF1);
form.bottom = new FormAttachment(99);

g3.setLayoutData(form);


g4.setText("Parameter");
form = new FormData();
form.left = new FormAttachment(g3,6);
form.top = new FormAttachment(TF1);
form.bottom = new FormAttachment(99);

g4.setLayoutData(form);


}

void buildTabWidgets(TabFolder tabfolder)
{
TabItem item1 = new TabItem(tabfolder,SWT.SHADOW_ETCHED_IN);
TabItem item2 = new TabItem(tabfolder,SWT.SHADOW_ETCHED_IN);
TabItem item3 = new TabItem(tabfolder,SWT.SHADOW_ETCHED_IN);

item1.setText("Fields");
item2.setText("Unique");
item3.setText("Indexes");
}

void buildTabWidgets1(TabFolder tabfolder)
{
TabItem item1 = new TabItem(tabfolder,SWT.SHADOW_ETCHED_IN);
TabItem item2 = new TabItem(tabfolder,SWT.SHADOW_ETCHED_IN);
TabItem item3 = new TabItem(tabfolder,SWT.SHADOW_ETCHED_IN);


item1.setText("Bit_value");
item2.setText("Default");
item3.setText("Enum_value");

}

void buildTabWidgets2(TabFolder tabfolder)
{
TabItem item1 = new TabItem(tabfolder,SWT.SHADOW_ETCHED_IN);
item1.setText("Index_field");

}

void buildTabWidgets3(TabFolder tabfolder)
{
TabItem item1 = new TabItem(tabfolder,SWT.SHADOW_ETCHED_IN);
item1.setText("Unique field");

}

void buildTabWidgets4(TabFolder tabfolder)
{
TabItem item1 = new TabItem(tabfolder,SWT.SHADOW_ETCHED_IN);
item1.setText("Param");
}



}
Previous Topic:disable "file changed" dialog
Next Topic:Trouble running JUnit Plugin Tests (CNF exceptions)
Goto Forum:
  


Current Time: Thu Jul 17 09:21:01 EDT 2025

Powered by FUDForum. Page generated in 0.32217 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top