MCPcopy Create free account
hub / github.com/GateNLP/gate-core / getPreferredSize

Method getPreferredSize

src/main/java/gate/swing/JChoice.java:398–414  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

396 * @see javax.swing.JComponent#getPreferredSize()
397 */
398 @Override
399 public Dimension getPreferredSize() {
400 Dimension size = super.getPreferredSize();
401 if(getItemCount() <= maximumFastChoices && size.width > maximumWidth) {
402 setSize(maximumWidth, Integer.MAX_VALUE);
403 doLayout();
404 int compCnt = getComponentCount();
405 if(compCnt > 0) {
406 Component lastComp = getComponent(compCnt - 1);
407 Point compLoc = lastComp.getLocation();
408 Dimension compSize = lastComp.getSize();
409 size.width = maximumWidth;
410 size.height = compLoc.y + compSize.height + getInsets().bottom;
411 }
412 }
413 return size;
414 }
415
416
417 /**

Callers 5

printSizesMethod · 0.45
preferredLayoutSizeMethod · 0.45
layoutContainerMethod · 0.45
getPopupMenuOriginMethod · 0.45

Calls 4

getItemCountMethod · 0.95
doLayoutMethod · 0.80
getLocationMethod · 0.45
getSizeMethod · 0.45

Tested by

no test coverage detected