Unterschiede
Hier werden die Unterschiede zwischen der gewählten und der aktuellen Version gezeigt.
swt-jface:section-toolbar 2008/02/04 08:21 | swt-jface:section-toolbar 2020/01/22 20:59 aktuell | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | [[swt-jface:swt-jface|Java - SWT/JFace]]\\ | ||
====== Section mit Toolbar ====== | ====== Section mit Toolbar ====== | ||
Folgender Code ermöglicht es Buttons in eine Section einzubauen:\\ | Folgender Code ermöglicht es Buttons in eine Section einzubauen:\\ | ||
+ | \\ | ||
+ | <html> | ||
+ | <script type="text/javascript"><!-- | ||
+ | google_ad_client="pub-9681858985507948"; | ||
+ | google_ad_width = 468; | ||
+ | google_ad_height = 60; | ||
+ | google_ad_format = "468x60_as"; | ||
+ | google_ad_type = "text"; | ||
+ | google_ad_channel = ""; | ||
+ | google_color_border = "cccccc"; | ||
+ | google_color_bg = "FFFFFF"; | ||
+ | google_color_link = "1d2d8c"; | ||
+ | google_color_text = "000000"; | ||
+ | google_color_url = "1d2d8c"; | ||
+ | //--> | ||
+ | </script> | ||
+ | <script type="text/javascript" | ||
+ | src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> | ||
+ | </script> | ||
+ | </html> | ||
+ | \\ | ||
<code java> | <code java> | ||
private void createSectionToolbar(Section section) { | private void createSectionToolbar(Section section) { | ||
- | ToolBarManager m_toolBarManager = new ToolBarManager(SWT.FLAT); | + | ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); |
- | ToolBar toolbar = m_toolBarManager.createControl(section); | + | ToolBar toolbar = toolBarManager.createControl(section); |
final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND); | final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND); | ||
toolbar.setCursor(handCursor); | toolbar.setCursor(handCursor); | ||
Zeile 15: | Zeile 37: | ||
}); | }); | ||
- | Action action1 = new Action("A1"){ // Hier wäre auch ein Action-Konstruktor mit Icon möglich | + | Action action1 = new Action("A1") { // Hier wäre auch ein Action-Konstruktor mit Icon möglich |
public void run(){ | public void run(){ | ||
System.out.println("A1"); | System.out.println("A1"); | ||
} | } | ||
}; | }; | ||
- | m_toolBarManager.add(action1); | + | toolBarManager.add(action1); |
Action action2 = new Action("A2"){ // Hier wäre auch ein Action-Konstruktor mit Icon möglich | Action action2 = new Action("A2"){ // Hier wäre auch ein Action-Konstruktor mit Icon möglich | ||
Zeile 27: | Zeile 49: | ||
} | } | ||
}; | }; | ||
- | m_toolBarManager.add(action2); | + | toolBarManager.add(action2); |
- | m_toolBarManager.update(true); | + | toolBarManager.update(true); |
section.setTextClient(toolbar); | section.setTextClient(toolbar); | ||
} | } | ||
</code> | </code> | ||