Example usage for java.awt CardLayout CardLayout

List of usage examples for java.awt CardLayout CardLayout

Introduction

In this page you can find the example usage for java.awt CardLayout CardLayout.

Prototype

public CardLayout() 

Source Link

Document

Creates a new card layout with gaps of size zero.

Usage

From source file:be.vds.jtbdive.client.view.core.stats.StatPanel.java

private JComponent createCentralPanel() {
    cardLayout = new CardLayout();
    centralPanel = new DetailPanel(cardLayout);

    centralPanel.add(createDefaultPanel(), "default");
    centralPanel.add(createGraphPanel(), "graph");
    return centralPanel;
}

From source file:org.ut.biolab.medsavant.client.view.app.builtin.settings.ServerLogPage.java

@Override
public JPanel getView() {
    if (view == null) {
        view = new JPanel();
        view.setLayout(new BorderLayout());

        menuPanel = new JPanel();
        ViewUtil.applyHorizontalBoxLayout(menuPanel);

        listPanel = new JPanel();
        listPanel.setLayout(new CardLayout());

        listPanel.add(getWaitPanel(), CARDNAME_WAIT);
        listPanel.add(getClientCard(), CARDNAME_SERVER);

        view.add(menuPanel, BorderLayout.NORTH);
        view.add(listPanel, BorderLayout.CENTER);

        changeToCard(CARDNAME_SERVER);/*from w w w.ja v a2 s  . co  m*/

        JButton refreshButton = new JButton("Refresh");
        refreshButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                refreshCurrentCard();
            }
        });

        menuPanel.add(Box.createHorizontalGlue());
        menuPanel.add(refreshButton);
        menuPanel.add(Box.createHorizontalGlue());
    }
    return view;
}

From source file:net.sf.jabref.gui.preftabs.PreferencesDialog.java

