Package com.jidesoft.swing

Examples of com.jidesoft.swing.DefaultOverlayable


  public static DefaultOverlayable createOverlayTextArea(final JTextArea area, String mess) {
    // build
    JLabel overlayLabel = new JLabel(mess);
    overlayLabel.setForeground(SystemColor.textInactiveText);

    final DefaultOverlayable overlayTextArea = new DefaultOverlayable(new JScrollPane(area));
    area.getDocument().addDocumentListener(new DocumentListener() {
      @Override
      public void insertUpdate(DocumentEvent e) {
        if (area.getDocument().getLength() > 0) {
          overlayTextArea.setOverlayVisible(false);
        }
      }

      @Override
      public void removeUpdate(DocumentEvent e) {
        if (area.getDocument().getLength() == 0) {
          overlayTextArea.setOverlayVisible(true);
        }
      }

      @Override
      public void changedUpdate(DocumentEvent e) {
      }
    });
    area.addFocusListener(new FocusListener() {
      @Override
      public void focusGained(FocusEvent e) {
        overlayTextArea.setOverlayVisible(false);
      }

      @Override
      public void focusLost(FocusEvent e) {
        overlayTextArea.setOverlayVisible(area.getDocument().getLength() == 0);
      }
    });
    overlayTextArea.addOverlayComponent(overlayLabel);

    // has text?
    overlayTextArea.setOverlayVisible(area.getDocument().getLength() == 0);

    // get it
    return overlayTextArea;
  }
View Full Code Here


    // build
    overlayLabel = new JLabel(getOverlayLabelText());
    overlayLabel.setForeground(SystemColor.textInactiveText);

    // build overlayable
    overlay = new DefaultOverlayable(new JScrollPane(list));
    overlay.addOverlayComponent(overlayLabel);
    checkOverlay();

    // which can be selected?
    add(BorderLayout.CENTER, overlay);
View Full Code Here

      }
    });
    }

    private DefaultOverlayable createOverlayableTable() {
      return new DefaultOverlayable(scrollpaneWrapper) {
      private static final long serialVersionUID = 1L;

      {
                addOverlayComponent(createRefreshNonExistingLocationLabel());
          }
View Full Code Here

TOP

Related Classes of com.jidesoft.swing.DefaultOverlayable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.