0% found this document useful (0 votes)
21 views2 pages

Exercise/Homework EH48: A. B. C. D

This document contains questions and answers about Java GUI layout managers including BoxLayout and GridBagLayout. Specifically, it discusses how to evenly distribute and add spacing between components using BoxLayout, how gridwidth specifies the number of columns a component will occupy in GridBagLayout, and that the default value for the GridBagConstraint fill is NONE. It also asks how to place components relative to each other using GridBagConstraints constants RELATIVE and REMAINDER. The final question asks the reader to create a drawing application that uses GUI components to select shape characteristics and stores shapes in an array, displaying them in separate windows using JDesktopPane and JInternalFrames.

Uploaded by

zoolahishkobob
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Exercise/Homework EH48: A. B. C. D

This document contains questions and answers about Java GUI layout managers including BoxLayout and GridBagLayout. Specifically, it discusses how to evenly distribute and add spacing between components using BoxLayout, how gridwidth specifies the number of columns a component will occupy in GridBagLayout, and that the default value for the GridBagConstraint fill is NONE. It also asks how to place components relative to each other using GridBagConstraints constants RELATIVE and REMAINDER. The final question asks the reader to create a drawing application that uses GUI components to select shape characteristics and stores shapes in an array, displaying them in separate windows using JDesktopPane and JInternalFrames.

Uploaded by

zoolahishkobob
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

CPSC426 Java

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:

You might also like