Java 8 JLayer - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 JLayer class.

This code example shows how to use the following methods:repaint
 
    @Override 
    @SuppressWarnings("rawtypes")  
    public void applyPropertyChange(final PropertyChangeEvent pce, final JLayer l) {
        if ("tick".equals(pce.getPropertyName())) {
            l.repaint();
        } 
    } 
} 
3
CodeRank
This code example shows how to use the following methods:repaint
 
    @Override 
    public void applyPropertyChange(PropertyChangeEvent pce, JLayer l) {
        if(pce.getPropertyName().equalsIgnoreCase("blur")){
            this.blur = (Boolean) pce.getNewValue();
            l.repaint();
        } 
    } 
 
    @Override 
    public void paint(Graphics g, JComponent comp){
        Graphics2D g2 = (Graphics2D) g;
        super.paint(g2, comp);
 
        if(this.blur){
            g2.setComposite(alpha(0.5F));
            g2.fillRect(0, 0, comp.getWidth(), comp.getHeight());
        } 
    } 
 
3
CodeRank
This code example shows how to use the following methods:setLayerEventMask
 
    @Override 
    @SuppressWarnings("rawtypes") 
    public void uninstallUI(JComponent c) {
        super.uninstallUI(c);
        ((JLayer) c).setLayerEventMask(0);
    } 
 
    /** 
     * Sets the "dirty bit". If {@code isDirty} is {@code true}, then the 
     * {@code AbstractLayerUI} is considered dirty and it triggers the 
     * repainting of the {@link JLayer}s this {@code AbstractLayerUI} it is set 
     * to. 
     * 
     * @param isDirty whether this {@code AbstractLayerUI} is dirty or not. 
     */ 
    void setDirty(boolean isDirty) {
        boolean oldDirty = this.isDirty;
        this.isDirty = isDirty;
        firePropertyChange("dirty", oldDirty, isDirty);
3
CodeRank
This code example shows how to use the following methods:setLayerEventMask
			super.uninstallUI(c); 
			// reset the layer event mask 
			if (!(c instanceof JLayer)) { 
				return; 
			} 
			((JLayer) c).setLayerEventMask(0); 
		} 
 
		// Catch and gab about MouseMotion events 
		@Override 
		public void eventDispatched(AWTEvent e, JLayer<? extends JComponent> l) { 
			// System.out.println("Event: " + e); 
		} 
	}; 
 
	public static void main(String[] args) throws Exception {
		SwingUtilities.invokeAndWait(new Runnable() {
			public void run() { 
				final JFrame frame = new JFrame();
				frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
3
CodeRank
This code example shows how to use the following methods:getView
                
        @Override 
        protected void paintLayer(final Graphics2D graphics, final JLayer<? extends JComponent> layer) {
            super.paintLayer(graphics, layer);
 
            if (layer.getView().getClientProperty(VALIDATION_PROPERTY) != null) {
 
                final JComponent view = layer.getView();
 
                String toolTip = (String) view.getClientProperty(VALIDATION_PROPERTY);
                view.setToolTipText(toolTip);
                errorIcon.paintIcon(view, graphics, 0, 0);
            } 
        } 
 
        @Override 
        protected void processMouseEvent(final MouseEvent e, final JLayer<? extends JComponent> layer) {
            if (e.getID() == MouseEvent.MOUSE_CLICKED) {
                layer.getView().putClientProperty(VALIDATION_PROPERTY, null);
            } 
3
CodeRank
See Code Examples for Java 8 JLayer Methods: