Exercise/Homework EH48: A. B. C. D
Exercise/Homework EH48: A. B. C. D
EH48
Exercise/HomeworkEH48
Q1:ToevenlydistributefixedsizecomponentsinarowusingBoxLayout,usethemethod:
a.createVerticalStrut().
b.createHorizontalStrut().
c.createVerticalGlue().
d.createHorizontalGlue().
ANS:
Q2:TocreateafixedspacebetweenallcomponentsusingBoxLayout,usethemethod:
a.createVerticalStrut().
b.createHorizontalStrut().
c.createGlue().
d.createRigidArea().
ANS:
Q3:WhichofthefollowingGridBagConstraintsspecifiesthenumberofcolumnsacomponentwilloccupy?
a.gridwidth.
b.gridheight.
c.weightx.
d.weighty.
ANS:
Q4:WhatisthedefaultvaluefortheGridBagConstraintfill?
a.NONE.
b.BOTH.
c.CENTER.
d.HORIZONTAL.
ANS:
Q5:WhatGridBagConstraintsconstantscanbeusedinplaceofgridxandgridy?
a.RELATIVEandREMAINDER.
b.CENTERandBOTH.
c.NORTHandSOUTH.
d.FILLandNONE.
ANS:
Q6:TheGridBagContraintsconstantRELATIVEmeansthat
a.Thecomponentisthelastcomponent.
b.Thecomponentisthenexttolastcomponent.
c.Thecomponentshouldbeplacedrelativetothepreviouscomponent.
d.Bothbandc.
ANS:
CPSC426 Java
EH48
Q7:Createacompletedrawingapplication.TheprogramshoulduseGUIcomponentstoenabletheusertoselect
theshape,colorandfillcharacteristics.EachshapeshouldbestoredinanarrayofMyShapeobjects,whereySharp
isthesuperclassinyourhierarchyofshapeclasses.UseaJDesktopPaneandJInternalFramstoallowtheuserto
createmultipleseparatedrawingsinseparatechildwindows.Createtheuserinterfaceasaseparatechildwindow
containingalltheGUIcomponentsthatallowtheusertodeterminethecharactiristicsoftheshapetobedrawn.The
usercanthenclickinanyJInternalFrametodrawtheshape.
ANS: