Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to make buttons on JFace dialog
How to make buttons on JFace dialog [message #51143] Wed, 28 May 2003 08:10 Go to next message
Eclipse UserFriend
Originally posted by: mnaglik.NOSPAMgazeta.pl

I've got simple form with two labels and two texts
and I want two have default buttons on it (inherited from jface.dialog)

But they don't appear when I call createButtonBar(parent);
Even when I override createButtonsForButtonBar...

What should I change in code bellow?

----

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class ProductDialog extends Dialog {

/**
* @param arg0
*/
public ProductDialog(Shell shell) {
super(shell);
}



/**
* @see
org.eclipse.jface.window.Window#createContents(org.eclipse.s wt.widgets.Compo
site)
*/
protected Control createContents(Composite container) {
Composite parent = (Composite) super.createDialogArea(container);
Composite composite = new Composite(parent,SWT.NONE);

GridLayout layout = new GridLayout();
composite.setLayout(layout);
layout.numColumns = 2;
layout.verticalSpacing = 9;

Label label0 = new Label(composite,SWT.NONE);
label0.setText("Produkt:");

Text text0 = new Text(composite,SWT.BORDER);

Label label1 = new Label(composite,SWT.NONE);
label1.setText("Ilo
Re: How to make buttons on JFace dialog [message #51199 is a reply to message #51143] Wed, 28 May 2003 09:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stelian.iancu.gmxREMOVE.net

In your dialog class overwrite createDialogArea(Composite aParent) and
createButtonBar(Composite aParent). Here's an example.

--
Regards,
Stelian Iancu


"Marcin" <mnaglik@NOSPAMgazeta.pl> wrote in message
news:bb1qnh$e59$1@rogue.oti.com...
> I've got simple form with two labels and two texts
> and I want two have default buttons on it (inherited from jface.dialog)
>
> But they don't appear when I call createButtonBar(parent);
> Even when I override createButtonsForButtonBar...
>



Re: How to make buttons on JFace dialog [message #54373 is a reply to message #51143] Thu, 29 May 2003 16:28 Go to previous message
Eclipse UserFriend
Originally posted by: knut_radloff.oti.com

You should override createDialogArea instead of createContents.
You are missing the call to initializeDialogUnits that Dialog.createContents does for you. If you don't want to override
createDialogArea for some reason you should call super.createContents in your createContents method and then use the result of
getDialogArea to create your dialog widgets.
Just rename createContents to createDialogArea.

Knut
"Marcin" <mnaglik@NOSPAMgazeta.pl> wrote in message news:bb1qnh$e59$1@rogue.oti.com...
> I've got simple form with two labels and two texts
> and I want two have default buttons on it (inherited from jface.dialog)
>
> But they don't appear when I call createButtonBar(parent);
> Even when I override createButtonsForButtonBar...
>
> What should I change in code bellow?
>
> ----
>
> import org.eclipse.jface.dialogs.Dialog;
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.layout.GridLayout;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Control;
> import org.eclipse.swt.widgets.Label;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Text;
>
> public class ProductDialog extends Dialog {
>
> /**
> * @param arg0
> */
> public ProductDialog(Shell shell) {
> super(shell);
> }
>
>
>
> /**
> * @see
> org.eclipse.jface.window.Window#createContents(org.eclipse.s wt.widgets.Compo
> site)
> */
> protected Control createContents(Composite container) {
> Composite parent = (Composite) super.createDialogArea(container);
> Composite composite = new Composite(parent,SWT.NONE);
>
> GridLayout layout = new GridLayout();
> composite.setLayout(layout);
> layout.numColumns = 2;
> layout.verticalSpacing = 9;
>
> Label label0 = new Label(composite,SWT.NONE);
> label0.setText("Produkt:");
>
> Text text0 = new Text(composite,SWT.BORDER);
>
> Label label1 = new Label(composite,SWT.NONE);
> label1.setText("Ilo
Previous Topic:Problem with markers
Next Topic:eclipse not handling international chars
Goto Forum:
  


Current Time: Wed Jul 17 12:58:23 GMT 2024

Powered by FUDForum. Page generated in 0.03347 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top