public PreferencesDialog(JabRefFrame parent) {
    super(parent, Localization.lang("JabRef preferences"), false);
    JabRefPreferences prefs = JabRefPreferences.getInstance();
    frame = parent;//from ww  w .j  a va  2  s .  c o m

    main = new JPanel();
    JPanel mainPanel = new JPanel();
    JPanel lower = new JPanel();

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(mainPanel, BorderLayout.CENTER);
    getContentPane().add(lower, BorderLayout.SOUTH);

    final CardLayout cardLayout = new CardLayout();
    main.setLayout(cardLayout);

    List<PrefsTab> tabs = new ArrayList<>();
    tabs.add(new GeneralTab(prefs));
    tabs.add(new NetworkTab(prefs));
    tabs.add(new FileTab(frame, prefs));
    tabs.add(new FileSortTab(prefs));
    tabs.add(new EntryEditorPrefsTab(frame, prefs));
    tabs.add(new GroupsPrefsTab(prefs));
    tabs.add(new AppearancePrefsTab(prefs));
    tabs.add(new ExternalTab(frame, this, prefs));
    tabs.add(new TablePrefsTab(prefs));
    tabs.add(new TableColumnsTab(prefs, parent));
    tabs.add(new LabelPatternPrefTab(prefs, parent.getCurrentBasePanel()));
    tabs.add(new PreviewPrefsTab(prefs));
    tabs.add(new NameFormatterTab(prefs));
    tabs.add(new ImportSettingsTab(prefs));
    tabs.add(new XmpPrefsTab(prefs));
    tabs.add(new AdvancedTab(prefs));

    // add all tabs
    tabs.forEach(tab -> main.add((Component) tab, tab.getTabName()));

    mainPanel.setBorder(BorderFactory.createEtchedBorder());

    String[] tabNames = tabs.stream().map(PrefsTab::getTabName).toArray(String[]::new);
    JList<String> chooser = new JList<>(tabNames);
    chooser.setBorder(BorderFactory.createEtchedBorder());
    // Set a prototype value to control the width of the list:
    chooser.setPrototypeCellValue("This should be wide enough");
    chooser.setSelectedIndex(0);
    chooser.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    // Add the selection listener that will show the correct panel when
    // selection changes:
    chooser.addListSelectionListener(e -> {
        if (e.getValueIsAdjusting()) {
            return;
        }
        String o = chooser.getSelectedValue();
        cardLayout.show(main, o);
    });

    JPanel buttons = new JPanel();
    buttons.setLayout(new GridLayout(4, 1));
    buttons.add(importPreferences, 0);
    buttons.add(exportPreferences, 1);
    buttons.add(showPreferences, 2);
    buttons.add(resetPreferences, 3);

    JPanel westPanel = new JPanel();
    westPanel.setLayout(new BorderLayout());
    westPanel.add(chooser, BorderLayout.CENTER);
    westPanel.add(buttons, BorderLayout.SOUTH);
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(main, BorderLayout.CENTER);
    mainPanel.add(westPanel, BorderLayout.WEST);

    JButton ok = new JButton(Localization.lang("OK"));
    JButton cancel = new JButton(Localization.lang("Cancel"));
    ok.addActionListener(new OkAction());
    CancelAction cancelAction = new CancelAction();
    cancel.addActionListener(cancelAction);
    lower.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    ButtonBarBuilder buttonBarBuilder = new ButtonBarBuilder(lower);
    buttonBarBuilder.addGlue();
    buttonBarBuilder.addButton(ok);
    buttonBarBuilder.addButton(cancel);
    buttonBarBuilder.addGlue();

    // Key bindings:
    KeyBinder.bindCloseDialogKeyToCancelAction(this.getRootPane(), cancelAction);

    // Import and export actions:
    exportPreferences.setToolTipText(Localization.lang("Export preferences to file"));
    exportPreferences.addActionListener(e -> {
        String filename = FileDialogs.getNewFile(frame, new File(System.getProperty("user.home")),
                Collections.singletonList(".xml"), JFileChooser.SAVE_DIALOG, false);
        if (filename == null) {
            return;
        }
        File file = new File(filename);
        if (!file.exists() || (JOptionPane.showConfirmDialog(PreferencesDialog.this,
                Localization.lang("'%0' exists. Overwrite file?", file.getName()),
                Localization.lang("Export preferences"),
                JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION)) {

            try {
                prefs.exportPreferences(filename);
            } catch (JabRefException ex) {
                LOGGER.warn(ex.getMessage(), ex);
                JOptionPane.showMessageDialog(PreferencesDialog.this, ex.getLocalizedMessage(),
                        Localization.lang("Export preferences"), JOptionPane.ERROR_MESSAGE);
            }
        }
    });

    importPreferences.setToolTipText(Localization.lang("Import preferences from file"));
    importPreferences.addActionListener(e -> {
        String filename = FileDialogs.getNewFile(frame, new File(System.getProperty("user.home")),
                Collections.singletonList(".xml"), JFileChooser.OPEN_DIALOG, false);
        if (filename != null) {
            try {
                prefs.importPreferences(filename);
                updateAfterPreferenceChanges();
                JOptionPane.showMessageDialog(PreferencesDialog.this,
                        Localization.lang("You must restart JabRef for this to come into effect."),
                        Localization.lang("Import preferences"), JOptionPane.WARNING_MESSAGE);
            } catch (JabRefException ex) {
                LOGGER.warn(ex.getMessage(), ex);
                JOptionPane.showMessageDialog(PreferencesDialog.this, ex.getLocalizedMessage(),
                        Localization.lang("Import preferences"), JOptionPane.ERROR_MESSAGE);
            }
        }
    });

    showPreferences.addActionListener(
            e -> new PreferencesFilterDialog(new JabRefPreferencesFilter(Globals.prefs), frame)
                    .setVisible(true));
    resetPreferences.addActionListener(e -> {
        if (JOptionPane.showConfirmDialog(PreferencesDialog.this,
                Localization.lang("Are you sure you want to reset all settings to default values?"),
                Localization.lang("Reset preferences"),
                JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
            try {
                prefs.clear();
                JOptionPane.showMessageDialog(PreferencesDialog.this,
                        Localization.lang("You must restart JabRef for this to come into effect."),
                        Localization.lang("Reset preferences"), JOptionPane.WARNING_MESSAGE);
            } catch (BackingStoreException ex) {
                LOGGER.warn(ex.getMessage(), ex);
                JOptionPane.showMessageDialog(PreferencesDialog.this, ex.getLocalizedMessage(),
                        Localization.lang("Reset preferences"), JOptionPane.ERROR_MESSAGE);
            }
            updateAfterPreferenceChanges();
        }
    });

    setValues();

    pack();

}

From source file:org.zaproxy.zap.extension.portscan.PortScanPanel.java

/**
 * This method initializes this/*from w  ww.  j a  va  2 s . c  om*/
 * 
 * @return void
 */
private void initialize() {
    this.setLayout(new CardLayout());
    this.setSize(474, 251);
    this.setName(Constant.messages.getString("ports.panel.title"));

    this.setIcon(new ImageIcon(getClass().getResource("/resource/icons/page_white_text.png"))); // 'picture list' icon
    this.add(getPanelCommand(), getPanelCommand().getName());
}

From source file:org.ut.biolab.medsavant.client.view.list.ListView.java

public ListView(String page, DetailedListModel model, DetailedView view, DetailedListEditor editor) {
    pageName = page;//w  w w.  j a  v  a  2 s. c  o  m
    detailedModel = model;
    detailedView = view;
    detailedEditor = editor;

    setLayout(new CardLayout());

    wp = new WaitPanel("Getting list");
    add(wp, CARD_WAIT);

    showCard = new JPanel();
    add(showCard, CARD_SHOW);

    JPanel errorPanel = new JPanel();
    errorPanel.setLayout(new BorderLayout());
    errorMessage = new JLabel("An error occurred:");
    errorPanel.add(errorMessage, BorderLayout.NORTH);

    add(errorPanel, CARD_ERROR);

    controlBar = new SourceListControlBar();

    if (detailedEditor.doesImplementAdding()) {

        controlBar.createAndAddButton(MacIcons.PLUS, new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                detailedEditor.addItems();
                if (detailedEditor.doesRefreshAfterAdding()) {
                    refreshList();
                }
            }

        });
    }

    if (detailedEditor.doesImplementImporting()) {

        controlBar.createAndAddButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.IMPORT),
                new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        detailedEditor.importItems();
                        if (detailedEditor.doesImplementImporting()) {
                            refreshList();
                        }
                    }

                });
    }

    if (detailedEditor.doesImplementExporting()) {

        controlBar.createAndAddButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.EXPORT),
                new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        detailedEditor.exportItems();
                        refreshList();
                    }

                });
    }

    if (detailedEditor.doesImplementDeleting()) {

        controlBar.createAndAddButton(MacIcons.MINUS, new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                detailedEditor.deleteItems(getSelectedRows());
                // In some cases, such as removing/publishing variants, the deleteItems() method may have logged us out.

                if (detailedEditor.doesRefreshAfterDeleting()) {
                    refreshList();
                }
            }

        });
    }

    if (detailedEditor.doesImplementEditing()) {

        controlBar.createAndAddButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.GEAR),
                new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        if (getSelectedRows().size() > 0) {
                            detailedEditor.editItem(getSelectedRows().get(0));
                            if (detailedEditor.doesRefreshAfterEditing()) {
                                refreshList();
                            }
                        } else {
                            DialogUtils.displayMessage("Please choose one item to edit.");
                        }
                    }

                });
    }

    // Only for SavedFiltersPanel
    if (detailedEditor.doesImplementLoading()) {

        controlBar.createAndAddButton(
                IconFactory.getInstance().getIcon(IconFactory.StandardIcon.LOAD_ON_TOOLBAR),
                new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        detailedEditor.loadItems(getSelectedRows());
                    }

                });

    }

    showWaitCard();
    fetchList();
}

