java.awt.event.MouseAdapter#javax.swing.JComponent源码实例Demo

下面列出了java.awt.event.MouseAdapter#javax.swing.JComponent 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
public void valueChanged(long bid)
{
  boolean bHasVisible = false;
  for (final JComponent comp : components) {
    if (comp.isShowing()) {
      bHasVisible = true;
      break;
    }
  }
  lastBID = bid;

  if (bHasVisible) {
    valueChangedLazy(bid);
  }
}
 
源代码2 项目: seaglass   文件: SeaGlassTextFieldUI.java
/**
 * {@inheritDoc}
 */
@Override
public void mouseMoved(MouseEvent e) {
    currentMouseX = e.getX();
    currentMouseY = e.getY();
    
    Cursor cursorToUse = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR);
    if (isOverCancelButton() || isOverFindButton()) {
       cursorToUse = Cursor.getDefaultCursor();  
    }
    JComponent c = (JComponent) e.getSource();
    if (!cursorToUse.equals(c.getCursor())) {
        c.setCursor(cursorToUse);
    }
    super.mouseMoved(e);
}
 
源代码3 项目: netbeans   文件: ProgressHandleFactoryTest.java
@RandomlyFails // NB-Core-Build #1176
public void testCustomComponentIsInitialized() {
    Controller.defaultInstance = new TestController();
    
    ProgressHandle handle = ProgressHandleFactory.createHandle("task 1");

    // Warning, this will make the handle to work with a new Controller, not TestController.
    JComponent component = ProgressHandleFactory.createProgressComponent(handle);
    handle.start(15);
    handle.progress(2);
    waitForTimerFinish();
    
    assertEquals(15, ((JProgressBar) component).getMaximum());
    assertEquals(2, ((JProgressBar) component).getValue());
    
    handle = ProgressHandleFactory.createHandle("task 2");
    component = ProgressHandleFactory.createProgressComponent(handle);
    
    handle.start(20);
    waitForTimerFinish();
    
    assertEquals(20, ((JProgressBar) component).getMaximum());
    assertEquals(0, ((JProgressBar) component).getValue());
    
}
 
源代码4 项目: netbeans   文件: ToolsAction.java
@NbBundle.Messages({
    "LAB_ToolsActionInitializing=Initializing..."
})
@Override
public JComponent[] synchMenuPresenters(JComponent[] items) {
    G g = gl(50);
    if (g == null) {
        JMenuItem init = new JMenuItem();
        init.setText(Bundle.LAB_ToolsActionInitializing());
        init.setEnabled(false);
        return new JMenuItem[] { init };
    }
    if (timestamp == g.getTimestamp()) {
        return items;
    }
    // generate directly list of menu items
    List<JMenuItem> l = generate(toolsAction, true);
    timestamp = gl().getTimestamp();
    return l.toArray(new JMenuItem[l.size()]);
}
 
源代码5 项目: ghidra   文件: DockingWindowManagerTest.java
private void assertStacked(DockingWindowManager dwm, ComponentProvider... providers) {

		Integer x = null;
		Integer y = null;

		for (ComponentProvider p : providers) {

			ComponentPlaceholder ph = dwm.getActivePlaceholder(p);
			ComponentNode n = ph.getNode();
			JComponent c = n.getComponent();
			Point l = c.getLocationOnScreen();

			if (x == null) {
				x = l.x;
				y = l.y;
			}
			else {
				assertEquals("Providers are not stacked together", x.intValue(), l.x);
				assertEquals("Providers are not stacked together", y.intValue(), l.y);
			}

		}
	}
 
