提交 ae4cedab 编写于 作者: A anashaty

7094099: DropDown List of JComboBox detached

Reviewed-by: alexp, dcherepanov
上级 3aa29563
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -30,6 +30,7 @@ import java.awt.event.*; ...@@ -30,6 +30,7 @@ import java.awt.event.*;
import javax.swing.event.*; import javax.swing.event.*;
import sun.awt.AppContext; import sun.awt.AppContext;
import sun.swing.SwingUtilities2;
/** /**
* A MenuSelectionManager owns the selection in menu hierarchy. * A MenuSelectionManager owns the selection in menu hierarchy.
...@@ -60,6 +61,12 @@ public class MenuSelectionManager { ...@@ -60,6 +61,12 @@ public class MenuSelectionManager {
if (msm == null) { if (msm == null) {
msm = new MenuSelectionManager(); msm = new MenuSelectionManager();
context.put(MENU_SELECTION_MANAGER_KEY, msm); context.put(MENU_SELECTION_MANAGER_KEY, msm);
// installing additional listener if found in the AppContext
Object o = context.get(SwingUtilities2.MENU_SELECTION_MANAGER_LISTENER_KEY);
if (o != null && o instanceof ChangeListener) {
msm.addChangeListener((ChangeListener) o);
}
} }
return msm; return msm;
......
/* /*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -81,6 +81,9 @@ public class SwingUtilities2 { ...@@ -81,6 +81,9 @@ public class SwingUtilities2 {
public static final Object LAF_STATE_KEY = public static final Object LAF_STATE_KEY =
new StringBuffer("LookAndFeel State"); new StringBuffer("LookAndFeel State");
public static final Object MENU_SELECTION_MANAGER_LISTENER_KEY =
new StringBuffer("MenuSelectionManager listener key");
// Maintain a cache of CACHE_SIZE fonts and the left side bearing // Maintain a cache of CACHE_SIZE fonts and the left side bearing
// of the characters falling into the range MIN_CHAR_INDEX to // of the characters falling into the range MIN_CHAR_INDEX to
// MAX_CHAR_INDEX. The values in fontCache are created as needed. // MAX_CHAR_INDEX. The values in fontCache are created as needed.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册