code and specification u asked

code and specification u asked

View Answers

August 30, 2008 at 7:53 PM

Hi friend,

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;


public class BrowserDisplay {
private static final String AT_REST = "Ready";

public void run(String location) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Browser display message");
createContents(shell, location);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}

//create main window content
// maintain param for location

public void createContents(Shell shell, String location) {
shell.setLayout(new FormLayout());

// Create the composite to hold the buttons and text field
Composite controls = new Composite(shell, SWT.NONE);
FormData data = new FormData();
data.top = new FormAttachment(0, 0);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
controls.setLayoutData(data);

// Create the status bar
Label status = new Label(shell, SWT.NONE);
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.bottom = new FormAttachment(100, 0);
status.setLayoutData(data);

// Create the web browser
final Browser browser = new Browser(shell, SWT.BORDER);
data = new FormData();
data.top = new FormAttachment(controls);
data.bottom = new FormAttachment(status);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
browser.setLayoutData(data);

// Create the controls and wire them to the browser
controls.setLayout(new GridLayout(7, false));

// Create the back button
Button button = new Button(controls, SWT.PUSH);
button.setText("Back");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
browser.back();
}
});

// Create the forward button
button = new Button(controls, SWT.PUSH);
button.setText("Forward");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
browser.forward();
}
});

// Create the refresh button
button = new Button(controls, SWT.PUSH);
button.setText("Refresh");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
browser.refresh();
}
});

August 30, 2008 at 7:54 PM

// Create the stop button
button = new Button(controls, SWT.PUSH);
button.setText("Stop");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
browser.stop();
}
});

// Create the address entry field and set focus to it
final Text url = new Text(controls, SWT.BORDER);
url.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
url.setFocus();

// Create the go button
button = new Button(controls, SWT.PUSH);
button.setText("Go");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
browser.setUrl(url.getText());
}
});

// Create the animated "throbber"
Label throbber = new Label(controls, SWT.NONE);
throbber.setText(AT_REST);

// Allow users to hit enter to go to the typed URL
shell.setDefaultButton(button);

// Add event handlers
browser.addCloseWindowListener(new AdvancedCloseWindowListener());
browser.addLocationListener(new AdvancedLocationListener(url));
browser.addProgressListener(new AdvancedProgressListener(throbber));
browser.addStatusTextListener(new AdvancedStatusTextListener(status));

// Go to the initial URL
if (location != null) {
browser.setUrl(location);
}
}

//This class implements a CloseWindowListener for BrowserDisplay

class AdvancedCloseWindowListener implements CloseWindowListener {

// Called when the parent window should be closed

public void close(WindowEvent event) {
// Close the parent window
((Browser) event.widget).getShell().close();
}
}

//This class implements a LocationListener for BrowserDisplay

class AdvancedLocationListener implements LocationListener {
// The address text box to update
private Text location;

//Constructs an AdvancedLocationListener

public AdvancedLocationListener(Text text) {
// Store the address box for updates
location = text;
}


public void changing(LocationEvent event) {
// Show the location that's loading
location.setText("Loading " + event.location + "...");
}

public void changed(LocationEvent event) {
// Show the loaded location
location.setText(event.location);
}
}

August 30, 2008 at 7:55 PM

class AdvancedProgressListener implements ProgressListener {
// The label on which to report progress
private Label progress;

public AdvancedProgressListener(Label label) {
// Store the label on which to report updates
progress = label;
}

public void changed(ProgressEvent event) {
if (event.total != 0) {
int percent = (int) (event.current / event.total);
progress.setText(percent + "%");
} else {
progress.setText("???");
}
}


public void completed(ProgressEvent event) {
progress.setText(AT_REST);
}
}

class AdvancedStatusTextListener implements StatusTextListener {
// The label on which to report status
private Label status;

public AdvancedStatusTextListener(Label label) {
// Store the label on which to report status
status = label;
}

public void changed(StatusTextEvent event) {
// Report the status
status.setText(event.text);
}
}

public static void main(String[] args) {
new BrowserDisplay().run(args.length == 0 ? null : args[0]);
}
}

----------------------------------

Thanks.