From source file:org.ut.biolab.medsavant.client.view.manage.ServerLogPage.java

@Override
public JPanel getView() {
    if (view == null) {
        view = new JPanel();
        view.setLayout(new BorderLayout());

        menuPanel = new JPanel();
        ViewUtil.applyHorizontalBoxLayout(menuPanel);

        ButtonGroup bg = new ButtonGroup();

        JRadioButton b1 = new JRadioButton("Client");
        //JRadioButton b2 = new JRadioButton("Server");
        JRadioButton b3 = new JRadioButton("Annotations");

        bg.add(b1);/* w  w  w  .j av a2  s  .co  m*/
        //bg.add(b2);
        bg.add(b3);

        listPanel = new JPanel();
        listPanel.setLayout(new CardLayout());

        listPanel.add(getWaitPanel(), CARDNAME_WAIT);
        listPanel.add(getClientCard(), CARDNAME_CLIENT);
        //listPanel.add(getServerCard(), CARDNAME_SERVER);
        listPanel.add(getAnnotationCard(), CARDNAME_ANNOTATION);

        view.add(menuPanel, BorderLayout.NORTH);
        view.add(listPanel, BorderLayout.CENTER);

        b1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                changeToCard(CARDNAME_CLIENT);

            }
        });
        /*b2.addActionListener(new ActionListener() {
                
        public void actionPerformed(ActionEvent ae) {
            changeToCard(CARDNAME_SERVER);
        }
        });*/
        b3.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                changeToCard(CARDNAME_ANNOTATION);
            }
        });

        b3.setSelected(true);
        this.changeToCard(CARDNAME_ANNOTATION);

        JButton refreshButton = new JButton("Refresh");
        refreshButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                refreshCurrentCard();
            }
        });

        menuPanel.add(Box.createHorizontalGlue());
        menuPanel.add(b3);
        menuPanel.add(b1);
        //menuPanel.add(b2);
        menuPanel.add(refreshButton);
        menuPanel.add(Box.createHorizontalGlue());
    }
    return view;
}

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

