Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Technology Project and PMC » MenuItem behaves differently on x86 and iPAQ
MenuItem behaves differently on x86 and iPAQ [message #586327] Wed, 20 November 2002 19:49
Chen Shu is currently offline Chen ShuFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,
In the following code, when File MenuItem is clicked, the label changes from
blank to "clicked" and "clicked again" on x86, but it does not change on
iPAQ. Can somebody tell me why?
import org.eclipse.swt.SWT;

import org.eclipse.swt.events.SelectionAdapter;

import org.eclipse.swt.events.SelectionEvent;

import org.eclipse.swt.layout.FillLayout;

import org.eclipse.swt.layout.FormAttachment;

import org.eclipse.swt.layout.FormData;

import org.eclipse.swt.layout.FormLayout;

import org.eclipse.swt.widgets.Display;

import org.eclipse.swt.widgets.Label;

import org.eclipse.swt.widgets.Menu;

import org.eclipse.swt.widgets.MenuItem;

import org.eclipse.swt.widgets.Shell;

public class HelloWorld

{

public static void main(String args[])

{

Display display = new Display();


Shell shell = new Shell(display);


shell.setText("Hello World");


FillLayout layout = new FillLayout();

layout.type = SWT.VERTICAL;

shell.setLayout(layout);

final Label label = new Label(shell, SWT.CENTER|SWT.BORDER|SWT.WRAP);

Menu menubar = new Menu(shell, SWT.BAR);

shell.setMenuBar(menubar);



MenuItem fileMenuItem = new MenuItem(menubar, SWT.CASCADE);

fileMenuItem.setText("File");

fileMenuItem.addSelectionListener(new SelectionAdapter() {

public void widgetSelected(SelectionEvent e) {

if (!label.getText().equals("clicked"))

label.setText("clicked");

else

label.setText("clicked again");

}

});


shell.open();

while (!shell.isDisposed()) {

if (!display.readAndDispatch())

display.sleep();

}

}

}

Thanks,

-Chen
Previous Topic:MenuItem behaves differently on x86 and iPAQ
Next Topic:Can I open multiple text editors within a perspective
Goto Forum:
  


Current Time: Tue Apr 16 21:13:53 GMT 2024

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

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

Back to the top