Newcomer: [message #461395] |
Wed, 21 September 2005 16:35  |
Eclipse User |
|
|
|
Originally posted by: info.zuehlke-it.de
I have the following problem, my application become over
"SGVstarter.main()" started.
The Code...
----------------------
public static void main(String[] args) {
Display display = new Display();
Shell topShell = new Shell(display);
topShell.setText("Schadensgutachten Verwaltung V.0");
topShell.setBackground(new Color(display, 160, 160, 255));
topShell.setSize(800, 600);
topShell.setLayout(new GridLayout());
topShell.setMenuBar(new ViewMenu(topShell).getMenu());
new ViewInit(topShell);
...
----------------------
Following one becomes "new ViewInit(topShell)" produced, in this
produced.... it follows now "stacklayout.topControl = inhalt[0];"
----------------------
public class ViewInit{
private static StackLayout stacklayout;
private static Composite[] inhalt = new Composite[5];
private static Composite container;
private static Composite compToolbar;
public ViewInit(Shell shell){
compToolbar = new Composite(shell,SWT.NONE);
GridLayout composite2Layout = new GridLayout();
GridData composite2LData = new GridData();
composite2LData.horizontalAlignment = GridData.FILL;
composite2LData.verticalAlignment = GridData.FILL;
compToolbar.setLayoutData(composite2LData);
compToolbar.setLayout(composite2Layout);
{
GridData toolBar1LData = new GridData();
ToolBar toolBar1 = new ToolBar(compToolbar,SWT.NONE);
toolBar1.setLayoutData(toolBar1LData);
{
ToolItem toolItem1 = new ToolItem(toolBar1,SWT.NONE);
toolItem1.setText("Vorgang");
toolItem1.addListener(SWT.Selection, new Listener()
{
public void handleEvent(Event e)
{
stacklayout.topControl = inhalt[0];
container.layout();
}
});
}
{
ToolItem toolItem2 = new ToolItem(toolBar1,SWT.NONE);
toolItem2.setText("Entschädigung");
toolItem2.addListener(SWT.Selection, new Listener()
{
public void handleEvent(Event e)
{
stacklayout.topControl = inhalt[1];
container.layout();
}
});
}
{
ToolItem toolItem3 = new ToolItem(toolBar1,SWT.NONE);
toolItem3.setText("Berichte");
}
.....
final Composite container = new Composite(shell, SWT.BORDER);
container.setLayoutData(new GridData());
final StackLayout stacklayout = new StackLayout();
container.setLayout(stacklayout);
inhalt[0] = new ViewVorgang(container).getComposite();
----------------------
in the following one produces...
----------------------
public class ViewVorgang extends Composite{
private static Composite comVorgang;
public Composite getComposite(){
return comVorgang;
}
public ViewVorgang(Composite compTop){
super (compTop, SWT.NONE);
comVorgang = new Composite(compTop, SWT.NONE);
GridLayout thisLayout = new GridLayout();
comVorgang.setLayout(thisLayout);
thisLayout.numColumns = 2;
{
...
----------------------
When i use the button "toolItem1", the I get "Exception in thread "main"
java.lang.NullPointerException".
Ok one, to which there is the "debug" mode in eclipse. I set the BREAK
POINT on "comVorgang = new Composite(compTop, SWT.NONE);", there get I
further window with the following message
"Class File Editor
Source not found
etc. etc ."
Which make I wrongly??
(Sorry, please excuses my English)
|
|
|
|
Re: Newcomer: Stacklayout, change a composite [message #461403 is a reply to message #461397] |
Thu, 22 September 2005 01:59   |
Eclipse User |
|
|
|
Originally posted by: info.zuehlke-it.de
Since I only gradually JAVA (OOP), Eclipse and SWT to become acquainted
with, I will certainly produce still further of these errors:)
I had imagined, was however not not safe this already somehow me,
particularly since I had found also still no "complete" example of this
case.
I had the first beginning found under "Constructing SWT layout By Koray
Guclu (google)", but the code is only one fragment.
My background knowledge is not sufficient yet for the remainder.
In this case please I mean to excuse beginner questions, vocationally
program I still under COBOL, I only now change (36 years old) on the OOP
under Java, and in my limited spare time (father of 2 children:)
Thank Rich, I your thoughts will today times convert.
|
|
|
Re: next ...Size of Layout [message #461415 is a reply to message #461397] |
Thu, 22 September 2005 07:20   |
Eclipse User |
|
|
|
Originally posted by: info.zuehlke-it.de
Rich, again thank you. Your references were very well, it functioned now
and I something to it-learned.
Now a further problem, neither under the "shell", has or the following
"composite" any statements of size made.
But a window with a firm size of the "toolBar" and the "container" appears
appears fundamental in the same size. Their sizes are however
substantially less than from the opened Shell.
The announcement of the Composite "inhalt[0]" functioned also, it fills
out the entire Composite "container". The announcement of "inhalt[1]"
however not, it is material larger than "inhalt[0]".
Changing "container" or "toolbar" does not have effect, also that packs
into an outside "composite" and the following thing sets the size has no
success.
Does someone have a tip, a suggestion?
(Sorry for my english, i use the translator from google, i hope you can
understand me ...)
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.29003 seconds