public LogViewPanelWrapper(String name, Stoppable stoppable, TableColumns[] visibleColumns,
        LogDataTableModel logDataTableModel, DataConfiguration configuration,
        OtrosApplication otrosApplication) {
    this.name = name;
    this.configuration = configuration;
    this.otrosApplication = otrosApplication;
    this.addHierarchyListener(new HierarchyListener() {

        @Override//from www  .j a  v  a2  s .c  om
        public void hierarchyChanged(HierarchyEvent e) {
            if (e.getChangeFlags() == 1 && e.getChanged().getParent() == null) {
                LOGGER.info("Log view panel is removed from view. Clearing data table for GC");
                dataTableModel.clear();
            }
        }
    });
    if (visibleColumns == null) {
        visibleColumns = TableColumns.ALL_WITHOUT_LOG_SOURCE;
    }

    fillDefaultConfiguration();

    stopableReference = new SoftReference<Stoppable>(stoppable);
    // this.statusObserver = statusObserver;
    dataTableModel = logDataTableModel == null ? new LogDataTableModel() : logDataTableModel;
    logViewPanel = new LogViewPanel(dataTableModel, visibleColumns, otrosApplication);

    cardLayout = new CardLayout();
    JPanel panelLoading = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(10, 10, 10, 10);
    c.anchor = GridBagConstraints.PAGE_START;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    c.ipadx = 1;
    c.ipady = 1;
    c.weightx = 10;
    c.weighty = 1;

    JLabel label = new JLabel("Loading file " + name);
    panelLoading.add(label, c);
    c.gridy++;
    c.weighty = 3;
    loadingProgressBar = new JProgressBar();
    loadingProgressBar.setIndeterminate(false);
    loadingProgressBar.setStringPainted(true);
    loadingProgressBar.setString("Connecting...");
    panelLoading.add(loadingProgressBar, c);
    statsTable = new JTable();

    c.gridy++;
    c.weighty = 1;
    c.weightx = 2;
    panelLoading.add(statsTable, c);
    c.gridy++;
    c.weightx = 1;
    stopButton = new JButton("Stop, you have imported already enough!");
    stopButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Stoppable stoppable = stopableReference.get();
            if (stoppable != null) {
                stoppable.stop();
            }
        }
    });
    panelLoading.add(stopButton, c);

    setLayout(cardLayout);
    add(panelLoading, CARD_LAYOUT_LOADING);
    add(logViewPanel, CARD_LAYOUT_CONTENT);
    cardLayout.show(this, CARD_LAYOUT_LOADING);

}

