FreeBSD Bugzilla – Attachment 234737 Details for
Bug 264626
x11-toolkits/swt: improve usage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Test code
HelloWorld4.java (text/plain), 1.67 KB, created by
huanghwh
on 2022-06-16 23:03:15 UTC
(
hide
)
Description:
Test code
Filename:
MIME Type:
Creator:
huanghwh
Created:
2022-06-16 23:03:15 UTC
Size:
1.67 KB
patch
obsolete
>/******************************************************************************* > * Copyright (c) 2000, 2003 IBM Corporation and others. > * > * This program and the accompanying materials > * are made available under the terms of the Eclipse Public License 2.0 > * which accompanies this distribution, and is available at > * https://www.eclipse.org/legal/epl-2.0/ > * > * SPDX-License-Identifier: EPL-2.0 > * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >package org.eclipse.swt.examples.helloworld; > > > >import org.eclipse.swt.graphics.GC; >import org.eclipse.swt.graphics.Image; >import org.eclipse.swt.graphics.Rectangle; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; > >/* > * This example builds on HelloWorld2 and demonstrates how to resize the > * Label when the Shell resizes using a Layout. > */ >public class HelloWorld4 { > public static void main(String[] args) { > Display display = new Display(); > Shell shell = new HelloWorld4().open(display); > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) > display.sleep(); > } > display.dispose(); > } > > public Shell open(Display display) { > final Shell shell = new Shell(display); > shell.addPaintListener(e -> { > GC gc = e.gc; > Rectangle bounds = shell.getClientArea(); > Image buffer = new Image(shell.getDisplay(), bounds.width, bounds.height); > GC gc1 = new GC(buffer); > gc1.fillGradientRectangle(0, 0, bounds.width, 50, false); > gc1.dispose(); > gc.drawImage(buffer, 0, 0); > buffer.dispose(); > }); > shell.open(); > return shell; > } >}
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 264626
:
234631
| 234737 |
234738
|
234739