#安全组件

List接口的实现类(Vector)(与ArrayList相似,区别是Vector是重量级的组件,使用使消耗的资源比较多。)

 LinkedList提供以下方法:(ArrayList无此类方法)addFirst();   removeFirst(); addLast(); removeLast();在堆栈中,push为入栈操作,pop为出栈操作。 Push用addFirst...

e824. 获得和设置JSplitPane中的子组件

//Createaleft-rightsplitpaneJSplitPanehpane=newJSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftComponent,rightComponent);//Createatop-bottomsplitpaneJSplitPanevpane=...

e786. 创建JSpinner组件

Thisexampledemonstrateshowtobuildthreekindsofspinners.Anumberspinner://CreateanumberspinnerJSpinnerspinner=newJSpinner();//Setitsvaluespinner.setValue(newIntege...
代码星球 ·2021-02-12

e794. 创建JSlider组件

//Createahorizontalsliderwithmin=0,max=100,value=50JSliderslider=newJSlider();//Createahorizontalsliderwithcustomminandmax;valueissettothemiddleintminimum=-255;...
代码星球 ·2021-02-12

e861. 在两个组件之间共享输入映射和事件映射

BysharinganInputMaporActionMap,anychangetothesharedInputMaporActionMapwillaffectallcomponentssharingtheInputMaporActionMap.WHEN_FOCUSEDandWHEN_ANCESTOR_OF_FOCUS...

e802. 创建一个位置大小的JProgressBar组件

Aprogressbarwithanunknownmaximumtypicallydisplaysananimationuntilthetaskiscomplete.Note:Thepercentagedisplayshouldnotbeenabledwhenthemaximumisnotknown(e804显示JPr...

e801. 创建一个JProgressBar组件

Aprogressbarisusedtovisuallyindicatehowmuchataskhasbeenprogressed.Aprogressbarcanbeorientedhorizontally(left-to-right)orvertically(bottom-to-top).Bydefault,theo...

e812. 强制弹出菜单为重组件

Bydefault,SwingpopupmenususedbyJMenuandJPopupMenuarelightweight.Ifheavyweightcomponentsareusedinthesameframe,thepopupmenusmayappearbehindtheheavyweightcomponent...

e776. 设置JList组件项的提示语

//Createalist,overridingthegetToolTipText()methodString[]items={"A","B","C","D"};JListlist=newJList(items){//Thismethodiscalledasthecursormoveswithinthelist.pub...

e775. 设置JList组件项的维数

Bydefault,thewidthofthelistisdeterminedbythelongestitemandtheheightisdeterminedbythenumberofvisiblelinesmultipliedbythetallestitem.Thisexampledemonstrateshowtoo...

e777. 获得JList组件的所有项

//CreatealistString[]items={"A","B","C","D"};JListlist=newJList(items);//Getnumberofitemsinthelistintsize=list.getModel().getSize();//4//Getallitemobjectsfor(in...

e774. 创建JList组件

Bydefault,alistallowsmorethanoneitemtobeselected.Also,theselecteditemsneednotbecontiguous.Tochangethisdefault,seee781设置JList中的选择模式.Alistselectioneventisfiredwhe...
代码星球 ·2021-02-12

e860. 列出组件绑定的键盘键

Thisexampledemonstrateshowtolistallthekeybindingsinacomponent.Textcomponentshaveanadditionalsetofkeybindingscalledakeymap.Seee1005列出JTextComponent中键盘映射绑定的键foran...

e856. 列出一个组件的所有事件

Thisexampledemonstrateshowtolistalltheactionsinacomponent.ActionMapmap=component.getActionMap();//Listactionsinthecomponentlist(map,map.keys());//Listactionsint...

e739. 创建一个标签组件

//Thetextisleft-justifiedandverticallycenteredJLabellabel=newJLabel("TextLabel");//Thetextishorizontallyandverticallycenteredlabel=newJLabel("TextLabel",JLabel....
首页上一页...1011121314...下一页尾页