源代码6 项目: brModelo   文件: MostradorDeCodigo.java
public MostradorDeCodigo(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    lblHtml = new JLabel();
    scrPrincipal.getViewport().add(lblHtml);
    //dbModel.InicieAnsi2011();
    
    getRootPane().registerKeyboardAction(e -> {
        //this.dispose();
        //setResultado(JOptionPane.CANCEL_OPTION);
        setVisible(false);

    }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
    getRootPane().registerKeyboardAction(e -> {
        //setResultado(JOptionPane.OK_OPTION);
        setVisible(false);
    }, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, java.awt.event.InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);

    getRootPane().registerKeyboardAction(e -> {
        btnCopyActionPerformed(null);
    }, KeyStroke.getKeyStroke(KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
    setTitle(Editor.fromConfiguracao.getValor("Controler.interface.Titulo.MostradorDeCodigo"));
    this.pack();
}
 
@Override
public int getSourceActions(JComponent c) {
	DisplayableCard p = (DisplayableCard) c;
	Point pt = p.getLocation();
	SwingUtilities.convertPointToScreen(pt, p);
	dragLab.setIcon(p.toIcon());
	window.setLocation(pt);
	return MOVE;
}
 
源代码8 项目: jmeter-plugins   文件: IntegerInputVerifier.java
/**
 * Verifies the input with the side effect that the background color of {@code input} to {@code background} if
 * returns {@code true}, or {@code warningBackground} otherwise
 *
 * @param input component
 * @return if input is valid
 */
public boolean shouldYieldFocus(JComponent input) {
    boolean isValidInput = verify(input);
    if (isValidInput) {
        input.setBackground(background);
    } else {
        input.setBackground(warningBackground);
    }
    return isValidInput;
}
 
源代码9 项目: TencentKona-8   文件: MultiFileChooserUI.java
/**
 * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int getAccessibleChildrenCount(JComponent a) {
    int returnValue =
        ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
    for (int i = 1; i < uis.size(); i++) {
        ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
    }
    return returnValue;
}
 
源代码10 项目: rapidminer-studio   文件: EditableTableHeader.java
@SuppressWarnings("deprecation")
public Component prepareEditor(TableCellEditor editor, int index) {
	Object value = columnModel.getColumn(index).getHeaderValue();
	boolean isSelected = true;
	int row = HEADER_ROW;
	JTable table = getTable();
	Component comp = editor.getTableCellEditorComponent(table, value, isSelected, row, index);
	if (comp instanceof JComponent) {
		((JComponent) comp).setNextFocusableComponent(this);
	}
	return comp;
}
 
源代码11 项目: rapidminer-studio   文件: ExampleVisualizer.java
protected JComponent makeMainVisualizationComponent(Example example) {
	JComponent main;
	String[] columnNames = new String[] { "Attribute", "Value" };
	String[][] data = new String[exampleSet.getAttributes().allSize()][2];
	Iterator<Attribute> a = exampleSet.getAttributes().allAttributes();
	int counter = 0;
	while (a.hasNext()) {
		Attribute attribute = a.next();
		data[counter][0] = attribute.getName();
		data[counter][1] = getFormattedValue(example, attribute);
		counter++;
	}
	ExtendedJTable table = new ExtendedJTable();
	table.setDefaultEditor(Object.class, null);
	TableModel tableModel = new DefaultTableModel(data, columnNames);
	table.setRowHighlighting(true);
	table.setRowHeight(PropertyPanel.VALUE_CELL_EDITOR_HEIGHT);
	table.setModel(tableModel);
	main = new ExtendedJScrollPane(table);
	main.setBorder(null);
	int tableHeight = (int) (table.getPreferredSize().getHeight() + table.getTableHeader().getPreferredSize().getHeight()
			+ 5); // 5 for border
	if (tableHeight < main.getPreferredSize().getHeight()) {
		main.setPreferredSize(new Dimension((int) main.getPreferredSize().getWidth(), tableHeight));
	}
	return main;
}
 
源代码12 项目: openjdk-jdk8u   文件: MultiSeparatorUI.java
/**
 * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public Accessible getAccessibleChild(JComponent a, int b) {
    Accessible returnValue =
        ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
    for (int i = 1; i < uis.size(); i++) {
        ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
    }
    return returnValue;
}
 
源代码13 项目: LGoodDatePicker   文件: FormLayout.java
private static void invalidateAndRepaint(Container container) {
    if (container == null) {
        return;
    }
    if (container instanceof JComponent) {
        ((JComponent) container).revalidate();
    } else {
        container.invalidate();
    }
    container.repaint();
}
 
源代码14 项目: jdk8u-jdk   文件: MultiProgressBarUI.java
/**
 * Returns a multiplexing UI instance if any of the auxiliary
 * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
 * UI object obtained from the default <code>LookAndFeel</code>.
 */
public static ComponentUI createUI(JComponent a) {
    ComponentUI mui = new MultiProgressBarUI();
    return MultiLookAndFeel.createUIs(mui,
                                      ((MultiProgressBarUI) mui).uis,
                                      a);
}
 
源代码15 项目: netbeans   文件: OnSaveTabPanelController.java
@Override
public JComponent getComponent(Lookup masterLookup) {
    if (panel == null) {
        panel = new OnSaveTabPanel();
    }
    return panel;
}
 
源代码16 项目: Java8CN   文件: MultiSeparatorUI.java
/**
 * Invokes the <code>contains</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public boolean contains(JComponent a, int b, int c) {
    boolean returnValue =
        ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
    }
    return returnValue;
}
 
源代码17 项目: openjdk-jdk9   文件: MultiOptionPaneUI.java
/**
 * Invokes the <code>contains</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public boolean contains(JComponent a, int b, int c) {
    boolean returnValue =
        uis.elementAt(0).contains(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        uis.elementAt(i).contains(a,b,c);
    }
    return returnValue;
}
 
源代码18 项目: openjdk-8   文件: MultiDesktopIconUI.java
/**
 * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int getAccessibleChildrenCount(JComponent a) {
    int returnValue =
        ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
    for (int i = 1; i < uis.size(); i++) {
        ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
    }
    return returnValue;
}
 
源代码19 项目: jdk8u-jdk   文件: MultiTabbedPaneUI.java
/**
 * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public Dimension getMinimumSize(JComponent a) {
    Dimension returnValue =
        ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
    for (int i = 1; i < uis.size(); i++) {
        ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
    }
    return returnValue;
}
 
源代码20 项目: WorldGrower   文件: ChooseKnowledgeAction.java
public ChooseKnowledgeAction(WorldObject playerCharacter, ImageInfoReader imageInfoReader, SoundIdReader soundIdReader, World world, JComponent parent, ActionContainingArgs guiAction, JFrame parentFrame) {
	super();
	this.playerCharacter = playerCharacter;
	this.imageInfoReader = imageInfoReader;
	this.soundIdReader = soundIdReader;
	this.world = world;
	this.parent = parent;
	this.guiAction = guiAction;
	this.parentFrame = parentFrame;
}
 
源代码21 项目: openjdk-jdk9   文件: MultiSliderUI.java
/**
 * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public Dimension getMinimumSize(JComponent a) {
    Dimension returnValue =
        uis.elementAt(0).getMinimumSize(a);
    for (int i = 1; i < uis.size(); i++) {
        uis.elementAt(i).getMinimumSize(a);
    }
    return returnValue;
}
 
源代码22 项目: jdk8u-dev-jdk   文件: SlidingSpinner.java
SlidingSpinner(ColorPanel panel, JComponent label) {
    this.panel = panel;
    this.label = label;
    this.slider.addChangeListener(this);
    this.spinner.addChangeListener(this);
    DefaultEditor editor = (DefaultEditor) this.spinner.getEditor();
    ValueFormatter.init(3, false, editor.getTextField());
    editor.setFocusable(false);
    this.spinner.setFocusable(false);
}
 
源代码23 项目: openjdk-jdk8u-backup   文件: MultiTableUI.java
/**
 * Returns a multiplexing UI instance if any of the auxiliary
 * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
 * UI object obtained from the default <code>LookAndFeel</code>.
 */
public static ComponentUI createUI(JComponent a) {
    ComponentUI mui = new MultiTableUI();
    return MultiLookAndFeel.createUIs(mui,
                                      ((MultiTableUI) mui).uis,
                                      a);
}
 
源代码24 项目: dragonwell8_jdk   文件: MultiSliderUI.java
/**
 * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public Dimension getMinimumSize(JComponent a) {
    Dimension returnValue =
        ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
    for (int i = 1; i < uis.size(); i++) {
        ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
    }
    return returnValue;
}
 
源代码25 项目: netbeans   文件: ClasspathCategoryProvider.java
public JComponent createComponent(Category category, Lookup context) {
    Project project = context.lookup(Project.class);
    ProjectAccessor acc = context.lookup(ProjectAccessor.class);
    AuxiliaryConfiguration aux = context.lookup(AuxiliaryConfiguration.class);
    assert aux != null;
    assert acc != null;
    assert project != null;
    
    final JdkConfiguration jdkConf = new JdkConfiguration(project, acc.getHelper(), acc.getEvaluator());
    
    final ClasspathPanel panel = new ClasspathPanel(jdkConf);
    final JavaPlatform initialPlatform = (JavaPlatform) panel.javaPlatform.getSelectedItem();
    ProjectModel pm = context.lookup(ProjectModel.class);
    assert pm != null;
    panel.setModel(pm);
    pm.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            panel.updateControls();
        }
    });
    category.setOkButtonListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            JavaPlatform p = (JavaPlatform) panel.javaPlatform.getSelectedItem();
            if (p != initialPlatform) {
                try {
                    jdkConf.setSelectedPlatform(p);
                } catch (IOException x) {
                    ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, x);
                }
            }
        }
    });
    return panel;
    
}
 
源代码26 项目: openjdk-8-source   文件: MultiFileChooserUI.java
/**
 * Returns a multiplexing UI instance if any of the auxiliary
 * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
 * UI object obtained from the default <code>LookAndFeel</code>.
 */
public static ComponentUI createUI(JComponent a) {
    ComponentUI mui = new MultiFileChooserUI();
    return MultiLookAndFeel.createUIs(mui,
                                      ((MultiFileChooserUI) mui).uis,
                                      a);
}
 
源代码27 项目: Rails   文件: HexHighlightMouseListener.java
/**
 * @param pf Portfolio which is dynamically evaluated at mouse-even-time for
 * any contained private companies
 */
public static void addMouseListener(JComponent c,ORUIManager orUIManager,PortfolioModel pf) {
    if (isEnabled(false)) {
        HexHighlightMouseListener l = new HexHighlightMouseListener(orUIManager);
        l.portfolio = pf;
        c.addMouseListener(l);
    }
}
 
源代码28 项目: netbeans   文件: AbstractDesignEditor.java
/**
 * Used to get the JComponent used for the structure pane. Usually a container for the structure component or the structure component itself.
 * @return the JComponent
 */
public JComponent getStructureView(){
    if (structureView ==null){
        structureView = createStructureComponent();
        structureView.addPropertyChangeListener(new NodeSelectedListener());
    }
    return structureView;
}
 
源代码29 项目: netbeans   文件: Utils.java
public static void hideLabelAndLabelFor(JComponent component, String lab) {
    JLabel label = findLabel(component, lab);
    if(label != null) {
        label.setVisible(false);
        Component c = label.getLabelFor();
        if(c != null) {
            c.setVisible(false);
        }
    }
}
 
源代码30 项目: TencentKona-8   文件: NimbusLookAndFeel.java
/** Called by UIManager when this look and feel is installed. */
@Override public void initialize() {
    super.initialize();
    defaults.initialize();
    // create synth style factory
    setStyleFactory(new SynthStyleFactory() {
        @Override
        public SynthStyle getStyle(JComponent c, Region r) {
            return defaults.getStyle(c, r);
        }
    });
}