From source file:pl.otros.logview.gui.message.editor.MessageColorizerBrowser.java

public MessageColorizerBrowser(OtrosApplication otrosApplication) {
    super(new BorderLayout());
    this.container = otrosApplication.getAllPluginables().getMessageColorizers();
    this.otrosApplication = otrosApplication;

    toolBar = new JToolBar();
    editor = new MessageColorizerEditor(container, otrosApplication.getStatusObserver());
    JLabel noEditable = new JLabel("Selected MessageColorizer is not editable.", SwingConstants.CENTER);
    JLabel nothingSelected = new JLabel("Nothing selected", SwingConstants.CENTER);

    listModel = new PluginableElementListModel<MessageColorizer>(container);
    jList = new JList(listModel);
    jList.setCellRenderer(new PluginableElementNameListRenderer());
    cardLayout = new CardLayout();
    contentPanel = new JPanel(cardLayout);
    contentPanel.add(editor, CARD_LAYOUT_EDITOR);
    contentPanel.add(noEditable, CARD_LAYOUT_NOT_EDITABLE);
    contentPanel.add(nothingSelected, CARD_LAYOUT_NO_SELECTED);
    cardLayout.show(contentPanel, CARD_LAYOUT_NOT_EDITABLE);
    JSplitPane mainSplitPane = new JSplitPane(SwingConstants.VERTICAL, new JScrollPane(jList), contentPanel);
    mainSplitPane.setDividerLocation(220);

    jList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override//from   ww  w. jav  a 2s . co m
        public void valueChanged(ListSelectionEvent e) {
            showSelected();
            enableDisableButtonsForSelectedColorizer();
        }

    });

    jList.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            int keyCode = e.getKeyCode();
            if (keyCode == KeyEvent.VK_DELETE) {
                ActionEvent actionEvent = new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, "");
                deleteAction.actionPerformed(actionEvent);
            }
        }
    });

    JButton createNew = new JButton("Create new", Icons.ADD);
    createNew.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            saveAsButton.setEnabled(false);
            createNew();
        }
    });

    saveButton = new JButton("Save and use", Icons.DISK);
    saveButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            try {
                PropertyPatternMessageColorizer mc = editor.createMessageColorizer();
                File selectedFile = null;
                String f = mc.getFile();
                if (StringUtils.isNotBlank(f)) {
                    selectedFile = new File(mc.getFile());
                } else {
                    int response = chooser.showSaveDialog(MessageColorizerBrowser.this);
                    if (response != JFileChooser.APPROVE_OPTION) {
                        return;
                    }
                    selectedFile = chooser.getSelectedFile();
                    if (!selectedFile.getName().endsWith(".pattern")) {
                        selectedFile = new File(selectedFile.getParentFile(),
                                selectedFile.getName() + ".pattern");
                    }
                }
                removeMessageColorizerWithNullFile();
                applyMessageColorizer(selectedFile);
                saveMessageColorizer(selectedFile);
                jList.setSelectedValue(mc, true);
            } catch (ConfigurationException e1) {
                String errorMessage = String.format("Can't save message colorizer: %s", e1.getMessage());
                LOGGER.severe(errorMessage);
                MessageColorizerBrowser.this.otrosApplication.getStatusObserver().updateStatus(errorMessage,
                        StatusObserver.LEVEL_ERROR);
            }
        }
    });

    saveAsButton = new JButton("Save as", Icons.DISK_PLUS);
    saveAsButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                int response = chooser.showSaveDialog(MessageColorizerBrowser.this);
                if (response != JFileChooser.APPROVE_OPTION) {
                    return;
                }
                File selectedFile = chooser.getSelectedFile();
                selectedFile = chooser.getSelectedFile();
                if (!selectedFile.getName().endsWith(".pattern")) {
                    selectedFile = new File(selectedFile.getParentFile(), selectedFile.getName() + ".pattern");
                }
                removeMessageColorizerWithNullFile();
                applyMessageColorizer(selectedFile);
                saveMessageColorizer(selectedFile);
                jList.setSelectedValue(editor.createMessageColorizer(), true);
            } catch (ConfigurationException e1) {
                String errorMessage = String.format("Can't save message colorizer: %s", e1.getMessage());
                LOGGER.severe(errorMessage);
                MessageColorizerBrowser.this.otrosApplication.getStatusObserver().updateStatus(errorMessage,
                        StatusObserver.LEVEL_ERROR);
            }
        }
    });

    useButton = new JButton("Use without saving");
    useButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            try {
                removeMessageColorizerWithNullFile();
                applyMessageColorizer(File.createTempFile("messageColorizer", "pattern"));
            } catch (Exception e) {
                LOGGER.severe("Cannot create message colorizer: " + e.getMessage());
            }

        }
    });

    deleteAction = new DeleteSelected(otrosApplication);
    deleteButton = new JButton(deleteAction);

    toolBar.setFloatable(false);
    toolBar.add(createNew);
    toolBar.add(saveButton);
    toolBar.add(saveAsButton);
    toolBar.add(useButton);
    toolBar.add(deleteButton);
    enableDisableButtonsForSelectedColorizer();
    initFileChooser();
    this.add(mainSplitPane);
    this.add(toolBar, BorderLayout.SOUTH);
}

