【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android中怎么自定義對(duì)話框_第1頁(yè)
【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android中怎么自定義對(duì)話框_第2頁(yè)
【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android中怎么自定義對(duì)話框_第3頁(yè)
【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android中怎么自定義對(duì)話框_第4頁(yè)
【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android中怎么自定義對(duì)話框_第5頁(yè)
已閱讀5頁(yè),還剩6頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

【移動(dòng)應(yīng)用開發(fā)技術(shù)】Android中怎么自定義對(duì)話框

這期內(nèi)容當(dāng)中在下將會(huì)給大家?guī)?lái)有關(guān)Android中怎么自定義對(duì)話框,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。Android自帶的AlertDialog,ProgressDialog,DatePickerDialog,TimePickerDialog

可以用于簡(jiǎn)單的對(duì)話框顯示。當(dāng)還是有這些對(duì)話框不能滿足應(yīng)用需要的時(shí)候,這時(shí)就可以使用一些自定義的對(duì)話框。有多種方法可以實(shí)現(xiàn)自定義對(duì)話框。一是使用Activity作為Dialog,可以通過(guò)設(shè)置Activity顯示Dialog風(fēng)格,使得該Activity在外觀上和Dialog一致:顯示在其它Activity前面且半透明。<Activity

android:name=”MyDialogActivity”

Android:theme=”@android:style/Theme.Dialog“></Activity>本例采用另外兩種方法來(lái)使用自定義對(duì)話框,將用這個(gè)對(duì)話框來(lái)最為圖形變換(Transform)的選項(xiàng):Primitive:Rectange,Ellipse,TextPen:Thin,Thick,DashedBrush:Solid,Gradient,TextureTransform:Identity,Rotate,Scale,ShearRendering:Stroke,Fill,StokeandFill首先在res\layout下新建transformoption.xml作為自定義對(duì)話框布局:<?xml

version=”1.0″

encoding=”utf-8″?>

<LinearLayout

xmlns:android=”/apk/res/android”

android:layout_width=”fill_parent”

android:layout_height=”fill_parent”

>

<ScrollView

android:layout_width=”fill_parent”

android:layout_height=”fill_parent”>

<LinearLayout

android:layout_width=”fill_parent”

android:layout_height=”fill_parent”

android:orientation=”vertical”

>

<TextView

android:text=”Primitive”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</TextView>

<RadioGroup

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

<RadioButton

android:text=”Rectangle”

android:id=”@+id/radioRectangle”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

<RadioButton

android:text=”Ellipse”

android:id=”@+id/radioEllipse”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

<RadioButton

android:text=”Text”

android:id=”@+id/radioText”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

</RadioGroup>

<TextView

android:text=”Pen”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</TextView>

<RadioGroup

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

<RadioButton

android:text=”Thin”

android:id=”@+id/radioThin”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

<RadioButton

android:text=”Thick”

android:id=”@+id/radioThick”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

<RadioButton

android:text=”Dashed”

android:id=”@+id/radioDashed”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

</RadioGroup>

<TextView

android:text=”Brush”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</TextView>

<RadioGroup

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

<RadioButton

android:text=”Solid”

android:id=”@+id/radioSolid”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

<RadioButton

android:text=”Gradient”

android:id=”@+id/radioGradient”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

<RadioButton

android:text=”Texture”

android:id=”@+id/radioTexture”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

</RadioGroup>

<TextView

android:text=”Transform”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</TextView>

<RadioGroup

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

<RadioButton

android:text=”Identity”

android:id=”@+id/radioIdentity”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

<RadioButton

android:text=”Rotate”

android:id=”@+id/radioRotate”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

<RadioButton

android:text=”Scale”

android:id=”@+id/radioScale”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

<RadioButton

android:text=”Shear”

android:id=”@+id/radioShear”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

</RadioGroup>

<TextView

android:text=”Rendering”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</TextView>

<RadioGroup

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

<RadioButton

