本文整理了Java中java.awt.Window.addComponentListener()
方法的一些代码示例,展示了Window.addComponentListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.addComponentListener()
方法的具体详情如下:
包路径:java.awt.Window
类名称:Window
方法名:addComponentListener
暂无
代码示例来源:origin: bobbylight/RSyntaxTextArea
Listener() {
addWindowFocusListener(this);
// If anything happens to the "parent" window, hide this popup
Window parent = (Window)getParent();
parent.addWindowFocusListener(this);
parent.addWindowListener(this);
parent.addComponentListener(this);
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
Listener() {
addWindowFocusListener(this);
list.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount()==2) {
insertSelectedItem();
}
}
});
list.getInputMap().put(
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "onEnter");
list.getActionMap().put("onEnter", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
insertSelectedItem();
}
});
// If anything happens to the "parent" window, hide this popup
Window parent = (Window)getParent();
parent.addWindowFocusListener(this);
parent.addWindowListener(this);
parent.addComponentListener(this);
}
代码示例来源:origin: abbot/abbot
/**
* Do not call directly as can cause a stack overflow with multiple attacments to the
* listener list
*/
public WindowWatcher(Window w) {
w.addComponentListener(this);
w.addWindowListener(this);
}
public void componentShown(ComponentEvent e) {
代码示例来源:origin: xyz.cofe/docking-frames-core
public void addWindowProviderListener( WindowProviderListener listener ) {
if( listener == null )
throw new IllegalArgumentException( "null is not allowed as listener" );
if( listeners.size() == 0 ){
updateVisibility();
if( window != null ){
window.addComponentListener( windowListener );
// updateVisibility();
}
}
listeners.add( listener );
}
代码示例来源:origin: com.github.lgooddatepicker/LGoodDatePicker
/**
* registerListeners, This function registers this class as a listener with the appropriate
* components. De-registration is handled in the hide() function.
*/
private void registerListeners() {
// Register this class as a focus listener with the display window.
displayWindow.addWindowFocusListener(this);
// Register this class as a window movement listener with the top window.
topWindow.addComponentListener(this);
}
代码示例来源:origin: com.fifesoft/autocomplete
public void addTo(Window w) {
w.addComponentListener(this);
w.addWindowFocusListener(this);
}
代码示例来源:origin: robo-code/robocode
public Rectangle getWindowRect(Window window) {
window.addComponentListener(this);
String rString = (String) getWindowPositions().get(window.getClass().getName());
if (rString == null) {
return null;
}
StringTokenizer tokenizer = new StringTokenizer(rString, ",");
int x = Integer.parseInt(tokenizer.nextToken());
int y = Integer.parseInt(tokenizer.nextToken());
int width = Integer.parseInt(tokenizer.nextToken());
int height = Integer.parseInt(tokenizer.nextToken());
return fitWindowBoundsToScreen(new Rectangle(x, y, width, height));
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
/**
* Binds this preference object to synchronize its state with a given component,
* allowing to specify an initial offset compared to the stored position.
*/
public void bindSize(final Window window, int initialWidth, int initialHeight) {
updateSize(window, initialWidth, initialHeight);
window.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
setWidth(window.getWidth());
setHeight(window.getHeight());
}
});
}
代码示例来源:origin: com.fifesoft.rtext/fife.common
/**
* Called when this component receives a parent. This method is
* overridden so we can add a component listener to the parent window
* to know when it is maximized/de-maximized.
*/
@Override
public void addNotify() {
super.addNotify();
window = (Window)SwingUtilities.getRoot(this);
window.addComponentListener(maximizeWindow);
}
代码示例来源:origin: joel-costigliola/assertj-swing
/**
* Creates a new {@link WindowVisibilityMonitor} and attaches it to the given {@code Window}.
*
* @param target the {@code Window} to attach the new monitor to.
*/
void attachNewWindowVisibilityMonitor(Window target) {
WindowVisibilityMonitor monitor = new WindowVisibilityMonitor(this);
target.addWindowListener(monitor);
target.addComponentListener(monitor);
}
代码示例来源:origin: de.sciss/scisslib
private void learnWindow( Container c )
{
if( c != null && c instanceof Window ) {
win = (Window) c;
win.addWindowListener( winL );
win.addComponentListener( cmpL );
if( EventManager.DEBUG_EVENTS ) {
System.err.println( "DynamicAncestorAdapter added WindowListener : "+
win.getClass().getName() );
}
if( !listening && win.isShowing() ) startListening();
}
}
代码示例来源:origin: net.java.dev.jna/jna-platform
@Override
public void addNotify() {
super.addNotify();
Window w = SwingUtilities.getWindowAncestor(this);
setSize(getParent().getSize());
w.addComponentListener(listener);
w.addWindowListener(listener);
Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.MOUSE_EVENT_MASK|AWTEvent.MOUSE_MOTION_EVENT_MASK);
}
代码示例来源:origin: net.java.dev.jna/platform
public void addNotify() {
super.addNotify();
Window w = SwingUtilities.getWindowAncestor(this);
setSize(getParent().getSize());
w.addComponentListener(listener);
w.addWindowListener(listener);
Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.MOUSE_EVENT_MASK|AWTEvent.MOUSE_MOTION_EVENT_MASK);
}
代码示例来源:origin: mucommander/mucommander
private void init(Window window, JComponent leftComponent, JComponent rightComponent) {
this.window = window;
window.addComponentListener(this);
BasicSplitPaneDivider divider = getDividerComponent();
divider.addComponentListener(this);
divider.addMouseListener(this);
// Set null minimum size for both components so that divider can be moved all the way left/up and right/down
Dimension nullDimension = new Dimension(0,0);
if(leftComponent!=null)
leftComponent.setMinimumSize(nullDimension);
if(rightComponent!=null)
rightComponent.setMinimumSize(nullDimension);
}
代码示例来源:origin: com.l2fprod.common/l2fprod-common-shared
/**
* Restores the window size, position and state if possible. Tracks the
* window size, position and state.
*
* @param window
*/
public static void track(Window window) {
Preferences prefs = node().node("Windows");
String bounds = prefs.get(window.getName() + ".bounds", null);
if (bounds != null) {
Rectangle rect =
(Rectangle)ConverterRegistry.instance().convert(
Rectangle.class,
bounds);
window.setBounds(rect);
}
window.addComponentListener(windowDimension);
}
代码示例来源:origin: com.fifesoft/rsyntaxtextarea
Listener() {
addWindowFocusListener(this);
// If anything happens to the "parent" window, hide this popup
Window parent = (Window)getParent();
parent.addWindowFocusListener(this);
parent.addWindowListener(this);
parent.addComponentListener(this);
}
代码示例来源:origin: xyz.cofe/docking-frames-core
/**
* Updates the visibility state and listeners that observe the
* visibility state.
*/
protected void updateVisibility(){
Window current = searchWindow();
if( window != current ){
if( listeners.size() > 0 ){
if( window != null )
window.removeComponentListener( windowListener );
if( current != null )
current.addComponentListener( windowListener );
}
window = current;
}
boolean showing = isShowing();
if( windowShowing != showing ){
windowShowing = showing;
fireVisibilityChanged( showing );
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf
/**
* Description of the Method
*
* @param e Description of Parameter
*/
public void windowActivated(WindowEvent e) {
if (ignoreEvents) {
// ok the next event will be processed
ignoreEvents = false;
return;
}
if (lastActivate != null) {
lastActivate.removeComponentListener(this);
}
attachSnapTo(e.getWindow());
lastActivate = e.getWindow();
lastActivate.addComponentListener(this);
}
代码示例来源:origin: xyz.cofe/docking-frames-core
/**
* Sets the shape to apply, this method does nothing if this adapter is not {@link #isEnabled() enabled}.
* @param shape the shape to apply or <code>null</code>
*/
public void setShape( ScreenWindowShape shape ){
if( (isEnabled() || shape == null) && shape != this.shape ){
if( this.shape != null ){
this.shape.setCallback( null );
window.removeComponentListener( callback );
}
this.shape = shape;
if( this.shape != null ){
this.shape.setCallback( callback );
this.shape.onShown();
window.addComponentListener( callback );
}
}
}
代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-core
/**
* Sets the shape to apply, this method does nothing if this adapter is not {@link #isEnabled() enabled}.
* @param shape the shape to apply or <code>null</code>
*/
public void setShape( ScreenWindowShape shape ){
if( (isEnabled() || shape == null) && shape != this.shape ){
if( this.shape != null ){
this.shape.setCallback( null );
window.removeComponentListener( callback );
}
this.shape = shape;
if( this.shape != null ){
this.shape.setCallback( callback );
this.shape.onShown();
window.addComponentListener( callback );
}
}
}
内容来源于网络,如有侵权,请联系作者删除!