Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 11 java.desktop.jmod - Desktop Module
JDK 11 java.desktop.jmod is the JMOD file for JDK 11 Desktop module.
JDK 11 Desktop module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\java.desktop.jmod.
JDK 11 Desktop module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Desktop module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\java.desktop.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ javax/swing/plaf/basic/BasicMenuBarUI.java
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javax.swing.plaf.basic;
import sun.swing.DefaultLookup;
import sun.swing.UIAction;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.border.*;
import javax.swing.plaf.*;
/**
* A default L&F implementation of MenuBarUI. This implementation
* is a "combined" view/controller.
*
* @author Georges Saab
* @author David Karlton
* @author Arnaud Weber
*/
public class BasicMenuBarUI extends MenuBarUI {
/**
* The instance of {@code JMenuBar}.
*/
protected JMenuBar menuBar = null;
/**
* The instance of {@code ContainerListener}.
*/
protected ContainerListener containerListener;
/**
* The instance of {@code ChangeListener}.
*/
protected ChangeListener changeListener;
private Handler handler;
/**
* Returns a new instance of {@code BasicMenuBarUI}.
*
* @param x a component
* @return a new instance of {@code BasicMenuBarUI}
*/
public static ComponentUI createUI(JComponent x) {
return new BasicMenuBarUI();
}
static void loadActionMap(LazyActionMap map) {
map.put(new Actions(Actions.TAKE_FOCUS));
}
public void installUI(JComponent c) {
menuBar = (JMenuBar) c;
installDefaults();
installListeners();
installKeyboardActions();
}
/**
* Installs default properties.
*/
protected void installDefaults() {
if (menuBar.getLayout() == null ||
menuBar.getLayout() instanceof UIResource) {
menuBar.setLayout(new DefaultMenuLayout(menuBar,BoxLayout.LINE_AXIS));
}
LookAndFeel.installProperty(menuBar, "opaque", Boolean.TRUE);
LookAndFeel.installBorder(menuBar,"MenuBar.border");
LookAndFeel.installColorsAndFont(menuBar,
"MenuBar.background",
"MenuBar.foreground",
"MenuBar.font");
}
/**
* Registers listeners.
*/
protected void installListeners() {
containerListener = createContainerListener();
changeListener = createChangeListener();
for (int i = 0; i < menuBar.getMenuCount(); i++) {
JMenu menu = menuBar.getMenu(i);
if (menu!=null)
menu.getModel().addChangeListener(changeListener);
}
menuBar.addContainerListener(containerListener);
}
/**
* Registers keyboard actions.
*/
protected void installKeyboardActions() {
InputMap inputMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
SwingUtilities.replaceUIInputMap(menuBar,
JComponent.WHEN_IN_FOCUSED_WINDOW, inputMap);
LazyActionMap.installLazyActionMap(menuBar, BasicMenuBarUI.class,
"MenuBar.actionMap");
}
InputMap getInputMap(int condition) {
if (condition == JComponent.WHEN_IN_FOCUSED_WINDOW) {
Object[] bindings = (Object[])DefaultLookup.get
(menuBar, this, "MenuBar.windowBindings");
if (bindings != null) {
return LookAndFeel.makeComponentInputMap(menuBar, bindings);
}
}
return null;
}
public void uninstallUI(JComponent c) {
uninstallDefaults();
uninstallListeners();
uninstallKeyboardActions();
menuBar = null;
}
/**
* Uninstalls default properties.
*/
protected void uninstallDefaults() {
if (menuBar!=null) {
LookAndFeel.uninstallBorder(menuBar);
}
}
/**
* Unregisters listeners.
*/
protected void uninstallListeners() {
menuBar.removeContainerListener(containerListener);
for (int i = 0; i < menuBar.getMenuCount(); i++) {
JMenu menu = menuBar.getMenu(i);
if (menu !=null)
menu.getModel().removeChangeListener(changeListener);
}
containerListener = null;
changeListener = null;
handler = null;
}
/**
* Unregisters keyboard actions.
*/
protected void uninstallKeyboardActions() {
SwingUtilities.replaceUIInputMap(menuBar, JComponent.
WHEN_IN_FOCUSED_WINDOW, null);
SwingUtilities.replaceUIActionMap(menuBar, null);
}
/**
* Returns an instance of {@code ContainerListener}.
*
* @return an instance of {@code ContainerListener}
*/
protected ContainerListener createContainerListener() {
return getHandler();
}
/**
* Returns an instance of {@code ChangeListener}.
*
* @return an instance of {@code ChangeListener}
*/
protected ChangeListener createChangeListener() {
return getHandler();
}
private Handler getHandler() {
if (handler == null) {
handler = new Handler();
}
return handler;
}
public Dimension getMinimumSize(JComponent c) {
return null;
}
public Dimension getMaximumSize(JComponent c) {
return null;
}
private class Handler implements ChangeListener, ContainerListener {
//
// ChangeListener
//
public void stateChanged(ChangeEvent e) {
int i,c;
for(i=0,c = menuBar.getMenuCount() ; i < c ; i++) {
JMenu menu = menuBar.getMenu(i);
if(menu !=null && menu.isSelected()) {
menuBar.getSelectionModel().setSelectedIndex(i);
break;
}
}
}
//
// ContainerListener
//
public void componentAdded(ContainerEvent e) {
Component c = e.getChild();
if (c instanceof JMenu)
((JMenu)c).getModel().addChangeListener(changeListener);
}
public void componentRemoved(ContainerEvent e) {
Component c = e.getChild();
if (c instanceof JMenu)
((JMenu)c).getModel().removeChangeListener(changeListener);
}
}
private static class Actions extends UIAction {
private static final String TAKE_FOCUS = "takeFocus";
Actions(String key) {
super(key);
}
public void actionPerformed(ActionEvent e) {
// TAKE_FOCUS
JMenuBar menuBar = (JMenuBar)e.getSource();
MenuSelectionManager defaultManager = MenuSelectionManager.defaultManager();
MenuElement me[];
MenuElement subElements[];
JMenu menu = menuBar.getMenu(0);
if (menu!=null) {
me = new MenuElement[3];
me[0] = (MenuElement) menuBar;
me[1] = (MenuElement) menu;
me[2] = (MenuElement) menu.getPopupMenu();
defaultManager.setSelectedPath(me);
}
}
}
}
⏎ javax/swing/plaf/basic/BasicMenuBarUI.java
Or download all of them as a single archive file:
File name: java.desktop-11.0.1-src.zip File size: 7974380 bytes Release date: 2018-11-04 Download
⇒ JDK 11 java.instrument.jmod - Instrument Module
2022-08-06, ≈888🔥, 5💬
Popular Posts:
JDK 11 jdk.hotspot.agent.jmod is the JMOD file for JDK 11 Hotspot Agent module. JDK 11 Hotspot Agent...
How to download and install JDK (Java Development Kit) 6? If you want to write Java applications, yo...
JDK 17 java.security.jgss.jmod is the JMOD file for JDK 17 Security JGSS (Java Generic Security Serv...
JDK 17 java.management.jmod is the JMOD file for JDK 17 Management module. JDK 17 Management module ...
How to display XML element type information with the jaxp\TypeInfoWriter.java provided in the Apache...