#e6

e610. Setting Focus Traversal Keys in a Component

Whenthefocusisonacomponent,anyfocustraversalkeyssetforthatcomponentoverridethedefaultfocustraversalkeys.Foranexampleofhowtochangethefocustraversalkeysfortheenti...

e611. Setting Focus Traversal Keys for the Entire Application

Thisexamplechangesthefocustraversalkeysfortheentireapplication.Foranexampleofhowtochangethefocustraversalkeysforaparticularcomponent,seee610SettingFocusTraversa...

e612. Moving the Focus to the Next or Previous Focusable Component

ThemethodstomovethefocustothenextortothepreviousfocusablecomponentareComponent.transferFocus()andComponent.transferFocusBackward().Thisexamplemodifiesacomponent...
代码星球 ·2021-02-12

e609. Listening to All Focus Changes Between Components in an Application

Tolistentofocuschangeeventsbetweencomponents,installalistenerwiththekeyboardfocusmanager.Ifyouneedtheabilitytoveto(reject)afocuschange,installavetoablelistenerw...

e615. Finding the Next Focusable Component

publicComponentfindNextFocus(){//FindfocusownerComponentc=KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();Containerroot=c==null?null:c.get...

e606. Determining Which Component or Window Has the Focus

//nullisreturnedifnoneofthecomponentsinthisapplicationhasthefocusComponentcompFocusOwner=KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();/...

e621. Activating a Keystroke When Any Child Component Has Focus

Normally,akeystrokeregisteredonacomponentisactivatedwhenthecomponenthasthefocus.ThistypeofactivationconditioniscalledWHEN_FOCUSED.Itispossibletospecifythatakeys...

e636. Listening to All Key Events Before Delivery to Focused Component

Registeringakeyeventdispatcherwiththekeyboardfocusmanagerallowsyoutoseeallkeyeventsbeforetheyaresenttothefocusedcomponent.Itispossibletomodifytheeventorevenprev...
代码星球 ·2021-02-12

e683. 设置打印的方向

PrinterJobpjob=PrinterJob.getPrinterJob();PageFormatpf=pjob.defaultPage();if(portrait){pf.setOrientation(PageFormat.PORTRAIT);}else{pf.setOrientation(PageFormat...
代码星球 ·2021-02-11

e686. 显示打印窗口

Theprintdialogallowstheusertochangethedefaultprintersettingssuchasthedefaultprinter,numberofcopies,rangeofpages,etc.PrinterJobpjob=PrinterJob.getPrinterJob();Pa...
代码星球 ·2021-02-11

e684. 以多种格式打印

ABookobjectisusedwhenprintingpageswithdifferentpageformats.Thisexampleprintsthefirstpageinlandscapeandfivemorepagesinportrait.publicclassPrintBook{publicstaticv...
代码星球 ·2021-02-11

e682. 获得打印页的尺寸

Notethat(0,0)oftheGraphicsobjectisatthetop-leftoftheactualpage,whichisoutsidetheprintablearea.publicintprint(Graphicsg,PageFormatpf,intpageIndex){//Theareaofthe...
代码星球 ·2021-02-11

e685. 显示页面格式窗口

Thepageformatdialogallowstheusertochangethedefaultpageformatvaluessuchastheorientationandpapersize.PrinterJobpjob=PrinterJob.getPrinterJob();//Getandchangedefau...

e681. 基本的打印程序

Notethat(0,0)oftheGraphicsobjectisatthetop-leftoftheactualpage,outsidetheprintablearea.Inthisexample,theGraphicsobjectistranslatedsothat(0,0)becomesthetop-leftc...
代码星球 ·2021-02-11

e674. 创建并绘制加速图像

Imagesinacceleratedmemoryaremuchfastertodrawonthescreen.Thisexampledemonstrateshowtotakeanimageandmakeanacceleratedcopyofitandthenuseittodrawonthescreen.Theprob...
首页上一页12345...下一页尾页