当前位置: 首页>>代码示例>>Java>>正文


Java MenuComponent类代码示例

本文整理汇总了Java中java.awt.MenuComponent的典型用法代码示例。如果您正苦于以下问题:Java MenuComponent类的具体用法?Java MenuComponent怎么用?Java MenuComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MenuComponent类属于java.awt包,在下文中一共展示了MenuComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dispatchNextGuiEvent

import java.awt.MenuComponent; //导入依赖的package包/类
/**
 * Processes the next GUI event.
 */
public void dispatchNextGuiEvent() throws InterruptedException {
    EventQueue queue = awtEventQueue;
    if (queue == null) {
        queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
        awtEventQueue = queue;
    }
    AWTEvent event = queue.getNextEvent();
    if (event instanceof ActiveEvent) {
        ((ActiveEvent)event).dispatch();
    } else {
        Object source = event.getSource();
        if (source instanceof Component) {
            Component comp = (Component)source;
            comp.dispatchEvent(event);
        } else if (source instanceof MenuComponent) {
            ((MenuComponent)source).dispatchEvent(event);
        }
    }
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:23,代码来源:SwingGui.java

示例2: setFont

import java.awt.MenuComponent; //导入依赖的package包/类
/**
 * Sets font based on MenuComponent font, or containing menu(bar)
 * parent font.
 */
private void setFont()
{
  MenuComponent mc = ((MenuComponent) awtWidget);
  Font f = mc.getFont();

  if (f == null)
    {
      MenuContainer parent = mc.getParent ();
      // Submenus inherit the font of their containing Menu(Bar).
      if (parent instanceof MenuComponent)
        f = parent.getFont ();
    }

  setFont(f);
}
 
开发者ID:vilie,项目名称:javify,代码行数:20,代码来源:GtkMenuComponentPeer.java

示例3: QtMenuComponentPeer

import java.awt.MenuComponent; //导入依赖的package包/类
public QtMenuComponentPeer( QtToolkit kit, MenuComponent owner )
{
  this.toolkit = kit;
  this.owner = owner;
  nativeObject = 0;
  synchronized(this)
    {
      callInit(); // Calls the init method FROM THE MAIN THREAD.
      try
        {
          wait(); // Wait for the thing to be created.
        }
      catch(InterruptedException e)
        {
        }
    }
  setup();
}
 
开发者ID:vilie,项目名称:javify,代码行数:19,代码来源:QtMenuComponentPeer.java

示例4: setFont

import java.awt.MenuComponent; //导入依赖的package包/类
/**
 * Sets font based on MenuComponent font, or containing menu(bar)
 * parent font.
 */
private void setFont()
{
  MenuComponent mc = ((MenuComponent) awtWidget);
  Font f = mc.getFont();
  
  if (f == null)
    {
      MenuContainer parent = mc.getParent ();
      // Submenus inherit the font of their containing Menu(Bar).
      if (parent instanceof MenuComponent)
        f = parent.getFont ();
    }

  setFont(f);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:20,代码来源:GtkMenuComponentPeer.java

示例5: QtMenuComponentPeer

import java.awt.MenuComponent; //导入依赖的package包/类
public QtMenuComponentPeer( QtToolkit kit, MenuComponent owner )
 {
   this.toolkit = kit;
   this.owner = owner;
   nativeObject = 0;
   synchronized(this) 
     {
callInit(); // Calls the init method FROM THE MAIN THREAD.
try
  {	
    wait(); // Wait for the thing to be created.
  }
catch(InterruptedException e)
  {
  }
     }
   setup();
 }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:19,代码来源:QtMenuComponentPeer.java

示例6: run

import java.awt.MenuComponent; //导入依赖的package包/类
public synchronized void run() {
	while (true) {
		try {
			wait();
			wait(delay);
			if (source instanceof Component) {
				parent = SwingUtilities.getRoot((Component) source);
			} else if (source instanceof MenuComponent) {
				MenuContainer mParent = ((MenuComponent) source).getParent();
				if (mParent instanceof Component) {
					parent = SwingUtilities.getRoot((Component) mParent);
				}
			}
			if ((parent != null) && parent.isShowing()) {
				parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			}
		} catch (InterruptedException ie) {
		}
	}
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:21,代码来源:WaitCursorEventQueue.java

示例7: remove

import java.awt.MenuComponent; //导入依赖的package包/类
/**
 * Maps {@code Component.remove(MenuComponent)} through queue
 */
public void remove(final MenuComponent menuComponent) {
    runMapping(new MapVoidAction("remove") {
        @Override
        public void map() {
            getSource().remove(menuComponent);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:ComponentOperator.java

示例8: dispatchEvent

import java.awt.MenuComponent; //导入依赖的package包/类
public void dispatchEvent( AWTEvent event )
{
  Object src = event.getSource();
  if( event instanceof ActiveEvent )
  {
    ((ActiveEvent)event).dispatch();
  }
  else if( src instanceof Component )
  {
    ((Component)src).dispatchEvent( event );
  }
  else if( src instanceof MenuComponent )
  {
    ((MenuComponent)src).dispatchEvent( event );
  }
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:17,代码来源:ModalEventQueue.java

示例9: GtkMenuComponentPeer

import java.awt.MenuComponent; //导入依赖的package包/类
/**
 * Will call the abstract <code>create()</code> that needs to be
 * overridden by subclasses, to create the MenuComponent. It will
 * then correctly setup the font for the component based on the
 * component and/or its containing parent component.
 */
public GtkMenuComponentPeer(MenuComponent component)
{
  super(component);
  create();
  setFont();
}
 
开发者ID:vilie,项目名称:javify,代码行数:13,代码来源:GtkMenuComponentPeer.java

示例10: showModal

import java.awt.MenuComponent; //导入依赖的package包/类
private void showModal() {
	EventQueue theQueue = getToolkit().getSystemEventQueue();
	while (isVisible()) {
		AWTEvent event = null;
		try {
			event = theQueue.getNextEvent();
		} catch (InterruptedException x) {
			LOG.warning(x.getLocalizedMessage());
			continue;
		}
		Object source = event.getSource();

		if (event instanceof MouseEvent) {
			MouseEvent e = (MouseEvent) event;
			MouseEvent m = SwingUtilities.convertMouseEvent((Component) e.getSource(), e, this);
			if (!this.contains(m.getPoint()) && e.getID() != MouseEvent.MOUSE_DRAGGED) {
				continue;
			}
		}

		if (event instanceof ActiveEvent) {
			((ActiveEvent) event).dispatch();
		} else if (source instanceof Component) {
			((Component) source).dispatchEvent(event);
		} else if (source instanceof MenuComponent) {
			((MenuComponent) source).dispatchEvent(event);
		} else {
			LOG.warning("Not dispatched: " + event);
		}
	}
}
 
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:32,代码来源:SwingInternalFrame.java

示例11: lock

import java.awt.MenuComponent; //导入依赖的package包/类
public void lock() {
	lockCount++;
	setCursorRecursive(this, Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
	EventQueue theQueue = getToolkit().getSystemEventQueue();
	while (lockCount > 0) {
		AWTEvent event = null;
		try {
			event = theQueue.getNextEvent();
		} catch (InterruptedException x) {
			LOG.warning(x.getLocalizedMessage());
			continue;
		}
		Object source = event.getSource();

		if (event instanceof MouseEvent) {
			continue;
		}

		if (event instanceof ActiveEvent) {
			((ActiveEvent) event).dispatch();
		} else if (source instanceof Component) {
			((Component) source).dispatchEvent(event);
		} else if (source instanceof MenuComponent) {
			((MenuComponent) source).dispatchEvent(event);
		} else {
			LOG.warning("Not dispatched: " + event);
		}
	}
	setCursorRecursive(this, Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
 
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:31,代码来源:EditablePanel.java

示例12: run

import java.awt.MenuComponent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public synchronized void run() {
  //noinspection InfiniteLoopStatement
  while (true) {
    try {
      // wait for notification from startTimer()
      wait();

      // wait for event processing to reach the threshold, or
      // interruption from stopTimer()
      wait(delay);

      if (source instanceof Component) {
        parent = SwingUtil.getWindowOrInternalFrame((Component) source);
      } else if (source instanceof MenuComponent) {
        MenuContainer mParent = ((MenuComponent) source).getParent();
        if (mParent instanceof Component) {
          parent = SwingUtil.getWindowOrInternalFrame((Component) mParent);
        }
      }

      if (parent != null && parent.isShowing()) {
        if (parent instanceof RootPaneContainer) {
          ((RootPaneContainer) parent).getGlassPane().setCursor(
              Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        }
        // parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
      }
    } catch (InterruptedException ie) {
      // just finish.
    }
  }
}
 
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:37,代码来源:WaitCursorTimer.java

示例13: run

import java.awt.MenuComponent; //导入依赖的package包/类
/**
 */
public synchronized void run() {
    while (true) {
        try {

            // wait for notification from startTimer()
            wait();

            // wait for event processing to reach the threshold, or
            // interruption from stopTimer()
            wait(delay);

            if (source instanceof Component) {
                parent = SwingUtilities.getRoot((Component) source);
            }
            else if (source instanceof MenuComponent) {
                MenuContainer mParent = ((MenuComponent) source).getParent();
                if (mParent instanceof Component) {
                    parent = SwingUtilities.getRoot((Component) mParent);
                }
            }

            if ((parent != null) && parent.isShowing()) {
                parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            }
        }
        catch (InterruptedException ie) {}
    }
}
 
开发者ID:hohonuuli,项目名称:mbarix4j,代码行数:31,代码来源:WaitCursorEventQueue.java

示例14: remove

import java.awt.MenuComponent; //导入依赖的package包/类
@Override
public synchronized void remove(MenuComponent popup) {
    super.remove(popup);
    updateOpacity();
    invalidate();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:PlaceholderPanel.java

示例15: remove

import java.awt.MenuComponent; //导入依赖的package包/类
public void remove(MenuComponent component) {
    getContentPanel().remove(component);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:JTitledPanel.java


注:本文中的java.awt.MenuComponent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。