Related Tutorials/Questions & Answers:
code and specification u asked - Java Beginners
code and specification u asked  you asked me to send the requirements in detail and the code too.so iam sendind you the specification...(); display.dispose(); } } so i have sent u the code
You asked full source code for search - Development process
You asked full source code for search  Hi, For this code can u give me code for display records when i select any field Search Page var arr = new Array(); arr["Select"] = new Array("-select
Advertisements
CAN U HELP ME TO CODE IN JSP FOR ONLINE VOTING SYSTEM
CAN U HELP ME TO CODE IN JSP FOR ONLINE VOTING SYSTEM  can u help me to code in jsp for online voting system
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??  import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class add1 extends MIDlet implements
ModuleNotFoundError: No module named 'specification'
ModuleNotFoundError: No module named 'specification'  Hi, My... 'specification' How to remove the ModuleNotFoundError: No module named 'specification' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'u'
ModuleNotFoundError: No module named 'u'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'u' How to remove the ModuleNotFoundError: No module named 'u' error
ModuleNotFoundError: No module named 'u'
ModuleNotFoundError: No module named 'u'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'u' How to remove the ModuleNotFoundError: No module named 'u' error
ModuleNotFoundError: No module named 'simple-specification'
ModuleNotFoundError: No module named 'simple-specification'  Hi...: No module named 'simple-specification' How to remove the ModuleNotFoundError: No module named 'simple-specification' error? Thanks   Hi
ModuleNotFoundError: No module named 'turnstile-specification'
ModuleNotFoundError: No module named 'turnstile-specification'  Hi...: No module named 'turnstile-specification' How to remove the ModuleNotFoundError: No module named 'turnstile-specification' error? Thanks   
Thank U - Java Beginners
Thank U  Thank U very Much Sir,Its Very Very Useful for Me. From SUSHANT
data science u of c
data science u of c  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science u of c... the topic "data science u of c". Also tell me which is the good training
u of m data science
u of m data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: u of m data science... the topic "u of m data science". Also tell me which is the good training
ModuleNotFoundError: No module named 'pexpect-u'
ModuleNotFoundError: No module named 'pexpect-u'  Hi, My Python... 'pexpect-u' How to remove the ModuleNotFoundError: No module named 'pexpect-u' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'u-cli'
ModuleNotFoundError: No module named 'u-cli'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'u-cli' How to remove the ModuleNotFoundError: No module named 'u-cli'
quiz asked by my lecturer for array reverse....
quiz asked by my lecturer for array reverse....  consider a 2 dimensional array size m by n.Derive a function that can be used to reverse...; Hello Friend, Try the following code:ADS_TO_REPLACE_1 import java.util.
quiz asked by my lecturer for array reverse....
quiz asked by my lecturer for array reverse....  consider a 2 dimensional array size m by n.Derive a function that can be used to reverse the elements of the array such that the last element of the array becomes the first
Maven Repository/Dependency: org.openmicroscopy | specification
Maven Repository/Dependency of Group ID org.openmicroscopy and Artifact ID specification. Latest version of org.openmicroscopy:specification dependencies. # Version Release Date 1
Java Language Specification
Java Language Specification     ... Language Specification, III Edition is a technical reference for the Java ... the source. This specification avails the accurate, complete, and detailed coverage
u of t data science certificate
u of t data science certificate  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: u of t... that I can learn the topic "u of t data science certificate". Also
Maven dependency for org.openmicroscopy - specification version 5.3.0 is released. Learn to use specification version 5.3.0 in Maven based Java projects
: 'org.openmicroscopy', name: 'specification', version: '5.3.0' Above code... of specification released The developers of   org.openmicroscopy - specification project have released the latest version of this library on 25 Oct 2016
Maven dependency for org.openmicroscopy - specification version 6.3.0 is released. Learn to use specification version 6.3.0 in Maven based Java projects
: 'org.openmicroscopy', name: 'specification', version: '6.3.0' Above code... of specification released The developers of   org.openmicroscopy - specification project have released the latest version of this library on 08 Oct 2021
Maven dependency for org.openmicroscopy - specification version 6.2.3 is released. Learn to use specification version 6.2.3 in Maven based Java projects
: 'org.openmicroscopy', name: 'specification', version: '6.2.3' Above code... of specification released The developers of   org.openmicroscopy - specification project have released the latest version of this library on 23 Jun 2021
Maven dependency for org.openmicroscopy - specification version 6.3.1 is released. Learn to use specification version 6.3.1 in Maven based Java projects
: 'org.openmicroscopy', name: 'specification', version: '6.3.1' Above code... of specification released The developers of   org.openmicroscopy - specification project have released the latest version of this library on 19 May 2022
ModuleNotFoundError: No module named 'thank_u_ostad'
ModuleNotFoundError: No module named 'thank_u_ostad'  Hi, My... 'thank_u_ostad' How to remove the ModuleNotFoundError: No module named 'thank_u_ostad' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'u-msgpack-python'
ModuleNotFoundError: No module named 'u-msgpack-python'  Hi, My... named 'u-msgpack-python' How to remove the ModuleNotFoundError: No module named 'u-msgpack-python' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'flake8-no-u-prefixed-strings'
ModuleNotFoundError: No module named 'flake8-no-u-prefixed-strings'  ...: No module named 'flake8-no-u-prefixed-strings' How to remove the ModuleNotFoundError: No module named 'flake8-no-u-prefixed-strings' error
Can u Look to the error plz - Java Beginners
Can u Look to the error plz  this is my code can u modify it plz and give me the result of it when u check it on eclipse or jcreator plz and i will be more thankfull if u do that :) , oh yeh one thing can you draw a flag
Dear Sir I need to join u
Dear Sir I need to join u  Dear Sir i am santosh Rai from Saudi Arabia please make me understood how to join u and i have one question i want to working with you what is ur process for working with u please send me
how can u reduce the size of textfield?
how can u reduce the size of textfield?  how can u reduce the size of textfield? thanks in advance   import javax.swing.*; public class ReduceTextField extends JFrame { public static void main(String
can u plz try this program - Java Beginners
can u plz try this program  Write a small record management... operation. Thanks in advance   Hi friend, form code... -------------------------  data insert action code
Code
Code  code for connecting c lang to database
code
code    how to write this in java
code
code  code for android sample program
code for this is
code for this is  a b c d c b a a b c c b a a b b a a a code
code
code  please provide code for custom tags.by using currdate tag we need to get current date?please give me code
code
code   hi I need help in creating a java code that reminds user on a particular date about their festival. i have no clue of how to do it.. am looking forward to seek help from you
code
the correct code for a program.The output of the program is listed below...: {Block 5} ADDRESS-3: {San Juan} POST CODE:{6745} ENTER CODE (XX TO stop) CODE:{FF1} QUANTITY:{2} CODE:{TR4} QUANTITY:{1} CODE:XX INVOICE FOR YOUR ORDER Harry
code
code to create the RMI client on the local machine: import java.rmi.*; public... : "+e); } } } However, when the preceding code is executed it results... the correct code
code
code  i have four textboxes.whenever i click on up,down,left or down arrows then the cursor move to another textbox based on the key pressed.i want code for this in javascript
code
line of code to print the amount he should be paid as allowance
code
code  write a program to encrypt and decrypt the cipher text "adfgvx"   Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; import
Y asked Calendar.js File For Subcombo box - Development process
Y asked Calendar.js File For Subcombo box  calendar.js // Array of max days in month in a year and in a leap year monthMaxDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; monthMaxDaysLeap= [31, 29, 31, 30, 31
can u help me to get a calendar with color codes on days ???
can u help me to get a calendar with color codes on days ???  hi roseindia, Can you help me to get the code, I need a calendar with color codes.i,e Sunday,Saturday dates display in blue color and my calendar should takes
Write a program that replaces a, e, i, o, u in Java2
Write a program that replaces a, e, i, o, u in Java2  Write a program that replaces a, e, i, o, u, with the letter z. (i.e. John Smith -> Jzhn Smzth. Also the program reverses the users name (i.e. John Smith -> htimS nhoJ
can u plz explain the http request methods - JSP-Servlet
can u plz explain the http request methods  can u plz explain http request methods? as well in jdbc...how to delete the duplicate records in database?  Hi friend, public interface HttpServletRequest extends
plz help me any one as fast as u can
plz help me any one as fast as u can  A thief Muthhooswamy planned to escape from **** jail. Muthhooswamy is basically a monkey man and he is able to jump across the wall. He practiced to cross a wall and he is able to jump 'X
source code
source code  sir...i need an online shopping web application on struts and jdbc....could u pls send me the source code
source code
source code  sir...i need an online shopping web application on struts and jdbc....could u pls send me the source code
Map code
as we see in google maps and locate our area of interest. Can u tel me how this can be done????????????/ can u help me to do so. plz provide a code which
java code - Java Beginners
java code  can u plz provide source code for the mini project of "online course portal for a campus

Ads