From source file:org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentViewsManager.java

public HttpPanelComponentViewsManager(String configurationKey) {
    enabledViews = new ArrayList<>();
    viewItems = new HashMap<>();
    views = new HashMap<>();
    defaultViewsSelectors = new ArrayList<>();

    isEditable = false;// w w  w.  jav  a  2s. c o m
    this.configurationKey = configurationKey;
    this.viewsConfigurationKey = "";

    changingComboBoxLocker = new Object();
    changingComboBox = false;

    savedSelectedViewName = null;

    comboBoxModel = new SortedComboBoxModel<>();
    comboBoxSelectView = new JComboBox<>(comboBoxModel);
    comboBoxSelectView.addItemListener(this);

    panelViews = new JPanel(new CardLayout());
}

From source file:pl.otros.logview.api.gui.LogViewPanelWrapper.java

public LogViewPanelWrapper(final String name, final Stoppable stoppable, final TableColumns[] visibleColumns,
        final LogDataTableModel logDataTableModel, final DataConfiguration configuration,
        final OtrosApplication otrosApplication) {

    this.name = name;
    this.configuration = configuration;
    this.otrosApplication = otrosApplication;
    logLoader = otrosApplication.getLogLoader();
    this.addHierarchyListener(e -> {
        if (e.getChangeFlags() == 1 && e.getChanged().getParent() == null) {
            closing();//from   www.  j av a2 s. c om
        }
    });
    final TableColumns[] columns = (visibleColumns == null) ? TableColumns.ALL_WITHOUT_LOG_SOURCE
            : visibleColumns;

    fillDefaultConfiguration();

    SoftReference<Stoppable> stoppableReference = new SoftReference<>(stoppable);
    // this.statusObserver = statusObserver;
    dataTableModel = logDataTableModel == null ? new LogDataTableModel() : logDataTableModel;
    logViewPanel = new LogViewPanel(dataTableModel, columns, otrosApplication);

    cardLayout = new CardLayout();
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(10, 10, 10, 10);
    c.anchor = GridBagConstraints.PAGE_START;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    c.ipadx = 1;
    c.ipady = 1;
    c.weightx = 10;
    c.weighty = 1;

    c.gridy++;
    c.weighty = 3;
    loadingProgressBar = new JProgressBar();
    loadingProgressBar.setIndeterminate(false);
    loadingProgressBar.setStringPainted(true);
    loadingProgressBar.setString("Connecting...");

    c.gridy++;
    c.weighty = 1;
    c.weightx = 2;
    c.gridy++;
    c.weightx = 1;
    JButton stopButton = new JButton("Stop, you have imported already enough!");
    stopButton.addActionListener(e -> {
        Stoppable stoppable1 = stoppableReference.get();
        if (stoppable1 != null) {
            stoppable1.stop();
        }
    });

    setLayout(cardLayout);
    add(logViewPanel, CARD_LAYOUT_CONTENT);
    cardLayout.show(this, CARD_LAYOUT_LOADING);

}