Reply
Thread Tools
Posts: 425 | Thanked: 132 times | Joined on Mar 2008 @ California
#11
to get swing support in Jalimo you have to install gnu-classpath i believe
__________________
Promises are like babies. Fun to make, but hard to deliver.

Warning: dates on calendar are closer than they appear.
 
jaeezzy's Avatar
Posts: 664 | Thanked: 160 times | Joined on Jul 2008 @ Australia
#12
Here, I've created a simple calculator application using SWT. All went fine except the screen size. It is displayed in a very small area at the top left of the screen in my IT. I've included the screenshot of it as well. How can it made to cover the whole screen? Thanks.
 
Posts: 2 | Thanked: 2 times | Joined on Dec 2005 @ Bay Area, CA
#13
Maybe it's been posted before, but there's an article on the subject in Dr. Dobbs:

Java and the Nokia N810 Internet Tablet
http://www.drdobbs.com/java/208801979
 

The Following 2 Users Say Thank You to dmitchell For This Useful Post:
Posts: 3 | Thanked: 0 times | Joined on Feb 2009 @ Madrid - Spain
#14
[QUOTE=jaeezzy;208406]Here, ...How can it made to cover the whole screen? Thanks.

One thing that is highly recommended is to download the source code of the jalimo-swt-example2. As it is not easy to find it (I don't remember the site) I will copy below this source. As you can see, there is a command (related with fd.open() ), that will allow to go to full screen. It is very simple and I have tested it. It works. Your calculator will be great :-)
Here is the source:

//package org.jalimo.examples.swt;

import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;

public class SwtExample2
{
Display display;
Shell shell;
Button fullscreenButton;
Button fileButton;
Table table;
FileDialog fd;

public static void main(String[] args)
{
new SwtExample2();
}

public SwtExample2()
{
Display.setAppName("SWT Example Two");
display = new Display();

shell = new Shell(display);

display.addFilter(SWT.KeyDown, new Listener()
{
public void handleEvent(Event e)
{
if (e.keyCode == SWT.F6)
toggleFullscreen();
}
});

createGUI();

shell.open();

while (!shell.isDisposed())
{
if (!display.readAndDispatch())
display.sleep();
}
}

private void toggleFullscreen()
{
boolean b = !shell.getFullScreen();
fullscreenButton.setSelection(b);
shell.setFullScreen(b);
}

private void createGUI()
{
fd = new FileDialog(shell, SWT.OPEN);
fd.setText("FooBar!");

Menu bar = new Menu(shell, SWT.BAR);
MenuItem mainHeader = new MenuItem(bar, SWT.CASCADE); mainHeader.setText("Main");
Menu main = new Menu(shell, SWT.DROP_DOWN);
MenuItem item = new MenuItem(main, SWT.PUSH); item.setText("toggle fullscreen");
item.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent se)
{
toggleFullscreen();
}
});

MenuItem item2 = new MenuItem(bar, SWT.PUSH); item2.setText("Exit");
item2.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent se)
{
shell.close();
System.exit(0);
}
});

mainHeader.setMenu(main);
shell.setMenuBar(bar);

shell.setLayout(new FillLayout(SWT.VERTICAL));

Group upper = new Group(shell, SWT.NONE);
upper.setLayout(new FillLayout());

fullscreenButton = new Button(upper, SWT.TOGGLE);
fullscreenButton.setText("toggle fullscreen");
fullscreenButton.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent se)
{
boolean b = fullscreenButton.getSelection();
shell.setFullScreen(b);
}
});

fileButton = new Button(upper, SWT.PUSH);
fileButton.setText("open file\ndialog");
fileButton.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent se)
{
fd.open();
}
});

table = new Table (shell, SWT.VIRTUAL | SWT.BORDER);
table.setItemCount (1000);
table.addListener (SWT.SetData, new Listener () {
public void handleEvent (Event event) {
TableItem item = (TableItem) event.item;
int index = table.indexOf (item);
item.setText ("Item " + index);
}
});

}

}

Don't forget to comment the "package" line.
Hope that helps!!
 
Posts: 3 | Thanked: 0 times | Joined on Feb 2009 @ Madrid - Spain
#15
Sorry. I made a mistake. The line "fd.open();" has nothing to do with "fullscreen". It is just to open de File Dialog.
The right one is " shell.setFullScreen(Boolean b); "
 
Reply


 
Forum Jump


All times are GMT. The time now is 12:48.