1 2 23 24 package net.fenyo.gnetwatch.GUI; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 import org.eclipse.swt.*; 30 import org.eclipse.swt.widgets.*; 31 import org.eclipse.swt.layout.*; 32 import org.eclipse.swt.custom.*; 33 import org.eclipse.swt.events.*; 34 import org.eclipse.swt.graphics.*; 35 import org.eclipse.swt.browser.*; 36 37 42 43 public class DialogAbout extends Dialog { 44 private static Log log = LogFactory.getLog(DialogAbout.class); 45 46 private GridLayout layout = null; 47 private Composite groups_composite = null; 48 private Composite bottom_composite = null; 49 private RowLayout groups_composite_layout = null; 50 private RowLayout bottom_composite_layout = null; 51 private GridData groups_composite_grid_data = null; 52 private Label label_image = null; 53 private GUI gui; 54 55 60 public DialogAbout(final GUI gui, final Shell parent) { 61 super(parent, 0); 62 this.gui = gui; 63 } 64 65 70 public void open() { 71 final Shell parent = getParent(); 72 final Display display = parent.getDisplay(); 73 final Shell shell = new Shell(parent, SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL); 74 shell.setText("GNetWatch - About"); 75 76 layout = new GridLayout(); 79 layout.numColumns = 1; 80 layout.marginHeight = 2; 81 layout.marginWidth = 2; 82 layout.verticalSpacing = 1; 83 shell.setLayout(layout); 84 85 groups_composite = new Composite(shell, SWT.FLAT); 86 groups_composite_layout = new RowLayout(SWT.VERTICAL); 87 groups_composite_layout.fill = true; 88 groups_composite_layout.marginTop = 0; 89 groups_composite_layout.marginBottom = 0; 90 groups_composite.setLayout(groups_composite_layout); 91 groups_composite_grid_data = new GridData(GridData.FILL_VERTICAL); 92 groups_composite.setLayoutData(groups_composite_grid_data); 93 94 96 label_image = new Label(groups_composite, SWT.SHADOW_ETCHED_IN | SWT.BORDER); 97 label_image.setText("Network parameters"); 98 label_image.setImage(new Image(display, "pictures/about.png")); 99 100 102 bottom_composite = new Composite(shell, SWT.FLAT); 103 bottom_composite_layout = new RowLayout(); 104 bottom_composite_layout.fill = true; 105 bottom_composite_layout.marginTop = 0; 106 bottom_composite_layout.marginBottom = 0; 107 bottom_composite_layout.wrap = false; 108 bottom_composite_layout.pack = false; 109 bottom_composite_layout.justify = true; 110 bottom_composite_layout.type = SWT.HORIZONTAL; 111 bottom_composite_layout.marginLeft = 5; 112 bottom_composite_layout.marginTop = 5; 113 bottom_composite_layout.marginRight = 5; 114 bottom_composite_layout.marginBottom = 5; 115 bottom_composite_layout.spacing = 0; 116 bottom_composite.setLayout(bottom_composite_layout); 117 final GridData bottom_composite_grid_data = new GridData(GridData.FILL_HORIZONTAL); 118 bottom_composite.setLayoutData(bottom_composite_grid_data); 119 120 final Button button_ok = new Button(bottom_composite, SWT.PUSH); 121 button_ok.setText(gui.getConfig().getString("license")); 122 123 button_ok.addSelectionListener(new SelectionListener() { 124 public void widgetDefaultSelected(SelectionEvent e) { 125 shell.dispose(); 126 } 127 128 public void widgetSelected(SelectionEvent e) { 129 widgetDefaultSelected(e); 130 } 131 }); 132 133 shell.pack(true); 134 shell.open(); 135 while (!shell.isDisposed()) 136 if (!display.readAndDispatch()) display.sleep(); 137 } 138 } 139 | Popular Tags |