android:text=”Stroke”

android:id=”@+id/radioStroke”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

<RadioButton

android:text=”Fill”

android:id=”@+id/radioFill”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

<RadioButton

android:text=”Stroke

and

Fill”

android:id=”@+id/radioStrokeFill”

android:layout_width=”wrap_content”

android:layout_height=”wrap_content”>

</RadioButton>

</RadioGroup>

</LinearLayout>

</ScrollView>

</LinearLayout>一種方法是重新定制AlertDialog,基本步驟和Android簡(jiǎn)明開發(fā)教程十七:Dialog顯示圖像類似,但是在protectedDialogonCreateDialog(intid),需要重新設(shè)定Dialog的ContentView并給RadioButton添加事件處理:1

protected

Dialog

onCreateDialog(int

id)

{

2

final

Dialog

dialog;

3

switch

(id)

{

4

case

OPTION_DIALOG:

5

LayoutInflater

li

6

=

LayoutInflater.from(this);

7

View

optionView

8

=

li.inflate(R.layout.transformoption,

null);

9

AlertDialog.Builder

optionDialog

10

=

new

AlertDialog.Builder(this);

11

optionDialog.setTitle("Options");

12

optionDialog.setView(optionView);

13

dialog

=

optionDialog.create();

14

RadioButton

button

=

(RadioButton)

optionView

15

.findViewById(R.id.radioRectangle);

16

button.setOnClickListener(new

Button.OnClickListener()

{

17

18

public

void

onClick(View

v)

{

19

primitiveIndex

=

PRIMITIVE_RECTANGLE;

20

drawImage();

21

dialog.dismiss();

22

23

}

24

});

25

26

...

27

28

button

=

(RadioButton)

optionView

29

.findViewById(R.id.radioStrokeFill);

30

button.setOnClickListener(new

Button.OnClickListener()

{

31

32

public

void

onClick(View

v)

{

33

renderingIndex

=

RENDERING_STROKE_AND_FILL;

34

drawImage();

35

dialog.dismiss();

36

37

}

38

});

39

return

dialog;

40

}

41

42

return

null;

43

44

}第二種是通過(guò)派生Dialog,定義了一個(gè)OptionDialog類作為Dialog子類。1

class

OptionDialog

extends

Dialog

{

2

3

public

OptionDialog(Context

context)

{

4

super(context);

5

//

TODO

Auto-generated

constructor

stub

6

}

7

8

protected

void

onCreate(Bundle

savedInstanceState)

{

9

super.onCreate(savedInstanceState);

10

setContentView(R.layout.transformoption);

11

setTitle("Options");

12

RadioButton

button

13

=

(RadioButton)

findViewById(R.id.radioRectangle);

14

button.setOnClickListener(new

Button.OnClickListener()

{

15

16

public

void

onClick(View

v)

{

17

primitiveIndex

=

PRIMITIVE_RECTANGLE;

18

drawImage();

19

dismiss();

20

21

}

22

});

23

...

24

button

=

(RadioButton)

findViewById(R.id.radioStrokeFill);

25

button.setOnClickListener(new

Button.OnClickListener()

{

26

27

public

void

onClick(View

v)

{

28

renderingIndex

=

RENDERING_STROKE_AND_FILL;

29

drawImage();

30

dismiss();

31

32

}

33

});

34

}

35

36

}這兩種方法在顯示Dialog時(shí)有所不同:1

private

OptionDialog

optionDialog;

2

static

final

private

int

OPTION_DIALOG

=

1;

3

4

...

5

optionDialog

=

new

OptionDialog(this);

6

7

...

8

@Override

9

public

void

onClick(View

view)

{

10

//

optionDialog.show();

11

showDialog(OPTION_DIALOG);

12

13

}下面是完整代碼:1

public

class

Transform

extends

Graphics2DActivity

2

implements

OnClickListener

