Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-24-2009, 10:41 AM
Member
 
Join Date: Apr 2009
Posts: 1
Rep Power: 0
madhuvanthi2312 is on a distinguished road
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:

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:

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 Images:
File Type: jpg image.jpg (84.6 KB, 2 views)
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 04-25-2009, 10:00 AM
makpandian's Avatar
Senior Member
 
Join Date: Dec 2008
Location: Chennai
Posts: 253
Rep Power: 2
makpandian is on a distinguished road
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)
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
tooltip should be visible when button disabled Sureshgurram SWT / JFace 0 03-25-2009 09:00 AM
only ~200x200px Applet area visible jumper19 New To Java 8 02-02-2009 04:05 AM
Address bar not visible Akashchopra521 New To Java 0 12-03-2008 08:13 AM
constructor ... is not visible emceenugget New To Java 2 09-27-2008 06:12 AM
How do you keep multiple popups visible? Jacob Abernathy New To Java 6 09-15-2008 07:35 PM


All times are GMT +2. The time now is 02:46 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org