Java Code Examples for javax.swing.JComponent#addComponentListener()
The following examples show how to use
javax.swing.JComponent#addComponentListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DemoTheatreApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 6 votes |
/** * Creates a progress bar. * * @param parent progress bar's parent. The horizontal axis of the progress bar will be center-aligned to the parent. * @return a progress bar. */ private static JProgressBar createProgressBar(final JComponent parent) { final JProgressBar progressBar = new JProgressBar(); progressBar.setSize(260, 20); parent.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { progressBar.setLocation( parent.getWidth() / 2 - progressBar.getWidth() / 2, parent.getHeight() - progressBar.getHeight() - 20); } }); progressBar.setStringPainted(true); progressBar.setIndeterminate(true); progressBar.setVisible(false); return progressBar; }
Example 2
Source File: DemoTheatreAppImproved.java From arcgis-runtime-demo-java with Apache License 2.0 | 6 votes |
/** * Creates a progress bar. * * @param parent progress bar's parent. The horizontal axis of the progress bar will be center-aligned to the parent. * @return a progress bar. */ private static JProgressBar createProgressBar(final JComponent parent) { final JProgressBar progressBar = new JProgressBar(); progressBar.setSize(260, 20); parent.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { progressBar.setLocation( parent.getWidth() / 2 - progressBar.getWidth() / 2, parent.getHeight() - progressBar.getHeight() - 20); } }); progressBar.setStringPainted(true); progressBar.setIndeterminate(true); progressBar.setVisible(false); return progressBar; }
Example 3
Source File: ExtendedSatelliteComponent.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void addNotify() { super.addNotify(); scene.addSceneListener(this); JComponent viewComponent = scene.getView(); if (viewComponent == null) { viewComponent = scene.createView(); } viewComponent.addComponentListener(this); repaint(); }
Example 4
Source File: ExtendedSatelliteComponent.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void addNotify() { super.addNotify(); scene.addSceneListener(this); JComponent viewComponent = scene.getView(); if (viewComponent == null) { viewComponent = scene.createView(); } viewComponent.addComponentListener(this); repaint(); }
Example 5
Source File: MultiThumbSliderUI.java From pumpernickel with MIT License | 5 votes |
@Override public void installUI(JComponent slider) { slider.addMouseListener(this); slider.addMouseMotionListener(this); slider.addFocusListener(focusListener); slider.addKeyListener(keyListener); slider.addComponentListener(compListener); slider.addPropertyChangeListener(propertyListener); slider.addPropertyChangeListener(THUMB_SHAPE_PROPERTY, thumbShapeListener); calculateGeometry(); }
Example 6
Source File: ThumbnailLabelUI.java From pumpernickel with MIT License | 5 votes |
@Override public void installUI(JComponent c) { super.installUI(c); c.addComponentListener(repaintComponentListener); JLabel label = (JLabel) c; label.setHorizontalTextPosition(SwingConstants.CENTER); label.setIconTextGap(3); }
Example 7
Source File: BoxTabbedPaneUI.java From pumpernickel with MIT License | 5 votes |
private void installExtraComponents(Container container, List<JComponent> components, boolean forceReinstall) { if (components == null) components = new ArrayList<>(); Component[] oldComponents = container.getComponents(); if (!Arrays.asList(oldComponents).equals(components)) { forceReinstall = true; } if (forceReinstall) { container.removeAll(); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 100; c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; for (JComponent jc : components) { container.add(jc, c); if (tabs.getTabPlacement() == SwingConstants.LEFT) { c.gridy--; } else if (tabs.getTabPlacement() == SwingConstants.RIGHT) { c.gridy++; } else { c.gridx++; } jc.removeComponentListener(extraComponentListener); jc.addComponentListener(extraComponentListener); for (Component oldComponent : oldComponents) { if (components.contains(oldComponent)) { oldComponent .removeComponentListener(extraComponentListener); } } } container.revalidate(); } refreshExtraContainerVisibility(); }
Example 8
Source File: MultiThumbSliderUI.java From PyramidShader with GNU General Public License v3.0 | 5 votes |
@Override public void installUI(JComponent slider) { slider.addMouseListener(this); slider.addMouseMotionListener(this); slider.addFocusListener(focusListener); slider.addKeyListener(keyListener); slider.addComponentListener(compListener); slider.addPropertyChangeListener(propertyListener); slider.addPropertyChangeListener(THUMB_SHAPE_PROPERTY, thumbShapeListener); calculateGeometry(); }
Example 9
Source File: BubbleWindow.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
void addComponentListenerTo(JComponent comp) { comp.addComponentListener(compListener); }