java类java.awt.event.ComponentAdapter的实例源码

ErrorBarPane.java 文件源码 项目:samebug-idea-plugin 阅读 18 收藏 0 点赞 0 评论 0
public ErrorBarPane() {
    setOpaque(true);
    setBackground(ColorService.Background);
    addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            super.componentResized(e);
            if (mainComponent != null) repositionMainComponent();
            if (errorBar != null) repositionErrorBar();
        }
    });

    timer = new Timer(ShowPopupForMillis, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            removeErrorBar(errorBar);
        }
    });
    timer.setRepeats(false);
    updateUI();
}
SearchUsers.java 文件源码 项目:bisis-v4 阅读 16 收藏 0 点赞 0 评论 0
public void init() {
    getCmbPref1().setVisible(false);
    getCmbPref2().setVisible(false);
    getCmbPref3().setVisible(false);
    getCmbPref4().setVisible(false);
    getCmbPref5().setVisible(false);
    getLPref1().setText(Messages.getString("circulation.firstname")); //$NON-NLS-1$
    getTfPref1().setVisible(true);
    getLPref2().setText(Messages.getString("circulation.lastname")); //$NON-NLS-1$
    getTfPref2().setVisible(true);
    getLPref3().setText(Messages.getString("circulation.umcn")); //$NON-NLS-1$
    getTfPref3().setVisible(true);
    getLPref4().setText(Messages.getString("circulation.address")); //$NON-NLS-1$
    getTfPref4().setVisible(true);
    getLPref5().setText(Messages.getString("circulation.usernumber")); //$NON-NLS-1$
    getTfPref5().setVisible(true);

    getLDate1().setText(Messages.getString("circulation.chargingdate")); //$NON-NLS-1$
    getLDate2().setText(Messages.getString("circulation.dischargingdate")); //$NON-NLS-1$
   getPanel().addComponentListener(new ComponentAdapter() {
     public void componentShown(ComponentEvent e){
       getTfPref1().requestFocusInWindow();
     }
   });
}
JGVTComponent.java 文件源码 项目:Push2Display 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Creates a new JGVTComponent.
 * @param eventsEnabled Whether the GVT tree should be reactive
 *        to mouse and key events.
 * @param selectableText Whether the text should be selectable.
 *        if eventEnabled is false, this flag is ignored.
 */
