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

Method setVisible

src/main/java/gate/swing/XJPopupMenu.java:45–62  ·  view source on GitHub ↗

Force separators to be the same width as the JPopupMenu. This is because the MenuLayout make separators invisible contrary to the default JPopupMenu layout manager. @param aFlag true if the popupmenu is visible

(boolean aFlag)

Source from the content-addressed store, hash-verified

43 * @param aFlag true if the popupmenu is visible
44 */
45 @Override
46 public void setVisible(boolean aFlag) {
47 super.setVisible(aFlag);
48 if (!aFlag) { return; }
49 MenuLayout layout = (MenuLayout) getLayout();
50 for (int i = 0; i < getComponents().length; i++) {
51 Component component = getComponents()[i];
52 if (component instanceof JSeparator) {
53 JSeparator separator = (JSeparator) component;
54 int column = layout.getColumnForComponentIndex(i);
55 int preferredWidth = layout.getPreferredWidthForColumn(column);
56 // use the popupmenu width to set the separators width
57 separator.setPreferredSize(new Dimension(
58 preferredWidth, separator.getHeight()));
59 }
60 }
61 revalidate();
62 }
63}

Callers 12

runMethod · 0.45
BlockingGlassPaneMethod · 0.45
blockMethod · 0.45
actionPerformedMethod · 0.45
showDialogMethod · 0.45
mainMethod · 0.45
actionPerformedMethod · 0.45
mainMethod · 0.45
showDialogMethod · 0.45
showDialogMethod · 0.45
runMethod · 0.45

Calls 3

revalidateMethod · 0.45

Tested by

no test coverage detected