Results 1 to 4 of 4
Thread: extra line in GridLayout
- 03-23-2009, 11:28 PM #1
Member
- Join Date
- Mar 2009
- Posts
- 8
- Rep Power
- 0
extra line in GridLayout
Hello,
I'm trying to put together a GUI with a table and two buttons. I'm using GridLayout and a JFace ApplicationWindow. When I launch my app, there is one extra element in the application that I never add to the Composite parent. I've attached the jpg of the application with the extra line circled. My code is posted below. How is this extra horizontal line being added? Is it added before the createContents method is called? How do I get rid of it?
Java Code:protected Control createContents(Composite parent) { final TableViewer tableViewer = new TableViewer(parent); tableViewer.setContentProvider(new FileTableContentProvider()); GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); //gridData.verticalSpan = 5; gridData.heightHint = 200; gridData.widthHint = 400; tableViewer.getTable().setLayoutData(gridData); Composite rightColumn = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 1; rightColumn.setLayout(gridLayout); Button addDirectoriesButton = new Button(rightColumn, SWT.PUSH); addDirectoriesButton.setText("Add Directories"); addDirectoriesButton.addMouseListener(new MouseListener() { @Override public void mouseDoubleClick(MouseEvent arg0) { } @Override public void mouseDown(MouseEvent arg0) { } @Override public void mouseUp(MouseEvent mouseEvent) { DirectoryDialog directoryDialog = new DirectoryDialog(mouseEvent.widget.getDisplay().getActiveShell()); directoryDialog.setText("Add Files"); directoryDialog.setFilterPath("c:\\"); String fileName = directoryDialog.open(); if (fileName != null) tableViewer.setInput(new File(fileName)); } }); addDirectoriesButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_BEGINNING)); Button clearDirectoriesButton = new Button(rightColumn, SWT.PUSH); clearDirectoriesButton.setText("Clear Directories"); clearDirectoriesButton.addMouseListener(new MouseListener() { @Override public void mouseDoubleClick(MouseEvent arg0) { } @Override public void mouseDown(MouseEvent arg0) { } @Override public void mouseUp(MouseEvent arg0) { } }); return parent; } @Override protected Layout getLayout() { GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 3; return gridLayout; } @Override protected Point getInitialSize() { return new Point(600, 350); }
- 03-24-2009, 12:48 PM #2
Member
- Join Date
- Mar 2009
- Posts
- 42
- Rep Power
- 0
I think problem is with ur FileTableContentProvider() ,
- 03-24-2009, 05:45 PM #3
Member
- Join Date
- Mar 2009
- Posts
- 8
- Rep Power
- 0
Hello,
Thanks, I actually tried removing different elements yesterday to debug the issue. Even when I removed the entire TableViewer from the GridLayout and just have a label, that line is still there.
I checked the parent object passed to createContents, and when the getChildren method is called, it looks like there's already a Label object that's a child. Is there a way to clear all child elements of a Composite object?
Are you able to reproduce this or is it just me? I'm using 3.4 Ganymede.
-Danny
- 03-25-2009, 05:36 AM #4
Member
- Join Date
- Mar 2009
- Posts
- 42
- Rep Power
- 0
Similar Threads
-
[SOLVED] Attaching/Including extra package
By Eranga in forum NetBeansReplies: 16Last Post: 07-01-2008, 10:25 AM -
[SOLVED] File I/O Extra Credit Assignment FTW!
By Bascotie in forum New To JavaReplies: 9Last Post: 06-10-2008, 08:20 AM -
Extra bracket
By CrazyShells Slam in forum New To JavaReplies: 5Last Post: 05-16-2008, 06:12 AM -
SWT GridLayout
By Java Tip in forum Java TipReplies: 0Last Post: 01-08-2008, 09:04 AM -
Gridlayout
By Marty in forum AWT / SwingReplies: 2Last Post: 05-31-2007, 11:48 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks