Cov txheej txheem:

Koj ntxiv cov duab rau JFrame li cas?
Koj ntxiv cov duab rau JFrame li cas?

Video: Koj ntxiv cov duab rau JFrame li cas?

Video: Koj ntxiv cov duab rau JFrame li cas?
Video: xav pom koj duas _by_Dawb yaj 2024, Kaum ib hlis
Anonim

B. 1 Tsim cov duab

  1. Tsim ib JFrame khoom, uas yog lub qhov rais uas yuav muaj cov canvas.
  2. Tsim ib daim duab kos duab (uas yog lub canvas), teem nws qhov dav thiab qhov siab, thiab ntxiv nws mus rau tus ncej.
  3. Ntim cov thav duab (resize nws) kom haum lub canvas, thiab tso rau ntawm qhov screen.

Ib yam li ntawd, koj tuaj yeem nug, Kuv yuav ua li cas thiaj tso tau JFrame?

Raws li lub neej ntawd, a JFrame tuaj yeem pom nyob rau sab saum toj-sab laug txoj hauj lwm ntawm ib qho screen. Peb ua tau tso saib qhov chaw nruab nrab ntawm JFrame siv tus txheej txheem setLocationRelativeTo() ntawm qhov rais chav kawm.

Kuv yuav import cov duab rau hauv NetBeans li cas? Tswv yim: Importing Images rau NetBeans

  1. Luag cov duab los ntawm sab nraud NetBeans mus rau hauv ib qhov project (piv txwv li, ib pob) hauv Projects window.
  2. Luam ib daim duab sab nraum NetBeans (yog li tam sim no nws yog nyob rau hauv cov ntawv teev cia), tom qab ntawd muab nws tso rau hauv pob thiab tom qab ntawd nws ntxiv.

Qhov thib ob, koj yuav ua li cas ntxiv cov ntawv rau Java graphics?

Txhawm rau kos cov ntawv hauv koj daim ntawv thov Java Desktop koj yuav tsum:

  1. Tsim ib tug tshiab Ncej.
  2. Ntxiv rau tus ncej tshiab CustomPaintComponent().
  3. Tsim ib chav kawm tshiab uas txuas ntxiv Cov Txheej Txheem thiab hla txoj kev pleev xim.
  4. Siv Graphics2D. drawString los kos ib txoj hlua hauv qhov screen.

Yuav ua li cas kuv muab ib tug duab nyob rau hauv ib tug ncej hauv HTML?

Yuav ua li cas ntxiv ib tug ncej nyob ib ncig ntawm ib daim duab

  1. Tsim HTML¶ Ua ntej tsim cov khoom nrog lub npe chav kawm "thav duab". Txhais

    element nyob rau hauv ib tug element. Teem lub alt attribute rau daim duab.

  2. Tsim CSS¶ Teeb qhov siab thiab qhov dav rau tus ncej. Qhia cov style, qhov dav thiab xim ntawm tus ciam teb nrog cov cuab yeej ciam teb shorthand. Teem lub keeb kwm yav dhau-xim.

Pom zoo: