Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2009
    Posts
    1
    Rep Power
    0

    Default Tab or Table not visible

    Hi!
    I am new to Java and swt. I've just started with eclipse.
    I am trying to display a Table in a Tab accessible through a menu item. The code is as follows:

    This class handles the Menu action:

    Java Code:
    package swt_trial_my_code;
    
    import org.eclipse.jface.action.IAction;
    import org.eclipse.jface.viewers.ISelection;
    import org.eclipse.swt.widgets.Shell;
    import org.eclipse.ui.IWorkbenchWindow;
    import org.eclipse.ui.IWorkbenchWindowActionDelegate;
    
    public class TabTable implements IWorkbenchWindowActionDelegate 
    {
    	IWorkbenchWindow activeWindow;
    	MyTabTableExample example;
    	public void dispose() 
    	{
    		// TODO Auto-generated method stub
    
    	}
    
    	public void init(IWorkbenchWindow window) 
    	{
    		activeWindow = window;
    		Shell shell = activeWindow.getShell();
    		Shell tabShell = new Shell(shell);
    		example = new MyTabTableExample(tabShell);
    		tabShell.open();
    	}
    
    	public void run(IAction action) 
    	{
    		// TODO Auto-generated method stub
    
    	}
    
    	public void selectionChanged(IAction action, ISelection selection) 
    	{
    		// TODO Auto-generated method stub
    
    	}
    
    }
    This class creates a tab folder with only one tab item and should display a table in it:

    Java Code:
    package swt_trial_my_code;
    
    import org.eclipse.swt.SWT;
    import org.eclipse.swt.widgets.Composite;
    import org.eclipse.swt.widgets.Shell;
    import org.eclipse.swt.widgets.TabFolder;
    import org.eclipse.swt.widgets.TabItem;
    import org.eclipse.swt.widgets.Table;
    import org.eclipse.swt.widgets.TableColumn;
    import org.eclipse.swt.widgets.TableItem;
    
    public class MyTabTableExample 
    {
    	TabFolder tab;
    	Composite tableComp;
    	Table table;
    	TabItem page;
    	
    	public MyTabTableExample(Shell shell)
    	{
    		createTab(shell);
    		createTable();
    		createTabItem();
    	}
    	
    	private void createTab(Shell shell)
    	{
    		tab = new TabFolder(shell,SWT.NONE);
    	}
    	
    	private void createTable()
    	{
    		tableComp = new Composite(tab,SWT.NONE);
    		table = new Table(tableComp,SWT.BORDER);
    		table.setLinesVisible(true);
    		table.setHeaderVisible(true);
    		
    		//Columns
    		
    		TableColumn component = new TableColumn(table, SWT.NONE);
    		component.setText("Component");
    		component.setWidth(50);
    		component.pack();
    		
    		TableColumn level = new TableColumn(table,SWT.NONE);
    		level.setText("Level");
    		level.setWidth(50);
    		level.pack();
    		
    		//Items
    		
    		TableItem row0 = new TableItem(table,SWT.NONE);
    		row0.setText(new String[] {"abc","Level 1"});	
    	}
    	
    	private void createTabItem()
    	{
    		page = new TabItem(tab,SWT.NONE);
    		page.setText("Table");
    		page.setControl(tableComp);
    	}
    }
    However, all I get when I go to 'Hello SWT' is a blank pop up as seen in the image. I can't figure out where i've gone wrong.
    Please help me out!
    Attached Thumbnails Attached Thumbnails Tab or Table not visible-image.jpg  

  2. #2
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    431
    Rep Power
    6

    Default

    Dont post a thread once again like this?
    It will not be understood by others.
    Just post By which problem,you are suffering.
    Mak
    (Living @ Virtual World)

Similar Threads

  1. tooltip should be visible when button disabled
    By Sureshgurram in forum SWT / JFace
    Replies: 1
    Last Post: 11-23-2010, 09:58 AM
  2. only ~200x200px Applet area visible
    By jumper19 in forum New To Java
    Replies: 8
    Last Post: 02-02-2009, 03:05 AM
  3. Address bar not visible
    By Akashchopra521 in forum New To Java
    Replies: 0
    Last Post: 12-03-2008, 07:13 AM
  4. constructor ... is not visible
    By emceenugget in forum New To Java
    Replies: 2
    Last Post: 09-27-2008, 05:12 AM
  5. How do you keep multiple popups visible?
    By Jacob Abernathy in forum New To Java
    Replies: 6
    Last Post: 09-15-2008, 06:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •