|
|
|
Re: CollapsibleButtons- Dont see buttons [message #902926 is a reply to message #902921] |
Tue, 21 August 2012 08:47 |
jone smith Messages: 6 Registered: August 2012 |
Junior Member |
|
|
Here is my code :
package ba.fit.imeprojekta.ui.gui.v1;
import org.eclipse.swt.widgets.Display;
public class frmAdministrator {
protected Shell shell;
/**
* Launch the application.
* @param args
*/
public static void main(String[] args) {
try {
frmAdministrator window = new frmAdministrator();
window.open();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Open the window.
*/
public void open() {
Display 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.setVisible(true);
shell.setFullScreen(true);
shell.setSize(635, 406);
shell.setText("SWT Application");
shell.setLayout(null);
CollapsibleButtons collapsibleButtons = new CollapsibleButtons(shell, SWT.NONE, IColorManager.SKIN_AUTO_DETECT);
collapsibleButtons.setBounds(95, 30, 233, 150);
CustomButton customButton = collapsibleButtons.addButton("New Button", "New CollapsibleButton", null, null);
CustomButton customButton_1 = collapsibleButtons.addButton("New Button", "New CollapsibleButton", null, null);
}
}
I am using :
* win 7 ultimate x86
* Eclipse Java EE IDE for Web Developers. Version: Indigo Service Release 2
*SWT and Nebula plugins is latest version.
|
|
|
Re: CollapsibleButtons- Dont see buttons [message #902930 is a reply to message #902926] |
Tue, 21 August 2012 09:08 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
I have not debugged really deep but if you use a layout instead of
setting bounds you use a layout things work as expected.
> protected void createContents() {
> shell = new Shell();
> shell.setVisible(true);
> // shell.setFullScreen(true);
> shell.setSize(635, 406);
> shell.setText("SWT Application");
> shell.setLayout(new GridLayout());
>
> Image itemImage24 = new Image(shell.getDisplay(), Program
> .findProgram("jpg").getImageData().scaledTo(24, 24)); //$NON-NLS-1$
>
> Image itemImage16 = new Image(shell.getDisplay(), Program
> .findProgram("jpg").getImageData().scaledTo(16, 16)); //$NON-NLS-1$
>
> CollapsibleButtons collapsibleButtons = new CollapsibleButtons(shell, SWT.NONE, IColorManager.SKIN_AUTO_DETECT);
> collapsibleButtons.setLayoutData(new GridData(GridData.GRAB_VERTICAL| GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END));
>
> CustomButton customButton = collapsibleButtons.addButton("New Button 1", "New CollapsibleButton", itemImage24, itemImage16);
> CustomButton customButton_1 = collapsibleButtons.addButton("New Button 2", "New CollapsibleButton", itemImage24, itemImage16);
>
> }
Am 21.08.12 10:47, schrieb jone smith:
> Here is my code :
>
> package ba.fit.imeprojekta.ui.gui.v1;
>
> import org.eclipse.swt.widgets.Display;
>
> public class frmAdministrator {
>
> protected Shell shell;
>
> /**
> * Launch the application.
> * @param args
> */
> public static void main(String[] args) {
> try {
> frmAdministrator window = new frmAdministrator();
> window.open();
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> /**
> * Open the window.
> */
> public void open() {
> Display 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.setVisible(true);
> shell.setFullScreen(true);
> shell.setSize(635, 406);
> shell.setText("SWT Application");
> shell.setLayout(null);
>
> CollapsibleButtons collapsibleButtons = new
> CollapsibleButtons(shell, SWT.NONE, IColorManager.SKIN_AUTO_DETECT);
> collapsibleButtons.setBounds(95, 30, 233, 150);
>
> CustomButton customButton = collapsibleButtons.addButton("New
> Button", "New CollapsibleButton", null, null);
>
> CustomButton customButton_1 = collapsibleButtons.addButton("New
> Button", "New CollapsibleButton", null, null);
>
> }
> }
>
> I am using : * win 7 ultimate x86
> * Eclipse Java EE IDE for Web Developers. Version: Indigo Service Release 2
> *SWT and Nebula plugins is latest version.
|
|
|
Powered by
FUDForum. Page generated in 0.03105 seconds