public JGVTComponent(boolean eventsEnabled,
                     boolean selectableText) {
    setBackground(Color.white);
    // setDoubleBuffered(false);

    this.eventsEnabled = eventsEnabled;
    this.selectableText = selectableText;

    listener = createListener();

    addAWTListeners();

    addGVTTreeRendererListener(listener);

    addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent e) {
                if (updateRenderingTransform())
                    scheduleGVTRendering();
            }
        });

}
FontPanel.java 文件源码 项目:jdk8u_jdk 阅读 32 收藏 0 点赞 0 评论 0
public FontPanel( Font2DTest demo, JFrame f ) {
    f2dt = demo;
    parent = f;

    verticalBar = new JScrollBar ( JScrollBar.VERTICAL );
    fc = new FontCanvas();

    this.setLayout( new BorderLayout() );
    this.add( "Center", fc );
    this.add( "East", verticalBar );

    verticalBar.addAdjustmentListener( this );
    this.addComponentListener( new ComponentAdapter() {
        public void componentResized( ComponentEvent e ) {
            updateBackBuffer = true;
            updateFontMetrics = true;
        }
    });

    /// Initialize font and its infos
    testFont = new Font(fontName, fontStyle, (int)fontSize);
    if ((float)((int)fontSize) != fontSize) {
        testFont = testFont.deriveFont(fontSize);
    }
    updateFontInfo();
}
Popup401.java 文件源码 项目:jdk8u_jdk 阅读 18 收藏 0 点赞 0 评论 0
private static void createAndShowGUI() {
    frame = new JFrame("HangPopupTest");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.setSize(1000, 1000);

    test = new Popup401();
    frame.add(test);
    frame.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentShown(ComponentEvent e) {
            super.componentShown(e);
            test.run();
            synchronized (testCompleted) {
                testCompleted.notifyAll();
            }
        }
    });
    frame.pack();
    frame.setVisible(true);
}
FontPanel.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 25 收藏 0 点赞 0 评论 0
public FontPanel( Font2DTest demo, JFrame f ) {
    f2dt = demo;
    parent = f;

    verticalBar = new JScrollBar ( JScrollBar.VERTICAL );
    fc = new FontCanvas();

    this.setLayout( new BorderLayout() );
    this.add( "Center", fc );
    this.add( "East", verticalBar );

    verticalBar.addAdjustmentListener( this );
    this.addComponentListener( new ComponentAdapter() {
        public void componentResized( ComponentEvent e ) {
            updateBackBuffer = true;
            updateFontMetrics = true;
        }
    });

    /// Initialize font and its infos
    testFont = new Font(fontName, fontStyle, (int)fontSize);
    if ((float)((int)fontSize) != fontSize) {
        testFont = testFont.deriveFont(fontSize);
    }
    updateFontInfo();
}
ConfigurationErrorsComponent.java 文件源码 项目:intellij-ce-playground 阅读 28 收藏 0 点赞 0 评论 0
public ConfigurationErrorsComponent(@NotNull final Project project) {
  setLayout(new BorderLayout());
  myConfigurationErrorsListModel = new ConfigurationErrorsListModel(project);
  myConfigurationErrorsListModel.addListDataListener(this);

  addComponentListener(new ComponentAdapter() {
    @Override
    public void componentResized(final ComponentEvent e) {
      revalidate();
      repaint();
    }
  });

  ensureCurrentViewIs(ONE_LINE, null);
  Disposer.register(this, myConfigurationErrorsListModel);
}
BasicGraphEditor.java 文件源码 项目:OWLAx 阅读 30 收藏 0 点赞 0 评论 0
/**
 * 
 */
public EditorPalette insertPalette(String title) {
    final EditorPalette palette = new EditorPalette();
    final JScrollPane scrollPane = new JScrollPane(palette);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    libraryPane.add(title, scrollPane);

    // Updates the widths of the palettes if the container size changes
    libraryPane.addComponentListener(new ComponentAdapter() {
        /**
         * 
         */
        public void componentResized(ComponentEvent e) {
            int w = scrollPane.getWidth() - scrollPane.getVerticalScrollBar().getWidth();
            palette.setPreferredWidth(w);
        }

    });

    return palette;
}
UtilGUI.java 文件源码 项目:code-similarity 阅读 25 收藏 0 点赞 0 评论 0
/** 
 * Track a Window's position across application restarts; location is saved
 * in a Preferences node that you pass in; we attach a ComponentListener to
 * the Window.
 */
public static void monitorWindowPosition(
    final Window w, final Preferences pNode) {

    // Get the current saved position, if any
    Point p = getSavedLocation(pNode);
    int savedX = (int)p.getX();
    int savedY = (int)p.getY();
    if (savedX != -1) {
        // Move window to is previous location
        w.setLocation(savedX, savedY);
    } else {
        // Not saved yet, at least make it look nice
        centre(w);
    }
    // Now make sure that if the user moves the window,
    // we will save the new position.
    w.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentMoved(ComponentEvent e) {
            setSavedLocation(pNode, w);
        }
    });
}
EventHelper.java 文件源码 项目:VISNode 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Adds a component move listener
 * 
 * @param component
 * @param listener 
 */
public static void addMoveListener(Component component, ComponentMoveListener listener) {
    component.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentMoved(ComponentEvent e) {
            listener.componentMoved(e);
        }
    });
}


问题


面经


文章

微信
公众号

扫码关注公众号