Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 11009 Details for
Bug 60328
[Bidi] when mirroring the popup menu item, the icon should be to the right of the text
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Test application for popup menus
TestMenus.java (text/plain), 2.98 KB, created by
Semion Chichelnitsky
on 2004-05-24 10:31:03 EDT
(
hide
)
Description:
Test application for popup menus
Filename:
MIME Type:
Creator:
Semion Chichelnitsky
Created:
2004-05-24 10:31:03 EDT
Size:
2.98 KB
patch
obsolete
>package org.eclipse.swt.examples.controlexample; > >import org.eclipse.swt.*; >import org.eclipse.swt.layout.*; >import org.eclipse.swt.widgets.*; >import org.eclipse.swt.events.*; >import org.eclipse.swt.graphics.*; > >public class TestMenus { > public static void main (String [] args) { > Display display = new Display (); > final Shell shell = new Shell(display); > shell.setLayout(new FillLayout()); > Group gr1 = new Group(shell,SWT.NONE); > gr1.setLayout(new FillLayout()); > gr1.setText("Secondary Shell"); > Group gr2 = new Group(shell,SWT.NONE); > gr2.setLayout(new FillLayout()); > gr2.setText("Top Shell"); > Button b1 = new Button(gr1,SWT.PUSH | SWT.LEFT_TO_RIGHT); > Button b2 = new Button(gr1,SWT.PUSH | SWT.RIGHT_TO_LEFT); > Button b3 = new Button(gr2,SWT.PUSH | SWT.LEFT_TO_RIGHT); > Button b4 = new Button(gr2,SWT.PUSH | SWT.RIGHT_TO_LEFT); > b1.setText("LTR"); > b2.setText("RTL"); > b3.setText("LTR"); > b4.setText("RTL"); > SelectionListener selectionListener[] = new SelectionListener[4]; > for (int i=0; i<4; i++) { > selectionListener[i] = new SelectionAdapter () { > private Menu menu = null; > private boolean vis = false; > public void widgetSelected (SelectionEvent event) { > if (menu == null) { > int menuOrient = (event.widget.getStyle() & SWT.RIGHT_TO_LEFT)!= 0? > SWT.LEFT_TO_RIGHT : SWT.RIGHT_TO_LEFT; > if (((Group)((Button)event.widget).getParent()).getText().equals("Secondary Shell")) { > Shell shell1 = new Shell(shell,menuOrient); > shell1.setBounds(0,0,0,0); > menu = new Menu(shell1,menuOrient); > } > else > menu = new Menu(shell,menuOrient); > for (int j = 0; j < 5; ++j) { > final String text = new String("Text " + j); > MenuItem menuItem = new MenuItem(menu, SWT.NONE); > menuItem.setText(text); > Image img= new Image(null, 10, 10); > GC gc = new GC (img); > gc.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLUE)); > gc.fillRectangle(0, 0, 10, 10); > gc.dispose(); > menuItem.setImage(img); > } > } > > if (vis) { > setMenuVisible(false); > } else { > final Button b = (Button) event.widget; > Rectangle butBounds = b.getBounds(); > Rectangle rect = shell.getDisplay().map(b.getParent(),null,butBounds); > menu.setLocation(rect.x + (rect.width/2), rect.y + (rect.height/2)); > setMenuVisible(true); > } > } > > private void setMenuVisible(boolean visible) { > menu.setVisible(visible); > vis = visible; > } > }; > } > b1.addSelectionListener (selectionListener[0]); > b2.addSelectionListener (selectionListener[1]); > b3.addSelectionListener (selectionListener[2]); > b4.addSelectionListener (selectionListener[3]); > shell.setText("Test popup menus"); > shell.setSize(400,200); > shell.open(); > while (!shell.isDisposed ()) { > if (!display.readAndDispatch ()) display.sleep (); > } > display.dispose (); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 60328
: 11009 |
11330