Example usage for javax.swing JLabel add

List of usage examples for javax.swing JLabel add

Introduction

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

Prototype

public Component add(String name, Component comp) 

Source Link

Document

Adds the specified component to this container.

Usage

From source file:pl.otros.logview.gui.LogViewPanel.java

private void addFiltersGUIsToPanel(JPanel filtersPanel) {
    filtersPanel.setLayout(new MigLayout("", "[grow]", ""));

    Collection<LogFilter> loadedFilters = logFiltersContainer.getElements();

    // Reload filters, every instance of filter is connected to listeners, data table etc.
    filtersList = new ArrayList<LogFilter>();
    for (LogFilter logFilter : loadedFilters) {
        try {// w w  w.j a va  2s .c  o m
            LogFilter filter = logFilter.getClass().newInstance();
            filtersList.add(filter);
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "Can't initialize filter: " + logFilter.getClass(), e);
        }

    }
    JLabel filtersLabel = new JLabel("Filters:");
    filtersLabel.setMinimumSize(new Dimension(200, 16));
    filtersLabel.setPreferredSize(new Dimension(200, 16));
    filtersLabel.setIcon(Icons.FILTER);
    Font f = filtersLabel.getFont().deriveFont(Font.BOLD);
    filtersLabel.setFont(f);
    filtersPanel.add(filtersLabel, "wrap, growx, span");
    LogFilterValueChangeListener listener = new LogFilterValueChangeListener(table, sorter, filtersList,
            statusObserver);
    for (LogFilter filter : filtersList) {
        filter.init(new Properties(), dataTableModel);
        FilterPanel filterPanel = new FilterPanel(filter, listener);
        filtersPanel.add(filterPanel, "wrap, growx");
        if (filter instanceof ThreadFilter) {
            ThreadFilter threadFilter = (ThreadFilter) filter;
            focusOnThisThreadAction = new FocusOnThisThreadAction(threadFilter, filterPanel.getEnableCheckBox(),
                    otrosApplication);
        } else if (filter instanceof TimeFilter) {
            focusOnEventsAfter = new FocusOnEventsAfter((TimeFilter) filter, filterPanel.getEnableCheckBox(),
                    otrosApplication);
            focusOnEventsBefore = new FocusOnEventsBefore((TimeFilter) filter, filterPanel.getEnableCheckBox(),
                    otrosApplication);
        } else if (filter instanceof ClassFilter) {
            focusOnSelectedClassesAction = new FocusOnSelectedClassesAction((ClassFilter) filter,
                    filterPanel.getEnableCheckBox(), otrosApplication);
            ignoreSelectedEventsClasses = new IgnoreSelectedEventsClasses((ClassFilter) filter,
                    filterPanel.getEnableCheckBox(), otrosApplication);
        } else if (filter instanceof LoggerNameFilter) {
            focusOnSelectedLoggerNameAction = new FocusOnSelectedLoggerNameAction((LoggerNameFilter) filter,
                    filterPanel.getEnableCheckBox(), otrosApplication);
        } else if (filter instanceof CallHierarchyLogFilter) {
            showCallHierarchyAction = new ShowCallHierarchyAction((CallHierarchyLogFilter) filter,
                    filterPanel.getEnableCheckBox(), otrosApplication);
        } else if (filter instanceof PropertyFilter) {
            propertyFilter = (PropertyFilter) filter;
            propertyFilterPanel = filterPanel;

        }
    }
    filtersLabel.add(logsMarkersPanel, "span, grow");
}