最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

简易浏览器代码(JAVA)

IT圈 admin 29浏览 0评论

2024年3月31日发(作者:势伟彦)

package ch11;

import yout;

import ;

import ;

import y;

import rm;

import ;

import ite;

import ta;

import r;

import r;

import ;

import ssBar;

import r;

import em;

import ;

import em;

import ;

public class E11_1 {

private Shell sShell = null;

private ViewForm viewForm = null;

private Composite composite = null;

private CoolBar coolBar = null;

private Browser browser = null;

private Label label = null;

private ProgressBar progressBar = null;

private ToolBar toolBar = null;

private Combo combo = null;

/**

* This method initializes viewForm

*

*/

private void createViewForm() {

GridData gridData = new GridData();

ntalAlignment = ;

cessHorizontalSpace = true;

cessVerticalSpace = true;

alAlignment = ;

viewForm = new ViewForm(sShell, );

outData(gridData);

createCoolBar();

Left(coolBar);

createBrowser();

tent(browser);

}

/**

* This method initializes composite

*

*/

private void createComposite() {

GridData gridData2 = new GridData();

ntalAlignment = ;

cessHorizontalSpace = true;

alAlignment = ;

GridLayout gridLayout = new GridLayout();

umns = 2;

GridData gridData1 = new GridData();

ntalAlignment = ;

cessHorizontalSpace = true;

alAlignment = ;

composite = new Composite(sShell, );

outData(gridData1);

out(gridLayout);

label = new Label(composite, );

t("浏览器");

outData(gridData2);

progressBar = new ProgressBar(composite, );

}

/**

* This method initializes coolBar

*

*/

private void createCoolBar() {

coolBar = new CoolBar(viewForm, );

createToolBar();

createCombo();

CoolItem coolItem = new CoolItem(coolBar, );

trol(toolBar);

CoolItem coolItem1 = new CoolItem(coolBar, );

trol(combo);

();

Point size=e();

e(size);

imumSize(size);

();

Point size1=e();

e(size1);

imumSize(size);

}

/**

* This method initializes browser

*

*/

private void createBrowser() {

browser = new Browser(viewForm, );

tusTextListener(new

TextListener(){

public void changed(TextEvent e){

t();

}

});

gressListener(new

ssAdapter(){

public void changed(ssEvent e){

imum();

ection(t);

}

public void completed(TextEvent e){

t("完成!");

ection(0);

}

});

ationListener(new

onAdapter(){

public void changed(onEvent e){

t(on);

}

});

}

/**

* This method initializes toolBar

*

*/

private void createToolBar() {

toolBar = new ToolBar(coolBar, );

ToolItem toolItem = new ToolItem(toolBar, );

t("后退");

ge(new Image(rent(), "D:/"));

ectionListener(new ionListener() {

public void widgetSelected(ionEvent e) {

();

}

public void widgetDefaultSelected(ionEvent e) {

}

});

ToolItem toolItem1 = new ToolItem(toolBar, );

t("前进");

ge(new Image(rent(), "D:/"));

ectionListener(new ionListener()

{

public void widgetSelected(ionEvent e) {

d();

}

public void widgetDefaultSelected(ionEvent e) {

}

});

ToolItem toolItem2 = new ToolItem(toolBar, );

t("刷新");

ge(new Image(rent(), "D:/"));

ectionListener(new ionListener()

{

public void widgetSelected(ionEvent e) {

h();

}

public void widgetDefaultSelected(ionEvent e) {

}

});

ToolItem toolItem3 = new ToolItem(toolBar, );

t("停止");

ge(new Image(rent(), "D:/"));

ectionListener(new ionListener()

{

public void widgetSelected(ionEvent e) {

();

}

public void widgetDefaultSelected(ionEvent e) {

}

});

ToolItem toolItem4 = new ToolItem(toolBar, );

t("主页");

ge(new Image(rent(), "D:/"));

ectionListener(new ionListener()

{

public void widgetSelected(ionEvent e) {

("");

}

public void widgetDefaultSelected(ionEvent e) {

}

});

}

/**

* This method initializes combo

*

*/

private void createCombo() {

combo = new Combo(coolBar, );

("");

(0);

ectionListener(new ionListener(){

public void widgetSelected(ionEvent e){

(m(ectionIndex()));

}

public void widgetDefaultSelected(ionEvent e){

String url=new String(t());

(url);

(url);

}

});

}

/**

* @param args

*/

public static void main(String[] args) {

Display display = ault();

E11_1 thisClass = new E11_1();

SShell();

();

while (!osed()) {

if (!dDispatch())

();

}

e();

}

private void createSShell() {

sShell = new Shell();

t("浏览器");

createViewForm();

createComposite();

e(new Point(800, 600));

out(new GridLayout());

}

}

