getToolBar() creates a gap below the toolbar on Mac OSX [message #823485] |
Sun, 18 March 2012 11:28 |
nimonic Messages: 6 Registered: October 2011 |
Junior Member |
|
|
I'm using shell.getToolBar() on Mac OSX to get a native toolbar. The toolbar is being created but it is creating a gap between the bottom of the toolbar and the top of the first adjacent component. The gap increases when I increase the size of the tool items.
Is this a bug and is there a workaround?
Here is my code and attached screenshot:
package tests;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Table;
public class MacBar {
protected Shell shell;
private Display display;
private Table table;
/**
* Launch the application.
* @param args
*/
public static void main(String[] args) {
try {
MacBar window = new MacBar();
window.open();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Open the window.
*/
public void open() {
display = Display.getDefault();
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
/**
* Create contents of the window.
*/
protected void createContents() {
shell = new Shell();
shell.setSize(450, 300);
shell.setText("SWT Application");
shell.setLayout(new GridLayout(1, false));
ToolBar toolBar = shell.getToolBar();
// ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.RIGHT);
// toolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
ToolItem toolItem = new ToolItem(toolBar, SWT.NONE);
Image image = new Image(display, 40, 40);
toolItem.setImage(image);
table = new Table(shell, SWT.BORDER | SWT.FULL_SELECTION);
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
table.setHeaderVisible(true);
table.setLinesVisible(true);
}
}
-
Attachment: MacBar.tiff
(Size: 18.55KB, Downloaded 189 times)
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03893 seconds