Uyisebenzisa kanjani iManejala yokuLungiselela kwiJava

NguDoug Lowe

Ukuqonda ubeko lwabaphathi sisitshixo sokwenza ii-Swing frames kwiJava ezinomtsalane nezisebenzisekayo. Ke masikhuphe imfihlelo kubume beSwing ukuze ube nolawulo olupheleleyo lwendawo ezibekwa kuyo izinto.



Abaphathi abathandathu bokubekwa kweSwing

I-Swing ibonelela ngabaphathi bezinto ezininzi oza kusebenza nabo, kubandakanya aba balandelayo:

ungathatha ihydroxyzine kunye nebenadryl
  • Ukuhamba: Umphathi wolwakhiwo kukusilela kwiipaneli. Ibeka izinto enye emva kwenye ide iphume kwigumbi; emva koko iqala umqolo omtsha wezinto.

  • Umda: Umphathi wolwakhiwo kukusilela kwesakhelo. Yahlulahlula isikhongozeli kwimimandla emihlanu: eMantla, Mzantsi, Mpuma, Ntshona, kunye neZiko. Xa usongeza icandelo, ungakhankanya ukuba yeyiphi indawo ofuna ukubeka kuyo icandelo.



  • Ibhokisi: Lo mphathi wobeko ucwangcisa izinto kumqolo omnye okanye kwikholamu enye, kuxhomekeke kulungelelwaniso oluchazayo xa usenza umphathi wobeko.

  • Igridi: Umphathi wolungiselelo ulungile xa ufuna ukwenza iigridi ezinobungakanani obulinganayo.

    ndithatha ixesha elingakanani ukuthatha i-tamsulosin
  • Ibhodi yeGrid: Lo mphathi wolwakhiwo usebenzisa igridi ebhetyebhetye ngakumbi kunokuba umphathi weGridi yoyilo esenza. Kuyilo lweGridBag, umqolo ngamnye okanye ikholamu inokuba nobukhulu obahlukileyo; icandelo linokuthatha imiqolo emibini okanye nangaphezulu okanye iikholamu; kwaye ungamxelela umphathi wobeko ukuba enze ntoni ukuba icandelo lincinci okanye likhulu kunendawo ayabelweyo.



  • Iqela: Umphathi wolwakhiwo usebenza kakuhle ngesixhobo esibonakalayo sokuyila usetyenziso lomsebenzisi. Uyilo lweQela, uchaza ulungelelwaniso olusuka kwiindawo ezimbini zokujonga: ekhohlo ukuya ekunene nangaphezulu ukuya ezantsi.

    umfanekiso0.jpg

Ukongeza kwaba baphathi babeki bathandathu, iJava ibonelela ngezinye ezimbalwa, kubandakanya iKhadi kunye neNtwasahlobo. Umphathi wokumiswa kweKhadi ukuvumela ukuba wenze uyilo lweetabheli, kodwa endaweni yalo kuthathwe indawo enkulu ngamanye amacandelo enza into efanayo ngokufanelekileyo.

Umphathi wolungiselelo lwentwasahlobo usebenzisa umxholo onqabileyo obizwa ngokuba imithombo ukuvumela ukuba ubeke izinto. Lo mphathi wolwakhiwo akenzelwanga ukuba kubhalwe ngesandla; endaweni yoko, yenzelwe ukuba isetyenziswe ngabavelisi beekhowudi abenzela ikhowudi ye-graphic interface yomsebenzisi (i-GUI). Jonga apha ngolwazi oluthe kratya kwi Ikhadi kwaye Ntlakohlaza ubeko.

i-aspirin eninzi kangakanani

Ukufaka isicelo kubaphathi babeko

Ukuseta umphathi woyilo lwepaneli okanye isakhelo, usebenzisa ifayile yesetLayoutindlela. Nantsi indlela oyila ngayo ipaneli kwaye usete iGridBag njengomphathi wayo wobeko:

JPanel panel1 = new JPanel(); panel1.setLayout(new GridBagLayout());

Ukuba ufuna ukusebenzisa ubeko lokuhamba ngepaneli okanye ubeko lweMida ngesakhelo, awunyanzelekanga ukuba wenze nantoni na; ezo ziziphene.

Kwiimeko ezininzi, eyona ndlela ilungileyo yokwenza ubume besakhelo esimbaxa isebenzisa indibaniselwano yabaphathi bezinto. Unokwenza ipaneli enamaqhosha avela emazantsi esakhelo. Eli qela liza kusebenzisa ubume bokuhamba. Emva koko unokongeza indawo yolawulo kumazantsi esakhelo, esebenzisa ubume beBorder ngokungagqibekanga.