Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
public class SWTTest2 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("SWTTest2");
shell.setLayout(new FillLayout());
final TabFolder folder = new TabFolder(shell, SWT.NONE);
for (int i = 0; i < 5; i++) {
TabItem item = new TabItem(folder, SWT.BOLD);
item.setText("TabItem" + i);
}
//Wenns keinn FillLayout sein soll könntest du es mal hiermit versuchen...
// shell.addControlListener(new ControlListener(){
//
// public void controlMoved(ControlEvent e) {
// // TODO Auto-generated method stub
//
// }
//
// public void controlResized(ControlEvent e) {
// //System.out.println(e.getSource().getClass());
// Shell s = (Shell)e.getSource();
// Point size = s.getSize();
// folder.setSize(size);
// }
// });
shell.setSize(320, 240);
shell.open();
while (!shell.isDisposed())
if (!display.readAndDispatch())
display.sleep();
}
}
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
public class SWTTest2 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("SWTTest2");
GridLayout grid = new GridLayout();
grid.numColumns = 1;
shell.setLayout(grid);
Composite composite = new Composite(shell, SWT.NONE);
composite.setLayout(new RowLayout());
Combo cbo = new Combo(composite, SWT.NONE);
Button btn = new Button(composite, SWT.PUSH);
btn.setText("Push me");
composite.pack();
final TabFolder folder = new TabFolder(shell, SWT.VERTICAL);
for (int i = 0; i < 5; i++) {
TabItem item = new TabItem(folder, SWT.BOLD);
item.setText("TabItem" + i);
}
GridData data = new GridData(SWT.VERTICAL);
data.verticalAlignment = GridData.FILL;
data.horizontalAlignment = GridData.FILL;
data.grabExcessVerticalSpace = true;
folder.setLayoutData(data);
shell.pack();
shell.setSize(320, 240);
shell.open();
while (!shell.isDisposed())
if (!display.readAndDispatch())
display.sleep();
}
}