2024年3月31日发(作者:势伟彦)

package ch11;

import yout;

import ;

import ;

import y;

import rm;

import ;

import ite;

import ta;

import r;

import r;

import ;

import ssBar;

import r;

import em;

import ;

import em;

import ;

public class E11_1 {

private Shell sShell = null;

private ViewForm viewForm = null;

private Composite composite = null;

private CoolBar coolBar = null;

private Browser browser = null;

private Label label = null;

private ProgressBar progressBar = null;

private ToolBar toolBar = null;

private Combo combo = null;

/**

* This method initializes viewForm

*

*/

private void createViewForm() {

GridData gridData = new GridData();

ntalAlignment = ;

cessHorizontalSpace = true;

cessVerticalSpace = true;

alAlignment = ;

viewForm = new ViewForm(sShell, );

outData(gridData);

createCoolBar();

Left(coolBar);

createBrowser();

tent(browser);

}

/**

* This method initializes composite

*

*/

private void createComposite() {

GridData gridData2 = new GridData();

ntalAlignment = ;

cessHorizontalSpace = true;

alAlignment = ;

GridLayout gridLayout = new GridLayout();

umns = 2;

GridData gridData1 = new GridData();

ntalAlignment = ;

cessHorizontalSpace = true;

alAlignment = ;

composite = new Composite(sShell, );

outData(gridData1);

out(gridLayout);

label = new Label(composite, );

t("浏览器");

outData(gridData2);

progressBar = new ProgressBar(composite, );

}

/**

* This method initializes coolBar

*

*/

private void createCoolBar() {

coolBar = new CoolBar(viewForm, );

createToolBar();

createCombo();

CoolItem coolItem = new CoolItem(coolBar, );

trol(toolBar);

CoolItem coolItem1 = new CoolItem(coolBar, );

trol(combo);

();

Point size=e();

e(size);

imumSize(size);

();

Point size1=e();

e(size1);

imumSize(size);

}

/**

* This method initializes browser

*

*/

private void createBrowser() {

browser = new Browser(viewForm, );

tusTextListener(new

TextListener(){

public void changed(TextEvent e){

t();

}

});

gressListener(new

ssAdapter(){

public void changed(ssEvent e){

imum();

ection(t);

}

public void completed(TextEvent e){

t("完成!");

ection(0);

}

});

ationListener(new

onAdapter(){

public void changed(onEvent e){

t(on);

}

});

}

/**

* This method initializes toolBar

*

*/

private void createToolBar() {

toolBar = new ToolBar(coolBar, );

ToolItem toolItem = new ToolItem(toolBar, );

t("后退");

ge(new Image(rent(), "D:/"));

ectionListener(new ionListener() {

public void widgetSelected(ionEvent e) {

();

}

public void widgetDefaultSelected(ionEvent e) {

}

});

ToolItem toolItem1 = new ToolItem(toolBar, );

t("前进");

ge(new Image(rent(), "D:/"));

ectionListener(new ionListener()

{

public void widgetSelected(ionEvent e) {

d();

}

public void widgetDefaultSelected(ionEvent e) {

}

});

ToolItem toolItem2 = new ToolItem(toolBar, );

t("刷新");

ge(new Image(rent(), "D:/"));

ectionListener(new ionListener()

{

public void widgetSelected(ionEvent e) {

h();

}

public void widgetDefaultSelected(ionEvent e) {

}

});

ToolItem toolItem3 = new ToolItem(toolBar, );

t("停止");

ge(new Image(rent(), "D:/"));

ectionListener(new ionListener()

{

public void widgetSelected(ionEvent e) {

();

}

public void widgetDefaultSelected(ionEvent e) {

}

});

ToolItem toolItem4 = new ToolItem(toolBar, );

t("主页");

ge(new Image(rent(), "D:/"));

ectionListener(new ionListener()

{

public void widgetSelected(ionEvent e) {

("");

}

public void widgetDefaultSelected(ionEvent e) {

}

});

}

/**

* This method initializes combo

*

*/

private void createCombo() {

combo = new Combo(coolBar, );

("");

(0);

ectionListener(new ionListener(){

public void widgetSelected(ionEvent e){

(m(ectionIndex()));

}

public void widgetDefaultSelected(ionEvent e){

String url=new String(t());

(url);

(url);

}

});

}

/**

* @param args

*/

public static void main(String[] args) {

Display display = ault();

E11_1 thisClass = new E11_1();

SShell();

();

while (!osed()) {

if (!dDispatch())

();

}

e();

}

private void createSShell() {

sShell = new Shell();

t("浏览器");

createViewForm();

createComposite();

e(new Point(800, 600));

out(new GridLayout());

}

}

发布评论

评论列表 (0)

  1. 暂无评论