Example usage for javax.swing JLabel setVisible

List of usage examples for javax.swing JLabel setVisible

Introduction

In this page you can find the example usage for javax.swing JLabel setVisible.

Prototype

@BeanProperty(hidden = true, visualUpdate = true)
public void setVisible(boolean aFlag) 

Source Link

Document

Makes the component visible or invisible.

Usage

From source file:unikn.dbis.univis.visualization.pivottable.VPivotTable.java

public VPivotTable() {
    setBorder(new EtchedBorder());
    setPreferredSize(new Dimension(1000, 700));
    setLayout(new BorderLayout());
    setBackground(Color.white);//from   w  w  w . j  av  a 2 s  .co  m

    /* *** First Row *** */
    JLabel jlabelMeasure = new JLabel("Measure:");
    jlabelMeasure.setVisible(false);
    JLabel jlabelX = new JLabel("X-Axis Elements:");
    JLabel forVerticalSpace = new JLabel(" ");
    panelFirstRow = new JPanel(new VTableLayout(3, 2, 3, 3));

    dropAreaMeasure = new JTextArea(textInMeasureBox);
    dropAreaMeasure.setToolTipText(textInMeasureBox);
    dropAreaMeasure.setForeground(Color.LIGHT_GRAY);
    dropAreaMeasure.setEditable(false);
    dropAreaMeasure.setPreferredSize(new Dimension(100, 20));
    dropAreaMeasure.setBorder(BorderFactory.createEtchedBorder(Color.WHITE, Color.LIGHT_GRAY));
    dropAreaMeasure.setVisible(false);

    dropAreaX = new JTextArea(textInXYBox);
    dropAreaX.setToolTipText(textInXYBox);
    dropAreaX.setForeground(Color.LIGHT_GRAY);
    dropAreaX.setEditable(false);
    dropAreaX.setPreferredSize(new Dimension(400, 20));
    dropAreaX.setBorder(BorderFactory.createEtchedBorder(Color.WHITE, Color.LIGHT_GRAY));

    panelFirstRow.add(jlabelMeasure);
    panelFirstRow.add(jlabelX);
    panelFirstRow.add(dropAreaMeasure);
    panelFirstRow.add(dropAreaX);
    panelFirstRow.add(forVerticalSpace);
    add(panelFirstRow, BorderLayout.NORTH);

    /* *** Second Row *** */
    JLabel jlabelY1 = new JLabel("Y-Axis");
    JLabel jlabelY2 = new JLabel("Elements:");
    panelSecondRow = new JPanel(new VTableLayout(1, 2, 3, 3));

    dropAreaY = new JTextArea(textInXYBox);
    dropAreaY.setToolTipText(textInXYBox);
    dropAreaY.setForeground(Color.LIGHT_GRAY);
    dropAreaY.setEditable(false);
    dropAreaY.setLineWrap(true);
    dropAreaY.setWrapStyleWord(true);
    dropAreaY.setPreferredSize(new Dimension(100, 400));
    dropAreaY.setBorder(BorderFactory.createEtchedBorder(Color.WHITE, Color.LIGHT_GRAY));

    JPanel panelY = new JPanel(new VTableLayout(3, 1, 1, 1));
    panelY.add(jlabelY1);
    panelY.add(jlabelY2);
    panelY.add(dropAreaY);
    panelSecondRow.add(panelY);
    add(panelSecondRow, BorderLayout.WEST);

    new DropTarget(dropAreaX, DnDConstants.ACTION_COPY_OR_MOVE, this);
    new DropTarget(dropAreaY, DnDConstants.ACTION_COPY_OR_MOVE, this);
}

From source file:view.ImagePanel.java

public void setDocumentAndComponents(final MainWindow mainWindow, JScrollPane parent, Document document,
        final JButton btnBackward, final JButton btnForward) {
    this.mainWindow = mainWindow;
    this.parent = parent;
    try {/*from  w w w .  j  a va2s .com*/
        this.documentLocation = document.getDocumentLocation();
        this.pdfDocument = PDDocument.load(new File(documentLocation));
        this.pdfRenderer = new PDFRenderer(pdfDocument);
        numberOfPages = pdfDocument.getPages().getCount();

        if (buf != null) {
            buf.flush();
            buf = null;
        }

        System.gc();

        Runnable r = new Runnable() {

            @Override
            public void run() {
                status = Status.RENDERING;
                ImagePanel.this.btnPageBackward = btnBackward;
                ImagePanel.this.btnPageForward = btnForward;
                ImagePanel.this.pageNumber = 0;
                ImagePanel.this.scale = 1f;
                ImagePanel.this.svList = null;
                setBorder(null);
                JLabel lblDocName = new JLabel(documentLocation);
                lblDocName.setLocation(0, 0);
                add(lblDocName);
                lblDocName.setVisible(true);
                try {
                    buf = pdfRenderer.renderImage(0, 2f, ImageType.RGB);
                    mainWindow.getWorkspacePanel().showPanelComponents();
                    status = Status.READY;
                } catch (IOException ex) {
                    return;
                }
                refreshParent();
                refreshTitle();
            }
        };

        Thread t = new Thread(r);
        t.start();

        if (pdfDocument == null) {
            mainWindow.getWorkspacePanel().setDocument(null);
            return;
        }

    } catch (IOException ex) {
        controller.Logger.getLogger().addEntry(ex);
    }
}

From source file:windows.ValidateEntity.java

public boolean validate(AbstractForm form, String[] fieldsName, String[] excludeField) {
    List<JLabel> lista = new ArrayList<>();
    Field[] fields = ReflectionUtils.getAllFields(form.getClass());
    for (Field field : fields) {
        if (JLabel.class.isAssignableFrom(field.getType())) {
            JLabel l = ReflectionUtils.runGetter(field, form);
            l.setText(null);// w w  w.  j  a  v  a  2  s  . com
            l.setVisible(false);
            lista.add(l);
        }
    }
    ValidationContex fieldError = validateGeneral(fieldsName, excludeField);
    if (fieldError == null) {
        return true;
    }
    for (JLabel label : lista) {
        if (label.getLabelFor().getName().equalsIgnoreCase(fieldError.field().getName())) {
            label.setText("<html><p>" + fieldError.message().replace("\n", "<br>") + "</p></html>");
            label.setVisible(true);
        }
    }
    return false;
}