{

3

4

static

int

PRIMITIVE_RECTANGLE

=

0;

5

static

int

PRIMITIVE_ELLIPSE

=

1;

6

static

int

PRIMITIVE_TEXT

=

2;

7

static

int

PEN_THIN

=

0;

8

static

int

PEN_THICK

=

1;

9

static

int

PEN_DASHED

=

2;

10

static

int

BRUSH_SOLID

=

0;

11

static

int

BRUSH_GRADIENT

=

1;

12

static

int

BRUSH_TEXTURE

=

2;

13

static

int

TRANSFORM_IDENTITY

=

0;

14

static

int

TRANSFORM_ROTATE

=

1;

15

static

int

TRANSFORM_SCALE

=

2;

16

static

int

TRANSFORM_SHEAR

=

3;

17

static

int

RENDERING_STROKE

=

0;

18

static

int

RENDERING_FILL

=

1;

19

static

int

RENDERING_STROKE_AND_FILL

=

2;

20

int

primitiveIndex;

21

int

penIndex;

22

int

brushIndex;

23

int

transformIndex;

24

int

renderingIndex;

25

int[]

rgbData;

26

int

bitmapWidth;

27

int

bitmapHeight;

28

29

class

OptionDialog

extends

Dialog

{

30

31

public

OptionDialog(Context

context)

{

32

super(context);

33

//

TODO

Auto-generated

constructor

stub

34

}

35

36

protected

void

onCreate(Bundle

savedInstanceState)

{

37

super.onCreate(savedInstanceState);

38

setContentView(R.layout.transformoption);

39

setTitle("Options");

40

RadioButton

button

41

=

(RadioButton)

findViewById(R.id.radioRectangle);

42

button.setOnClickListener(new

Button.OnClickListener()

{

43

44

public

void

onClick(View

v)

{

45

primitiveIndex

=

PRIMITIVE_RECTANGLE;

46

drawImage();

47

dismiss();

48

49

}

50

});

51

button

=

(RadioButton)

findViewById(R.id.radioEllipse);

52

button.setOnClickListener(new

Button.OnClickListener()

{

53

54

public

void

onClick(View

v)

{

55

primitiveIndex

=

PRIMITIVE_ELLIPSE;

56

drawImage();

57

dismiss();

58

59

}

60

});

61

button

=

(RadioButton)

findViewById(R.id.radioText);

62

button.setOnClickListener(new

Button.OnClickListener()

{

63

64

public

void

onClick(View

v)

{

65

primitiveIndex

=

PRIMITIVE_TEXT;

66

drawImage();

67

dismiss();

68

69

}

70

});

71

72

button

=

(RadioButton)

findViewById(R.id.radioThin);

73

button.setOnClickListener(new

Button.OnClickListener()

{

74

75

public

void

onClick(View

v)

{

76

penIndex

=

PEN_THIN;

77

drawImage();

78

dismiss();

79

80

}

81

});

82

83

button

=

(RadioButton)

findViewById(R.id.radioThick);

84

button.setOnClickListener(new

Button.OnClickListener()

{

85

86

public

void

onClick(View

v)

{

87

penIndex

=

PEN_THICK;

88

drawImage();

89

dismiss();

90

91

}

92

});

93

94

button

=

(RadioButton)

findViewById(R.id.radioDashed);

95

button.setOnClickListener(new

Button.OnClickListener()

{

96

97

public

void

onClick(View

v)

{

98

penIndex

=

PEN_DASHED;

99

drawImage();

100

dismiss();

101

102

}

103

});

104

105

button

=

(RadioButton)

findViewById(R.id.radioSolid);

106

button.setOnClickListener(new

Button.OnClickListener()

{

107

108

public

void

onClick(View

v)

{

109

brushIndex

=

BRUSH_SOLID;

110

drawImage();

111

dismiss();

112

113

}

114

});

115

116

button

=

(RadioButton)

findViewById(R.id.radioGradient);

117

button.setOnClickListener(new

Button.OnClickListener()

{

118

119

public

void

onClick(View

v)

{

120

brushIndex

=

BRUSH_GRADIENT;

121

drawImage();

122

dismiss();

123

124

}

125

});

126

127

button

=

(RadioButton)

findViewById(R.id.radioTexture);

128

button.setOnClickListener(new

Button.OnClickListener()

{

129

130

public

void

onClick(View

v)

{

131

brushIndex

=

BRUSH_TEXTURE;

132

drawImage();

133

dismiss();

134

135

}

136

});

137

138

button

=

(RadioButton)

findViewById(R.id.radioIdentity);

139

button.setOnClickListener(new

Button.OnClickListener()

{

140

141

public

void

onClick(View

v)

{

142

transformIndex

=

TRANSFORM_IDENTITY;

143

drawImage();

144

dismiss();

145

146

}

147

});

148

149

button

=

(RadioButton)

findViewById(R.id.radioRotate);

150

button.setOnClickListener(new

Button.OnClickListener()

{

151

152

public

void

onClick(View

v)

{

153

transformIndex

=

TRANSFORM_ROTATE;

154

drawImage();

155

dismiss();

156

157

}

158

});

159

160

button

=

(RadioButton)

findViewById(R.id.radioScale);

161

button.setOnClickListener(new

Button.OnClickListener()

{

162

163

public

void

onClick(View

v)

{

164

transformIndex

=

TRANSFORM_SCALE;

165

drawImage();

166

dismiss();

167

168

}

169

});

170

171

button

=

(RadioButton)

findViewById(R.id.radioShear);

172

button.setOnClickListener(new

Button.OnClickListener()

{

173

174

public

void

onClick(View

v)

{

175

transformIndex

=

TRANSFORM_SHEAR;

176

drawImage();

177

dismiss();

178

179

}

180

});

181

182

button

=

(RadioButton)

findViewById(R.id.radioStroke);

183

button.setOnClickListener(new

Button.OnClickListener()

{

184

185

public

void

onClick(View

v)

{

186

renderingIndex

=

RENDERING_STROKE;

187

drawImage();

188

dismiss();

189

190

}

191

});

192

193

button

=

(RadioButton)

findViewById(R.id.radioFill);

194

button.setOnClickListener(new

Button.OnClickListener()

{

195

196

public

void

onClick(View

v)

{

197

renderingIndex

=

RENDERING_FILL;

198

drawImage();

199

dismiss();

200

201

}

202

});

203

204

button

=

(RadioButton)

findViewById(R.id.radioStrokeFill);

205

button.setOnClickListener(new

Button.OnClickListener()

{

206

207

public

void

onClick(View

v)

{

208

renderingIndex

=

RENDERING_STROKE_AND_FILL;

209

drawImage();

210

dismiss();

211

212

}

213

});

214

}

215

216

}

217

218

private

OptionDialog

optionDialog;

219

private

Button

btnOptions;

220

221

static

final

private

int

OPTION_DIALOG

=

1;

222

223

private

AffineTransform

at

=

new

AffineTransform();

224

private

int

w,

h;

225

private

IShape

shapes[]

=

new

IShape[3];

226

227

private

boolean

firstTime

=

true;

228

private

FontEx

font

=

FontEx.getSystemFont();

229

230

@Override

231

protected

void

drawImage()

{

232

drawTransform();

233

234

}

235

236

protected

Dialog

onCreateDialog(int

id)

{

237

final

Dialog

dialog;

238

switch

(id)

{

239

case

OPTION_DIALOG:

240

LayoutInflater

li

241

=

LayoutInflater.from(this);

242

View

optionView

243

=

li.inflate(R.layout.transformoption,

null);

244

AlertDialog.Builder

optionDialog

245

=

new

AlertDialog.Builder(this);

246

optionDialog.setTitle("Options");

247

optionDialog.setView(optionView);

248

dialog

=

optionDialog.create();

249

RadioButton

button

=

(RadioButton)

optionView

250

.findViewById(R.id.radioRectangle);

251

button.setOnClickListener(new

Button.OnClickListener()

{

252

253

public

void

onClick(View

v)

{

254

primitiveIndex

=

PRIMITIVE_RECTANGLE;

255

drawImage();

256

dialog.dismiss();

257

258

}

259

});

260

button

=

(RadioButton)

261

optionView.findViewById(R.id.radioEllipse);

262

button.setOnClickListener(new

Button.OnClickListener()

{

263

264

public

void

onClick(View

v)

{

265

primitiveIndex

=

PRIMITIVE_ELLIPSE;

266

drawImage();

267

dialog.dismiss();

268

269

}

270

});

271

button

=

(RadioButton)

272

optionView.findViewById(R.id.radioText);

273

button.setOnClickListener(new

Button.OnClickListener()

{

274

275

public

void

onClick(View

v)

{

276

primitiveIndex

=

PRIMITIVE_TEXT;

277

drawImage();

278

dialog.dismiss();

279

280

}

281

});

282

283

button

=

(RadioButton)

284

optionView.findViewById(R.id.radioThin);

285

button.setOnClickListener(new

Button.OnClickListener()

{

286

287

public

void

onClick(View

v)

{

288

penIndex

=

PEN_THIN;

289

drawImage();

290

dialog.dismiss();

291

292

}

293

});

294

295

button

=

(RadioButton)

296

optionView.findViewById(R.id.radioThick);

297

button.setOnClickListener(new

Button.OnClickListener()

{

298

299

public

void

onClick(View

v)

{

300

penIndex

=

PEN_THICK;

301

drawImage();

302

dialog.dismiss();

303

304

}

305

});

306

307

button

=

(RadioButton)

308

optionView.findViewById(R.id.radioDashed);

309

button.setOnClickListener(new

Button.OnClickListener()

{

310

311

public

void

onClick(View

v)

{

312

penIndex

=

PEN_DASHED;

313

drawImage();

314

dialog.dismiss();

315

316

}

317

});

318

319

button

=

(RadioButton)

320

optionView.findViewById(R.id.radioSolid);

321

button.setOnClickListener(new

Button.OnClickListener()

{

322

323

public

void

onClick(View

v)

{

324

brushIndex

=

BRUSH_SOLID;

325

drawImage();

326

dialog.dismiss();

327

328

}

329

});

330

331

button

=

(RadioButton)

332

optionView.findViewById(R.id.radioGradient);

333

button.setOnClickListener(new

Button.OnClickListener()

{

334

335

public

void

onClick(View

v)

{

336

brushIndex

=

BRUSH_GRADIENT;

337

drawImage();

338

dialog.dismiss();

339

340

}

341

});

342

343

button

=

(RadioButton)

344

optionView.findViewById(R.id.radioTexture);

345

button.setOnClickListener(new

Button.OnClickListener()

{

346

347

public

void

onClick(View

v)

{

348

brushIndex

=

BRUSH_TEXTURE;

349

drawImage();

350

dialog.dismiss();

351

352

}

353

});

354

355

button

=

(RadioButton)

356

optionView.findViewById(R.id.radioIdentity);

357

button.setOnClickListener(new

Button.OnClickListener()

{

358

359

public

void

onClick(View

v)

{

360

transformIndex

=

TRANSFORM_IDENTITY;

361

drawImage();

362

dialog.dismiss();

363

364

}

365

});

366

367

button

=

(RadioButton)

368

optionView.findViewById(R.id.radioRotate);

369

button.setOnClickListener(new

Button.OnClickListener()

{

370

371

public

void

onClick(View

v)

{

372

transformIndex

=

TRANSFORM_ROTATE;

373

drawImage();

374

dialog.dismiss();

375

376

}

377

});

378

379

button

=

(RadioButton)

380

optionView.findViewById(R.id.radioScale);

381

button.setOnClickListener(new

Button.OnClickListener()

{

382

383

public

void

onClick(View

v)

{

384

transformIndex

=

TRANSFORM_SCALE;

385

drawImage();

386

dialog.dismiss();

387

388

}

389

});

390

391

button

=

(RadioButton)

392

optionView.findViewById(R.id.radioShear);

393

button.setOnClickListener(new

Button.OnClickListener()

{

394

395

public

void

onClick(View

v)

{

396

transformIndex

=

TRANSFORM_SHEAR;

397

drawImage();

398

dialog.dismiss();

399

400

}

401

});

402

403

button

=

(RadioButton)

404

optionView.findViewById(R.id.radioStroke);

405

button.setOnClickListener(new

Button.OnClickListener()

{

406

407

public

void

onClick(View

v)

{

408

renderingIndex

=

RENDERING_STROKE;

409

drawImage();

410

dialog.dismiss();

411

412

}

413

});

414

415

button

=

(RadioButton)

416

optionView.findViewById(R.id.radioFill);

417

button.setOnClickListener(new

Button.OnClickListener()

{

418

419

public

void

onClick(View

v)

{

420

renderingIndex

=

RENDERING_FILL;

421

drawImage();

422

dialog.dismiss();

423

424

}

425

});

426

427

button

=

(RadioButton)

optionView

428

.findViewById(R.id.radioStrokeFill);

429

button.setOnClickListener(new

Button.OnClickListener()

{

430

431

public

void

onClick(View

v)

{

432

renderingIndex

=

RENDERING_STROKE_AND_FILL;

433

drawImage();

434

dialog.dismiss();

435

436

}

437

});

438

return

dialog;

439

}

440

441

return

null;

442

443

}

444

445

public

void

onCreate(Bundle

savedInstanceState)

{

446

super.onCreate(savedInstanceState);

447

setContentView(R.layout.transform);

448

graphic2dView

=

(GuidebeeGraphics2DView)

449

findViewById(R.id.graphics2dview);

450

btnOptions

=

(Button)

findViewById(R.id.btnOption);

451

btnOptions.setOnClickListener(this);

452

shapes[0]

=

new

Rectangle(0,

0,

100,

100);

453

shapes[1]

=

new

Ellipse(0,

0,

100,

100);

454

IShape[]

fontShapes

=

font.getGlyphArray(96,

455

"TEXT".toCharArray(),

0,

456

4,

FontEx.TEXT_DIR_LR);

457

shapes[2]

=

new

Area(fontShapes[0]);

458

for

(int

i

=

1;

i

<

fontShapes.length;

i++)

{

459

((Area)

shapes[2]).add(new

Area(fontShapes[i]));

460

}

461

Bitmap

bitmap

=

BitmapFactory.decodeResource(

462

getResources(),

463

R.drawable.brick);

464

bitmapWidth

=

bitmap.getWidth();

465

bitmapHeight

=

bitmap.getHeight();

466

467

rgbData

=

new

int[bitmapWidth

*

bitmapHeight];

468

bitmap.getPixels(rgbData,

0,

bitmapWidth,

0,

0,

469

bitmapWidth,

470

bitmapHeight);

471

w

=

SharedGraphics2DInstance.CANVAS_WIDTH;

472

h

=

SharedGraphics2DInstance.CANVAS_HEIGHT;

473

optionDialog

=

new

OptionDialog(this);

474

475

}

476

477

private

void

setTrans(int

transIndex)

{

478

//

Sets

the

AffineTransform.

479

switch

(transIndex)

{

480

case

0:

481

at.setToIdentity();

482

at.translate(w

/

2,

h

/

2);

483

break;

484

case

1:

485

at.rotate(Math.toRadians(45));

486

break;

487

case

2:

488

at.scale(0.5,

0.5);

489

break;

490

case

3:

491

at.shear(0.5,

0.0);

492

break;

493

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論