Example usage for java.awt GridBagConstraints CENTER

List of usage examples for java.awt GridBagConstraints CENTER

Introduction

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

Prototype

int CENTER

To view the source code for java.awt GridBagConstraints CENTER.

Click Source Link

Document

Put the component in the center of its display area.

Usage

From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java

private JPanel createTickerPanel(int stentWidth) {
    // Load up the original values.
    originalShowTicker = !Boolean.FALSE.toString()
            .equals(controller.getModel().getUserPreference(ExchangeModel.TICKER_SHOW));
    originalExchange1 = controller.getModel().getUserPreference(ExchangeModel.TICKER_FIRST_ROW_EXCHANGE);
    originalCurrency1 = controller.getModel().getUserPreference(ExchangeModel.TICKER_FIRST_ROW_CURRENCY);
    // Map MtGox to Bitstamp + USD
    if (ExchangeData.MT_GOX_EXCHANGE_NAME.equalsIgnoreCase(originalExchange1)) {
        originalExchange1 = ExchangeData.BITSTAMP_EXCHANGE_NAME;
        controller.getModel().setUserPreference(ExchangeModel.TICKER_FIRST_ROW_EXCHANGE,
                ExchangeData.BITSTAMP_EXCHANGE_NAME);

        originalCurrency1 = "USD";
        controller.getModel().setUserPreference(ExchangeModel.TICKER_FIRST_ROW_CURRENCY, "USD");
    }/*w  ww. j a va2s  .  c  o  m*/
    originalShowSecondRow = Boolean.TRUE.toString()
            .equals(controller.getModel().getUserPreference(ExchangeModel.TICKER_SHOW_SECOND_ROW));
    originalExchange2 = controller.getModel().getUserPreference(ExchangeModel.TICKER_SECOND_ROW_EXCHANGE);
    originalCurrency2 = controller.getModel().getUserPreference(ExchangeModel.TICKER_SECOND_ROW_CURRENCY);
    // Map MtGox to Bitstamp
    if (ExchangeData.MT_GOX_EXCHANGE_NAME.equalsIgnoreCase(originalExchange2)) {
        originalExchange2 = ExchangeData.BITSTAMP_EXCHANGE_NAME;
        controller.getModel().setUserPreference(ExchangeModel.TICKER_SECOND_ROW_EXCHANGE,
                ExchangeData.BITSTAMP_EXCHANGE_NAME);

        originalCurrency2 = "USD";
        controller.getModel().setUserPreference(ExchangeModel.TICKER_SECOND_ROW_CURRENCY, "USD");
    }

    MultiBitTitledPanel tickerPanel = new MultiBitTitledPanel(
            controller.getLocaliser().getString("showPreferencesPanel.ticker.title2"),
            ComponentOrientation.getOrientation(controller.getLocaliser().getLocale()));
    GridBagConstraints constraints = new GridBagConstraints();

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 3;
    constraints.gridy = 3;
    constraints.weightx = 0.05;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.CENTER;
    tickerPanel.add(MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS),
            constraints);

    String showTickerText = controller.getLocaliser().getString("multiBitFrame.ticker.show.text");
    if (showTickerText != null && showTickerText.length() >= 1) {
        // Capitalise text (this is to save adding a new I18n term.
        showTickerText = Character.toUpperCase(showTickerText.charAt(0))
                + showTickerText.toLowerCase().substring(1);
    }
    showTicker = new JCheckBox(showTickerText);
    showTicker.setOpaque(false);
    showTicker.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());
    showTicker.setSelected(originalShowTicker);

    exchangeInformationLabel = new MultiBitLabel(
            controller.getLocaliser().getString("showPreferencesPanel.ticker.exchangeInformation"));
    exchangeInformationLabel.setVisible(originalShowBitcoinConvertedToFiat);

    showBitcoinConvertedToFiat = new JCheckBox(
            controller.getLocaliser().getString("showPreferencesPanel.ticker.showBitcoinConvertedToFiat"));
    showBitcoinConvertedToFiat.setOpaque(false);
    showBitcoinConvertedToFiat.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());
    showBitcoinConvertedToFiat.setSelected(originalShowBitcoinConvertedToFiat);

    showBitcoinConvertedToFiat.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            boolean selectedChange = (e.getStateChange() == ItemEvent.SELECTED);
            boolean unSelectedChange = (e.getStateChange() == ItemEvent.DESELECTED);
            if (exchangeInformationLabel != null) {
                if (selectedChange) {
                    exchangeInformationLabel.setVisible(true);
                }
                if (unSelectedChange) {
                    exchangeInformationLabel.setVisible(false);
                }
            }
        }
    });

    showExchange = new JCheckBox(controller.getLocaliser().getString("tickerTableModel.exchange"));
    showExchange.setOpaque(false);
    showExchange.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    showCurrency = new JCheckBox(controller.getLocaliser().getString("tickerTableModel.currency"));
    showCurrency.setOpaque(false);
    showCurrency.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    showLastPrice = new JCheckBox(controller.getLocaliser().getString("tickerTableModel.lastPrice"));
    showLastPrice.setOpaque(false);
    showLastPrice.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    showBid = new JCheckBox(controller.getLocaliser().getString("tickerTableModel.bid"));
    showBid.setOpaque(false);
    showBid.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    showAsk = new JCheckBox(controller.getLocaliser().getString("tickerTableModel.ask"));
    showAsk.setOpaque(false);
    showAsk.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());

    String tickerColumnsToShow = controller.getModel().getUserPreference(ExchangeModel.TICKER_COLUMNS_TO_SHOW);
    if (tickerColumnsToShow == null || tickerColumnsToShow.equals("")) {
        tickerColumnsToShow = TickerTableModel.DEFAULT_COLUMNS_TO_SHOW;
    }

    originalShowCurrency = tickerColumnsToShow.contains(TickerTableModel.TICKER_COLUMN_CURRENCY);
    showCurrency.setSelected(originalShowCurrency);

    originalShowRate = tickerColumnsToShow.contains(TickerTableModel.TICKER_COLUMN_LAST_PRICE);
    showLastPrice.setSelected(originalShowRate);

    originalShowBid = tickerColumnsToShow.contains(TickerTableModel.TICKER_COLUMN_BID);
    showBid.setSelected(originalShowBid);

    originalShowAsk = tickerColumnsToShow.contains(TickerTableModel.TICKER_COLUMN_ASK);
    showAsk.setSelected(originalShowAsk);

    originalShowExchange = tickerColumnsToShow.contains(TickerTableModel.TICKER_COLUMN_EXCHANGE);
    showExchange.setSelected(originalShowExchange);

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 1;
    constraints.gridy = 4;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 4;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(showTicker, constraints);

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 1;
    constraints.gridy = 5;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 4;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(showBitcoinConvertedToFiat, constraints);

    constraints.fill = GridBagConstraints.VERTICAL;
    constraints.gridx = 0;
    constraints.gridy = 6;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(MultiBitTitledPanel.createStent(1, 12), constraints);

    MultiBitTitledPanel.addLeftJustifiedTextAtIndent(
            controller.getLocaliser().getString("showPreferencesPanel.ticker.columnsToShow"), 7, tickerPanel);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 8;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(showExchange, constraints);

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 1;
    constraints.gridy = 9;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(showCurrency, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 10;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(showLastPrice, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 11;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(showBid, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 12;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(showAsk, constraints);

    constraints.fill = GridBagConstraints.VERTICAL;
    constraints.gridx = 1;
    constraints.gridy = 13;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(MultiBitTitledPanel.createStent(1, 13), constraints);

    MultiBitTitledPanel.addLeftJustifiedTextAtIndent(
            controller.getLocaliser().getString("showPreferencesPanel.ticker.firstRow"), 14, tickerPanel);

    MultiBitLabel exchangeLabel1 = new MultiBitLabel(
            controller.getLocaliser().getString("showPreferencesPanel.ticker.exchange"));
    exchangeLabel1.setHorizontalAlignment(JLabel.TRAILING);
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 1;
    constraints.gridy = 15;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    tickerPanel.add(exchangeLabel1, constraints);

    String exchangeToUse1;
    if (originalExchange1 == null | "".equals(originalExchange1)) {
        exchangeToUse1 = ExchangeData.DEFAULT_EXCHANGE;
    } else {
        exchangeToUse1 = originalExchange1;
    }

    String exchangeToUse2;
    if (originalExchange2 == null | "".equals(originalExchange2)) {
        exchangeToUse2 = ExchangeData.DEFAULT_EXCHANGE;
    } else {
        exchangeToUse2 = originalExchange2;
    }

    exchangeComboBox1 = new JComboBox(ExchangeData.getAvailableExchanges());
    exchangeComboBox1.setSelectedItem(exchangeToUse1);

    exchangeComboBox1.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());
    exchangeComboBox1.setOpaque(false);

    FontMetrics fontMetrics = getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont());
    int textWidth = Math.max(fontMetrics.stringWidth(ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME),
            fontMetrics.stringWidth("USD")) + COMBO_WIDTH_DELTA;
    Dimension preferredSize = new Dimension(textWidth + TICKER_COMBO_WIDTH_DELTA,
            fontMetrics.getHeight() + EXCHANGE_COMBO_HEIGHT_DELTA);
    exchangeComboBox1.setPreferredSize(preferredSize);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 1;
    constraints.gridy = 15;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 2;
    constraints.anchor = GridBagConstraints.LINE_START;
    JPanel stent = MultiBitTitledPanel.createStent(stentWidth);
    tickerPanel.add(stent, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 4;
    constraints.gridy = 15;
    constraints.weightx = 0.8;
    constraints.weighty = 0.6;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(exchangeComboBox1, constraints);

    oerMessageLabel1 = new MultiBitLabel(
            "    " + controller.getLocaliser().getString("showPreferencesPanel.getAppId.label"));
    oerMessageLabel1.setForeground(Color.GREEN.darker().darker());
    boolean showMessageLabel1 = isBrowserSupported()
            && ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME.equalsIgnoreCase(exchangeToUse1)
            && (originalOERApiCode == null || originalOERApiCode.trim().length() == 0);
    oerMessageLabel1.setVisible(showMessageLabel1);
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 5;
    constraints.gridy = 15;
    constraints.weightx = 0.8;
    constraints.weighty = 0.6;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(oerMessageLabel1, constraints);

    MultiBitLabel currencyLabel1 = new MultiBitLabel(
            controller.getLocaliser().getString("showPreferencesPanel.ticker.currency"));
    currencyLabel1.setHorizontalAlignment(JLabel.TRAILING);
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 1;
    constraints.gridy = 16;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    tickerPanel.add(currencyLabel1, constraints);

    // Make sure the exchange1 has been created and initialised the list of
    // currencies.
    if (mainFrame != null && mainFrame.getTickerTimerTask1() != null) {
        TickerTimerTask tickerTimerTask = mainFrame.getTickerTimerTask1();
        synchronized (tickerTimerTask) {
            if (tickerTimerTask.getExchange() == null) {
                tickerTimerTask.createExchangeObjects(exchangeToUse1);
            }
        }
    }

    currencyComboBox1 = new JComboBox();
    Collection<String> currenciesToUse = ExchangeData.getAvailableCurrenciesForExchange(exchangeToUse1);
    if (currenciesToUse != null) {
        for (String currency : currenciesToUse) {
            String item = currency;
            String description = CurrencyConverter.INSTANCE.getCurrencyCodeToDescriptionMap().get(currency);
            if (description != null && description.trim().length() > 0) {
                item = item + " (" + description + ")";
            }
            currencyComboBox1.addItem(item);
            if (currency.equals(originalCurrency1)) {
                currencyComboBox1.setSelectedItem(item);
            }
        }
    }

    currencyComboBox1.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());
    currencyComboBox1.setOpaque(false);
    currencyComboBox1.setPreferredSize(preferredSize);

    exchangeComboBox1.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent event) {
            if (event.getStateChange() == ItemEvent.SELECTED) {
                Object item = event.getItem();
                String exchangeShortName = item.toString();
                // Make sure the exchange1 has been created and initialised
                // the list of currencies.
                if (mainFrame != null && mainFrame.getTickerTimerTask1() != null) {
                    TickerTimerTask tickerTimerTask = mainFrame.getTickerTimerTask1();
                    synchronized (tickerTimerTask) {
                        tickerTimerTask.createExchangeObjects(exchangeShortName);
                        currencyComboBox1.removeAllItems();
                        Collection<String> currenciesToUse = ExchangeData
                                .getAvailableCurrenciesForExchange(exchangeShortName);
                        if (currenciesToUse != null) {
                            for (String currency : currenciesToUse) {
                                String loopItem = currency;
                                String description = CurrencyConverter.INSTANCE
                                        .getCurrencyCodeToDescriptionMap().get(currency);
                                if (description != null && description.trim().length() > 0) {
                                    loopItem = loopItem + " (" + description + ")";
                                }
                                currencyComboBox1.addItem(loopItem);
                            }
                        }
                    }
                }

                // Enable the OpenExchangeRates App ID if required.
                boolean showOER = ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME
                        .equalsIgnoreCase(exchangeShortName)
                        || ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME
                                .equalsIgnoreCase((String) exchangeComboBox2.getSelectedItem());
                oerStent.setVisible(showOER);
                oerApiCodeLabel.setVisible(showOER);
                oerApiCodeTextField.setVisible(showOER);
                getOerAppIdButton.setVisible(showOER);

                boolean showMessageLabel = isBrowserSupported()
                        && ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME.equalsIgnoreCase(exchangeShortName)
                        && (oerApiCodeTextField.getText() == null
                                || oerApiCodeTextField.getText().trim().length() == 0);
                oerMessageLabel1.setVisible(showMessageLabel);
            }
        }
    });

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 4;
    constraints.gridy = 16;
    constraints.weightx = 0.8;
    constraints.weighty = 0.6;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(currencyComboBox1, constraints);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 1;
    constraints.gridy = 17;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(MultiBitTitledPanel.createStent(12, 12), constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 4;
    constraints.gridy = 18;
    constraints.weightx = 0.8;
    constraints.weighty = 0.6;
    constraints.gridwidth = 2;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(MultiBitTitledPanel.createStent(fontMetrics.stringWidth(exchangeInformationLabel.getText()),
            fontMetrics.getHeight()), constraints);
    tickerPanel.add(exchangeInformationLabel, constraints);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 1;
    constraints.gridy = 19;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(MultiBitTitledPanel.createStent(12, 12), constraints);

    MultiBitTitledPanel.addLeftJustifiedTextAtIndent(
            controller.getLocaliser().getString("showPreferencesPanel.ticker.secondRow"), 20, tickerPanel);

    showSecondRowCheckBox = new JCheckBox(
            controller.getLocaliser().getString("showPreferencesPanel.ticker.showSecondRow"));
    showSecondRowCheckBox.setOpaque(false);
    showSecondRowCheckBox.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());
    showSecondRowCheckBox.addItemListener(new ChangeTickerShowSecondRowListener());

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 1;
    constraints.gridy = 21;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(showSecondRowCheckBox, constraints);

    exchangeLabel2 = new MultiBitLabel(
            controller.getLocaliser().getString("showPreferencesPanel.ticker.exchange"));
    exchangeLabel2.setHorizontalAlignment(JLabel.TRAILING);
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 1;
    constraints.gridy = 22;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    tickerPanel.add(exchangeLabel2, constraints);

    exchangeComboBox2 = new JComboBox(ExchangeData.getAvailableExchanges());
    exchangeComboBox2.setSelectedItem(exchangeToUse2);

    exchangeComboBox2.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());
    exchangeComboBox2.setOpaque(false);
    exchangeComboBox2.setPreferredSize(preferredSize);

    exchangeComboBox2.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent event) {
            if (event.getStateChange() == ItemEvent.SELECTED) {
                Object item = event.getItem();
                String exchangeShortName = item.toString();
                // Make sure the exchange2 has been created and initialised
                // the list of currencies.
                if (mainFrame != null && mainFrame.getTickerTimerTask2() != null) {
                    TickerTimerTask tickerTimerTask = mainFrame.getTickerTimerTask2();
                    synchronized (tickerTimerTask) {
                        tickerTimerTask.createExchangeObjects(exchangeShortName);
                        currencyComboBox2.removeAllItems();
                        Collection<String> currenciesToUse = ExchangeData
                                .getAvailableCurrenciesForExchange(exchangeShortName);
                        if (currenciesToUse != null) {
                            for (String currency : currenciesToUse) {
                                String loopItem = currency;
                                String description = CurrencyConverter.INSTANCE
                                        .getCurrencyCodeToDescriptionMap().get(currency);
                                if (description != null && description.trim().length() > 0) {
                                    loopItem = loopItem + " (" + description + ")";
                                }
                                currencyComboBox2.addItem(loopItem);
                            }
                        }
                    }
                }

                // Enable the OpenExchangeRates App ID if required.
                boolean showOER = ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME
                        .equalsIgnoreCase(exchangeShortName)
                        || ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME
                                .equalsIgnoreCase((String) exchangeComboBox1.getSelectedItem());
                oerStent.setVisible(showOER);
                oerApiCodeLabel.setVisible(showOER);
                oerApiCodeTextField.setVisible(showOER);
                getOerAppIdButton.setVisible(showOER);

                boolean showMessageLabel = isBrowserSupported()
                        && ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME.equalsIgnoreCase(exchangeShortName)
                        && (oerApiCodeTextField.getText() == null
                                || oerApiCodeTextField.getText().trim().length() == 0);
                oerMessageLabel2.setVisible(showMessageLabel);
            }
        }
    });

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 4;
    constraints.gridy = 22;
    constraints.weightx = 0.8;
    constraints.weighty = 0.6;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(exchangeComboBox2, constraints);

    oerMessageLabel2 = new MultiBitLabel(
            "    " + controller.getLocaliser().getString("showPreferencesPanel.getAppId.label"));
    oerMessageLabel2.setForeground(Color.GREEN.darker().darker());
    boolean showMessageLabel2 = isBrowserSupported()
            && ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME.equalsIgnoreCase(exchangeToUse2)
            && (originalOERApiCode == null || originalOERApiCode.trim().length() == 0);
    oerMessageLabel2.setVisible(showMessageLabel2);
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 5;
    constraints.gridy = 22;
    constraints.weightx = 0.8;
    constraints.weighty = 0.6;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(oerMessageLabel2, constraints);

    currencyLabel2 = new MultiBitLabel(
            controller.getLocaliser().getString("showPreferencesPanel.ticker.currency"));
    currencyLabel2.setHorizontalAlignment(JLabel.TRAILING);
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 1;
    constraints.gridy = 23;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    tickerPanel.add(currencyLabel2, constraints);

    // Make sure the exchange2 has been created and initialised the list of
    // currencies.
    if (mainFrame != null && mainFrame.getTickerTimerTask2() != null) {
        TickerTimerTask tickerTimerTask = mainFrame.getTickerTimerTask2();
        synchronized (tickerTimerTask) {
            if (tickerTimerTask.getExchange() == null) {
                tickerTimerTask.createExchangeObjects(exchangeToUse2);
            }
        }
    }
    currencyComboBox2 = new JComboBox();
    currenciesToUse = ExchangeData.getAvailableCurrenciesForExchange(exchangeToUse2);
    if (currenciesToUse != null) {
        for (String currency : currenciesToUse) {
            String loopItem = currency;
            String description = CurrencyConverter.INSTANCE.getCurrencyCodeToDescriptionMap().get(currency);
            if (description != null && description.trim().length() > 0) {
                loopItem = loopItem + " (" + description + ")";
            }
            currencyComboBox2.addItem(loopItem);
            if (currency.equals(originalCurrency2)) {
                currencyComboBox2.setSelectedItem(loopItem);
            }
        }
    }

    currencyComboBox2.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());
    currencyComboBox2.setOpaque(false);
    currencyComboBox2.setPreferredSize(preferredSize);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 4;
    constraints.gridy = 23;
    constraints.weightx = 0.8;
    constraints.weighty = 0.6;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(currencyComboBox2, constraints);

    showSecondRowCheckBox.setSelected(originalShowSecondRow);
    enableTickerSecondRow(originalShowSecondRow);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 1;
    constraints.gridy = 24;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(MultiBitTitledPanel.createStent(12, 12), constraints);

    JPanel fill1 = new JPanel();
    fill1.setOpaque(false);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 5;
    constraints.gridy = 25;
    constraints.weightx = 20;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    tickerPanel.add(fill1, constraints);

    boolean showOerSignup = ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME.equalsIgnoreCase(exchangeToUse1)
            || ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME.equalsIgnoreCase(exchangeToUse2);

    oerStent = MultiBitTitledPanel.createStent(12, 12);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 1;
    constraints.gridy = 26;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    oerStent.setVisible(showOerSignup);
    tickerPanel.add(oerStent, constraints);

    oerApiCodeLabel = new MultiBitLabel(
            controller.getLocaliser().getString("showPreferencesPanel.oerLabel.text"));
    oerApiCodeLabel.setToolTipText(HelpContentsPanel
            .createTooltipText(controller.getLocaliser().getString("showPreferencesPanel.oerLabel.tooltip")));
    oerApiCodeLabel.setVisible(showOerSignup);

    oerApiCodeTextField = new MultiBitTextField("", 25, controller);
    oerApiCodeTextField.setHorizontalAlignment(JLabel.LEADING);
    oerApiCodeTextField.setMinimumSize(new Dimension(API_CODE_FIELD_WIDTH, API_CODE_FIELD_HEIGHT));
    oerApiCodeTextField.setPreferredSize(new Dimension(API_CODE_FIELD_WIDTH, API_CODE_FIELD_HEIGHT));
    oerApiCodeTextField.setMaximumSize(new Dimension(API_CODE_FIELD_WIDTH, API_CODE_FIELD_HEIGHT));
    oerApiCodeTextField.setVisible(showOerSignup);
    oerApiCodeTextField.setText(originalOERApiCode);
    oerApiCodeTextField.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(FocusEvent arg0) {
        }

        @Override
        public void focusLost(FocusEvent arg0) {
            String apiCode = oerApiCodeTextField.getText();
            if (apiCode != null && !(WhitespaceTrimmer.trim(apiCode).length() == 0) && !apiCode.equals(
                    controller.getModel().getUserPreference(ExchangeModel.OPEN_EXCHANGE_RATES_API_CODE))) {
                // New API code.
                // Check its length
                if (!(apiCode.trim().length() == LENGTH_OF_OPEN_EXCHANGE_RATE_APP_ID)
                        && !apiCode.equals(haveShownErrorMessageForApiCode)) {
                    haveShownErrorMessageForApiCode = apiCode;
                    // Give user a message that App ID is not in the correct format.
                    JOptionPane.showMessageDialog(null,
                            new String[] { controller
                                    .getLocaliser().getString("showPreferencesPanel.oerValidationError.text1"),
                                    " ",
                                    controller.getLocaliser()
                                            .getString("showPreferencesPanel.oerValidationError.text2"),
                                    controller.getLocaliser()
                                            .getString("showPreferencesPanel.oerValidationError.text3") },
                            controller.getLocaliser().getString(
                                    "showPreferencesPanel.oerValidationError.title"),
                            JOptionPane.ERROR_MESSAGE,
                            ImageLoader.createImageIcon(ImageLoader.EXCLAMATION_MARK_ICON_FILE));
                    return;
                }
            }
            updateApiCode();
        }
    });
    oerApiCodeTextField.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            String apiCode = oerApiCodeTextField.getText();
            if (apiCode != null && !(WhitespaceTrimmer.trim(apiCode).length() == 0) && !apiCode.equals(
                    controller.getModel().getUserPreference(ExchangeModel.OPEN_EXCHANGE_RATES_API_CODE))) {
                // New API code.
                // Check its length
                if (!(apiCode.trim().length() == LENGTH_OF_OPEN_EXCHANGE_RATE_APP_ID)
                        && !apiCode.equals(haveShownErrorMessageForApiCode)) {
                    haveShownErrorMessageForApiCode = apiCode;
                    // Give user a message that App ID is not in the correct format.
                    JOptionPane.showMessageDialog(null,
                            new String[] {
                                    controller.getLocaliser()
                                            .getString("showPreferencesPanel.oerValidationError.text1"),
                                    controller.getLocaliser()
                                            .getString("showPreferencesPanel.oerValidationError.text2"),
                                    controller.getLocaliser()
                                            .getString("showPreferencesPanel.oerValidationError.text3") },
                            controller.getLocaliser().getString(
                                    "showPreferencesPanel.oerValidationError.title"),
                            JOptionPane.ERROR_MESSAGE,
                            ImageLoader.createImageIcon(ImageLoader.EXCLAMATION_MARK_ICON_FILE));
                    return;
                }
            }
            updateApiCode();
        }
    });

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 27;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    tickerPanel.add(oerApiCodeLabel, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 4;
    constraints.gridy = 27;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 2;
    constraints.anchor = GridBagConstraints.LINE_START;
    tickerPanel.add(oerApiCodeTextField, constraints);

    if (isBrowserSupported()) {
        getOerAppIdButton = new MultiBitButton(
                controller.getLocaliser().getString("showPreferencesPanel.getAppId.text"));
        getOerAppIdButton
                .setToolTipText(controller.getLocaliser().getString("showPreferencesPanel.getAppId.tooltip"));
        getOerAppIdButton.setVisible(showOerSignup);

        getOerAppIdButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                try {
                    openURI(new URI(OPEN_EXCHANGE_RATES_SIGN_UP_URI));
                } catch (URISyntaxException e) {
                    log.debug(e.getMessage());
                }
            }
        });

        constraints.fill = GridBagConstraints.NONE;
        constraints.gridx = 4;
        constraints.gridy = 28;
        constraints.weightx = 1;
        constraints.weighty = 1;
        constraints.gridwidth = 1;
        constraints.anchor = GridBagConstraints.LINE_START;
        tickerPanel.add(getOerAppIdButton, constraints);
    }

    return tickerPanel;
}

From source file:org.jets3t.apps.cockpitlite.CockpitLite.java

protected void startProgressPanel(Object operationId, String statusMessage, int maxCount,
        CancelEventTrigger cancelEventTrigger) {
    // Create new progress panel.
    final ProgressPanel progressPanel = new ProgressPanel(cockpitLiteProperties.getProperties(),
            cancelEventTrigger);//from w  ww . ja  v  a  2  s.c  o m
    progressPanel.startProgress(statusMessage, 0, maxCount);

    // Store this panel against the operation ID it tracks.
    progressPanelMap.put(operationId, progressPanel);

    // Display panel in progress notification area.
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            progressNotificationPanel.add(progressPanel,
                    new GridBagConstraints(0, progressNotificationPanel.getComponents().length, 1, 1, 1, 0,
                            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
            progressNotificationPanel.revalidate();
        }
    });
}

From source file:com.rapidminer.gui.viewer.metadata.AttributeStatisticsPanel.java

/**
 * Updates the charts.//from   w w  w  .  j  a v a 2s .  c  om
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
    for (int i = 0; i < listOfChartPanels.size(); i++) {
        JPanel panel = listOfChartPanels.get(i);
        panel.removeAll();
        final ChartPanel chartPanel = new ChartPanel(getModel().getChartOrNull(i)) {

            private static final long serialVersionUID = -6953213567063104487L;

            @Override
            public Dimension getPreferredSize() {
                return DIMENSION_CHART_PANEL_ENLARGED;
            }
        };
        chartPanel.setPopupMenu(null);
        chartPanel.setBackground(COLOR_TRANSPARENT);
        chartPanel.setOpaque(false);
        chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
        panel.add(chartPanel, BorderLayout.CENTER);

        JPanel openChartPanel = new JPanel(new GridBagLayout());
        openChartPanel.setOpaque(false);

        GridBagConstraints gbc = new GridBagConstraints();
        gbc.anchor = GridBagConstraints.CENTER;
        gbc.fill = GridBagConstraints.NONE;
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;

        JButton openChartButton = new JButton(OPEN_CHART_ACTION);
        openChartButton.setOpaque(false);
        openChartButton.setContentAreaFilled(false);
        openChartButton.setBorderPainted(false);
        openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
        openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
        openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
        openChartButton.setIcon(null);
        Font font = openChartButton.getFont();
        Map attributes = font.getAttributes();
        attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
        openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));

        openChartPanel.add(openChartButton, gbc);

        panel.add(openChartPanel, BorderLayout.SOUTH);
        panel.revalidate();
        panel.repaint();
    }
}

From source file:junk.gui.HazardSpectrumApplication.java

/**
 * Initialize the IMR Gui Bean//from   ww  w.j a va 2s  .  co  m
 */
private void initIMR_GuiBean() {

    imrGuiBean = new IMR_GuiBean(this);
    imrGuiBean.getParameterEditor(imrGuiBean.IMR_PARAM_NAME).getParameter().addParameterChangeListener(this);
    // show this gui bean the JPanel
    imrPanel.add(this.imrGuiBean, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, defaultInsets, 0, 0));
    //sets the Intensity measure for the IMR
    imrGuiBean.getSelectedIMR_Instance().setIntensityMeasure(this.SA_NAME);
    //initialise the SA Peroid values for the IMR
    this.getSA_PeriodForIMR(imrGuiBean.getSelectedIMR_Instance());
}

From source file:erigo.ctstream.CTstream.java

/**
 * Pop up the GUI//  w w  w  . jav  a 2 s.c o m
 * 
 * This method should be run in the event-dispatching thread.
 * 
 * The GUI is created in one of two modes depending on whether Shaped
 * windows are supported on the platform:
 * 
 * 1. If Shaped windows are supported then guiPanel (the container to
 *    which all other components are added) is RED and capturePanel is
 *    inset a small amount to this panel so that the RED border is seen
 *    around the outer edge.  A componentResized() method is defined
 *    which creates the hollowed out region that was capturePanel.
 * 2. If Shaped windows are not supported then guiPanel is transparent
 *    and capturePanel is translucent.  In this case, the user can't
 *    "reach through" capturePanel to interact with GUIs on the other
 *    side.
 * 
 * @param  bShapedWindowSupportedI  Does the underlying GraphicsDevice support the
 *                            PERPIXEL_TRANSPARENT translucency that is
 *                            required for Shaped windows?
 */
private void createAndShowGUI(boolean bShapedWindowSupportedI) {

    // No window decorations for translucent/transparent windows
    // (see note below)
    // JFrame.setDefaultLookAndFeelDecorated(true);

    //
    // Create GUI components
    //
    GridBagLayout framegbl = new GridBagLayout();
    guiFrame = new JFrame("CTstream");
    // To support a translucent window, the window must be undecorated
    // See notes in the class header up above about this; also see
    // http://alvinalexander.com/source-code/java/how-create-transparenttranslucent-java-jframe-mac-os-x
    guiFrame.setUndecorated(true);
    // Use MouseMotionListener to implement our own simple "window manager" for moving and resizing the window
    guiFrame.addMouseMotionListener(this);
    guiFrame.setBackground(new Color(0, 0, 0, 0));
    guiFrame.getContentPane().setBackground(new Color(0, 0, 0, 0));
    GridBagLayout gbl = new GridBagLayout();
    guiPanel = new JPanel(gbl);
    // if Shaped windows are supported, make guiPanel red;
    // otherwise make it transparent
    if (bShapedWindowSupportedI) {
        guiPanel.setBackground(Color.RED);
    } else {
        guiPanel.setBackground(new Color(0, 0, 0, 0));
    }
    guiFrame.setFont(new Font("Dialog", Font.PLAIN, 12));
    guiPanel.setFont(new Font("Dialog", Font.PLAIN, 12));
    GridBagLayout controlsgbl = new GridBagLayout();
    // *** controlsPanel contains the UI controls at the top of guiFrame
    controlsPanel = new JPanel(controlsgbl);
    controlsPanel.setBackground(new Color(211, 211, 211, 255));
    startStopButton = new JButton("Start");
    startStopButton.addActionListener(this);
    startStopButton.setBackground(Color.GREEN);
    continueButton = new JButton("Continue");
    continueButton.addActionListener(this);
    continueButton.setEnabled(false);
    screencapCheck = new JCheckBox("screen", bScreencap);
    screencapCheck.setBackground(controlsPanel.getBackground());
    screencapCheck.addActionListener(this);
    webcamCheck = new JCheckBox("camera", bWebcam);
    webcamCheck.setBackground(controlsPanel.getBackground());
    webcamCheck.addActionListener(this);
    audioCheck = new JCheckBox("audio", bAudio);
    audioCheck.setBackground(controlsPanel.getBackground());
    audioCheck.addActionListener(this);
    textCheck = new JCheckBox("text", bText);
    textCheck.setBackground(controlsPanel.getBackground());
    textCheck.addActionListener(this);
    JLabel fpsLabel = new JLabel("images/sec", SwingConstants.LEFT);
    fpsCB = new JComboBox<Double>(FPS_VALUES);
    int tempIndex = Arrays.asList(FPS_VALUES).indexOf(new Double(framesPerSec));
    fpsCB.setSelectedIndex(tempIndex);
    fpsCB.addActionListener(this);
    // The popup doesn't display over the transparent region;
    // therefore, just display a few rows to keep it within controlsPanel
    fpsCB.setMaximumRowCount(3);
    JLabel imgQualLabel = new JLabel("image qual", SwingConstants.LEFT);
    // The slider will use range 0 - 1000
    imgQualSlider = new JSlider(JSlider.HORIZONTAL, 0, 1000, (int) (imageQuality * 1000.0));
    // NOTE: The JSlider's initial width was too large, so I'd like to set its preferred size
    //       to try and constrain it some; also need to set its minimum size at the same time,
    //       or else when the user makes the GUI frame smaller, the JSlider would pop down to
    //       a really small minimum size.
    imgQualSlider.setPreferredSize(new Dimension(120, 30));
    imgQualSlider.setMinimumSize(new Dimension(120, 30));
    imgQualSlider.setBackground(controlsPanel.getBackground());
    includeMouseCursorCheck = new JCheckBox("Include mouse cursor in screen capture", bIncludeMouseCursor);
    includeMouseCursorCheck.setBackground(controlsPanel.getBackground());
    includeMouseCursorCheck.addActionListener(this);
    changeDetectCheck = new JCheckBox("Change detect", bChangeDetect);
    changeDetectCheck.setBackground(controlsPanel.getBackground());
    changeDetectCheck.addActionListener(this);
    fullScreenCheck = new JCheckBox("Full Screen", bFullScreen);
    fullScreenCheck.setBackground(controlsPanel.getBackground());
    fullScreenCheck.addActionListener(this);
    previewCheck = new JCheckBox("Preview", bPreview);
    previewCheck.setBackground(controlsPanel.getBackground());
    previewCheck.addActionListener(this);
    // Specify a small size for the text area, so that we can shrink down the UI w/o the scrollbars popping up
    textArea = new JTextArea(3, 10);
    // Add a Document listener to the JTextArea; this is how we will listen for changes to the document
    docChangeListener = new DocumentChangeListener(this);
    textArea.getDocument().addDocumentListener(docChangeListener);
    textScrollPane = new JScrollPane(textArea);
    // *** capturePanel
    capturePanel = new JPanel();
    if (!bShapedWindowSupportedI) {
        // Only make capturePanel translucent (ie, semi-transparent) if we aren't doing the Shaped window option
        capturePanel.setBackground(new Color(0, 0, 0, 16));
    } else {
        capturePanel.setBackground(new Color(0, 0, 0, 0));
    }
    capturePanel.setPreferredSize(new Dimension(500, 400));
    boolean bMacOS = false;
    String OS = System.getProperty("os.name", "generic").toLowerCase();
    if ((OS.indexOf("mac") >= 0) || (OS.indexOf("darwin") >= 0)) {
        bMacOS = true;
    }
    // Only have the CTstream UI stay on top of all other windows
    // if bStayOnTop is true (set by command line flag).  This is needed
    // for the Mac, because on that platform the user can't "reach through"
    // the capture frame to windows behind it.
    if (bStayOnTop) {
        guiFrame.setAlwaysOnTop(true);
    }

    //
    // Add components to the GUI
    //

    int row = 0;

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;

    //
    // First row: the controls panel
    //
    //  Add some extra horizontal padding around controlsPanel so the panel has some extra room
    // if we are running in web camera mode.
    gbc.insets = new Insets(0, 0, 0, 0);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 0;
    Utility.add(guiPanel, controlsPanel, gbl, gbc, 0, row, 1, 1);
    gbc.insets = new Insets(0, 0, 0, 0);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    // Add controls to the controls panel
    int panelrow = 0;
    // (i) Start/Continue buttons
    GridBagLayout panelgbl = new GridBagLayout();
    JPanel subPanel = new JPanel(panelgbl);
    GridBagConstraints panelgbc = new GridBagConstraints();
    panelgbc.anchor = GridBagConstraints.WEST;
    panelgbc.fill = GridBagConstraints.NONE;
    panelgbc.weightx = 0;
    panelgbc.weighty = 0;
    subPanel.setBackground(controlsPanel.getBackground());
    panelgbc.insets = new Insets(0, 0, 0, 5);
    Utility.add(subPanel, startStopButton, panelgbl, panelgbc, 0, 0, 1, 1);
    panelgbc.insets = new Insets(0, 0, 0, 0);
    Utility.add(subPanel, continueButton, panelgbl, panelgbc, 1, 0, 1, 1);
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.NONE;
    gbc.insets = new Insets(5, 0, 0, 0);
    Utility.add(controlsPanel, subPanel, controlsgbl, gbc, 0, panelrow, 1, 1);
    ++panelrow;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;
    // (ii) select DataStreams to turn on
    panelgbl = new GridBagLayout();
    subPanel = new JPanel(panelgbl);
    panelgbc = new GridBagConstraints();
    panelgbc.anchor = GridBagConstraints.WEST;
    panelgbc.fill = GridBagConstraints.NONE;
    panelgbc.weightx = 0;
    panelgbc.weighty = 0;
    subPanel.setBackground(controlsPanel.getBackground());
    panelgbc.insets = new Insets(0, 0, 0, 0);
    Utility.add(subPanel, screencapCheck, panelgbl, panelgbc, 0, 0, 1, 1);
    Utility.add(subPanel, webcamCheck, panelgbl, panelgbc, 1, 0, 1, 1);
    Utility.add(subPanel, audioCheck, panelgbl, panelgbc, 2, 0, 1, 1);
    Utility.add(subPanel, textCheck, panelgbl, panelgbc, 3, 0, 1, 1);
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.NONE;
    gbc.insets = new Insets(0, 0, 0, 0);
    Utility.add(controlsPanel, subPanel, controlsgbl, gbc, 0, panelrow, 1, 1);
    ++panelrow;
    // (iii) images/sec control
    panelgbl = new GridBagLayout();
    subPanel = new JPanel(panelgbl);
    panelgbc = new GridBagConstraints();
    panelgbc.anchor = GridBagConstraints.WEST;
    panelgbc.fill = GridBagConstraints.NONE;
    panelgbc.weightx = 0;
    panelgbc.weighty = 0;
    subPanel.setBackground(controlsPanel.getBackground());
    panelgbc.insets = new Insets(2, 0, 0, 0);
    Utility.add(subPanel, fpsLabel, panelgbl, panelgbc, 0, 0, 1, 1);
    panelgbc.insets = new Insets(2, 10, 0, 10);
    Utility.add(subPanel, fpsCB, panelgbl, panelgbc, 1, 0, 1, 1);
    gbc.insets = new Insets(0, 0, 0, 0);
    gbc.anchor = GridBagConstraints.CENTER;
    Utility.add(controlsPanel, subPanel, controlsgbl, gbc, 0, panelrow, 1, 1);
    ++panelrow;
    // (iv) image quality slider
    panelgbl = new GridBagLayout();
    subPanel = new JPanel(panelgbl);
    panelgbc = new GridBagConstraints();
    panelgbc.anchor = GridBagConstraints.WEST;
    panelgbc.fill = GridBagConstraints.NONE;
    panelgbc.weightx = 0;
    panelgbc.weighty = 0;
    subPanel.setBackground(controlsPanel.getBackground());
    JLabel sliderLabelLow = new JLabel("Low", SwingConstants.LEFT);
    JLabel sliderLabelHigh = new JLabel("High", SwingConstants.LEFT);
    panelgbc.insets = new Insets(-5, 0, 0, 0);
    Utility.add(subPanel, imgQualLabel, panelgbl, panelgbc, 0, 0, 1, 1);
    panelgbc.insets = new Insets(-5, 5, 0, 5);
    Utility.add(subPanel, sliderLabelLow, panelgbl, panelgbc, 1, 0, 1, 1);
    panelgbc.insets = new Insets(0, 0, 0, 0);
    Utility.add(subPanel, imgQualSlider, panelgbl, panelgbc, 2, 0, 1, 1);
    panelgbc.insets = new Insets(-5, 5, 0, 0);
    Utility.add(subPanel, sliderLabelHigh, panelgbl, panelgbc, 3, 0, 1, 1);
    gbc.insets = new Insets(0, 0, 0, 0);
    gbc.anchor = GridBagConstraints.CENTER;
    Utility.add(controlsPanel, subPanel, controlsgbl, gbc, 0, panelrow, 1, 1);
    ++panelrow;
    // (v) Include mouse cursor in screen capture image?
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    gbc.insets = new Insets(0, 15, 5, 15);
    Utility.add(controlsPanel, includeMouseCursorCheck, controlsgbl, gbc, 0, panelrow, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++panelrow;
    // (vi) Change detect / Full screen / Preview checkboxes
    panelgbl = new GridBagLayout();
    subPanel = new JPanel(panelgbl);
    panelgbc = new GridBagConstraints();
    panelgbc.anchor = GridBagConstraints.WEST;
    panelgbc.fill = GridBagConstraints.NONE;
    panelgbc.weightx = 0;
    panelgbc.weighty = 0;
    subPanel.setBackground(controlsPanel.getBackground());
    panelgbc.insets = new Insets(0, 0, 0, 0);
    Utility.add(subPanel, changeDetectCheck, panelgbl, panelgbc, 0, 0, 1, 1);
    Utility.add(subPanel, fullScreenCheck, panelgbl, panelgbc, 1, 0, 1, 1);
    Utility.add(subPanel, previewCheck, panelgbl, panelgbc, 2, 0, 1, 1);
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.NONE;
    gbc.insets = new Insets(-5, 0, 3, 0);
    Utility.add(controlsPanel, subPanel, controlsgbl, gbc, 0, panelrow, 1, 1);
    ++panelrow;
    // (vii) text field for the TextStream
    /*
    panelgbl = new GridBagLayout();
    subPanel = new JPanel(panelgbl);
    panelgbc = new GridBagConstraints();
    panelgbc.anchor = GridBagConstraints.CENTER;
    panelgbc.fill = GridBagConstraints.HORIZONTAL;
    panelgbc.weightx = 100;
    panelgbc.weighty = 100;
    subPanel.setBackground(controlsPanel.getBackground());
    panelgbc.insets = new Insets(0, 0, 0, 0);
    Utility.add(subPanel, textScrollPane, panelgbl, panelgbc, 1, 0, 1, 1);
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 100;
    gbc.insets = new Insets(0, 15, 3, 15);
    Utility.add(controlsPanel, subPanel, controlsgbl, gbc, 0, panelrow, 2, 1);
    ++panelrow;
    */
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 0;
    gbc.insets = new Insets(0, 15, 5, 15);
    Utility.add(controlsPanel, textScrollPane, controlsgbl, gbc, 0, panelrow, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++panelrow;

    //
    // Second row: the translucent/transparent capture panel
    //
    if (bShapedWindowSupportedI) {
        // Doing the Shaped window; set capturePanel inside guiPanel
        // a bit so the red from guiPanel shows at the edges
        gbc.insets = new Insets(5, 5, 5, 5);
    } else {
        // No shaped window; have capturePanel fill the area
        gbc.insets = new Insets(0, 0, 0, 0);
    }
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 100;
    gbc.weighty = 100;
    Utility.add(guiPanel, capturePanel, gbl, gbc, 0, row, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    //
    // Add guiPanel to guiFrame
    //
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 100;
    gbc.weighty = 100;
    gbc.insets = new Insets(0, 0, 0, 0);
    Utility.add(guiFrame, guiPanel, framegbl, gbc, 0, 0, 1, 1);

    //
    // Add menu
    //
    JMenuBar menuBar = createMenu();
    guiFrame.setJMenuBar(menuBar);

    //
    // If Shaped windows are supported, the region defined by capturePanel
    // will be "hollowed out" so that the user can reach through guiFrame
    // and interact with applications which are behind it.
    //
    // NOTE: This doesn't work on Mac OS (we've tried, but nothing seems
    //       to work to allow a user to reach through guiFrame to interact
    //       with windows behind).  May be a limitation or bug on Mac OS:
    //       https://bugs.openjdk.java.net/browse/JDK-8013450
    //
    if (bShapedWindowSupportedI) {
        guiFrame.addComponentListener(new ComponentAdapter() {
            // As the window is resized, the shape is recalculated here.
            @Override
            public void componentResized(ComponentEvent e) {
                // Create a rectangle to cover the entire guiFrame
                Area guiShape = new Area(new Rectangle(0, 0, guiFrame.getWidth(), guiFrame.getHeight()));
                // Create another rectangle to define the hollowed out region of capturePanel
                guiShape.subtract(new Area(new Rectangle(capturePanel.getX(), capturePanel.getY() + 23,
                        capturePanel.getWidth(), capturePanel.getHeight())));
                guiFrame.setShape(guiShape);
            }
        });
    }

    //
    // Final guiFrame configuration details and displaying the GUI
    //
    guiFrame.pack();

    guiFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    guiFrame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            exit(false);
        }
    });

    // Center on the screen
    guiFrame.setLocationRelativeTo(null);

    //
    // Set the taskbar/dock icon; note that Mac OS has its own way of doing it
    //
    if (bMacOS) {
        try {
            // JPW 2018/02/02: changed how to load images to work under Java 9
            InputStream imageInputStreamLarge = getClass().getClassLoader()
                    .getResourceAsStream("Icon_128x128.png");
            BufferedImage bufferedImageLarge = ImageIO.read(imageInputStreamLarge);
            /**
             *
             * Java 9 note: running the following code under Java 9 on a Mac will produce the following warning:
             *
             * WARNING: An illegal reflective access operation has occurred
             * WARNING: Illegal reflective access by erigo.ctstream.CTstream (file:/Users/johnwilson/CT_versions/compiled_under_V8/CTstream.jar) to method com.apple.eawt.Application.getApplication()
             * WARNING: Please consider reporting this to the maintainers of erigo.ctstream.CTstream
             * WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
             * WARNING: All illegal access operations will be denied in a future release
             *
             * This is because Java 9 has taken a step away from using reflection; see see the section titled
             * "Illegal Access To Internal APIs" at https://blog.codefx.org/java/java-9-migration-guide/.
             *
             * A good fix (but only available in Java 9+) is to use the following:
             *
             *     java.awt.Taskbar taskbar = java.awt.Taskbar.getTaskbar();
             *     taskbar.setIconImage(bufferedImageLarge);
             *
             * Could use reflection to make calls in class com.apple.eawt.Application; for example, see
             * Bertil Chapuis' "dockicon.java" example code at https://gist.github.com/bchapuis/1562406
             *
             * For now, we just won't do dock icons under Mac OS.
             *
             **/
        } catch (Exception excepI) {
            System.err.println("Exception thrown trying to set icon: " + excepI);
        }
    } else {
        // The following has been tested under Windows 10 and Ubuntu 12.04 LTS
        try {
            // JPW 2018/02/02: changed how to load images to work under Java 9
            InputStream imageInputStreamLarge = getClass().getClassLoader()
                    .getResourceAsStream("Icon_128x128.png");
            BufferedImage bufferedImageLarge = ImageIO.read(imageInputStreamLarge);
            InputStream imageInputStreamMed = getClass().getClassLoader().getResourceAsStream("Icon_64x64.png");
            BufferedImage bufferedImageMed = ImageIO.read(imageInputStreamMed);
            InputStream imageInputStreamSmall = getClass().getClassLoader()
                    .getResourceAsStream("Icon_32x32.png");
            BufferedImage bufferedImageSmall = ImageIO.read(imageInputStreamSmall);
            List<BufferedImage> iconList = new ArrayList<BufferedImage>();
            iconList.add(bufferedImageLarge);
            iconList.add(bufferedImageMed);
            iconList.add(bufferedImageSmall);
            guiFrame.setIconImages(iconList);
        } catch (Exception excepI) {
            System.err.println("Exception thrown trying to set icon: " + excepI);
        }
    }

    ctSettings = new CTsettings(this, guiFrame);

    guiFrame.setVisible(true);

}

From source file:junk.gui.HazardSpectrumApplication.java

/**
 * Initialize the site gui bean/*from w  w  w  . j  a va2  s.  co  m*/
 */
private void initSiteGuiBean() {

    // get the selected IMR
    ScalarIntensityMeasureRelationshipAPI imr = imrGuiBean.getSelectedIMR_Instance();
    // create the Site Gui Bean object
    siteGuiBean = new Site_GuiBean();
    siteGuiBean.replaceSiteParams(imr.getSiteParamsIterator());
    // show the sitebean in JPanel
    sitePanel.add(this.siteGuiBean, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, defaultInsets, 0, 0));

}

From source file:junk.gui.HazardSpectrumApplication.java

/**
 * Initialise the IMT_Prob Selector Gui Bean
 *//*w  ww . j  a va 2 s  . c  o m*/
private void initImlProb_GuiBean() {
    imlProbGuiBean = new IMLorProbSelectorGuiBean();
    this.imtPanel.add(imlProbGuiBean, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, defaultInsets, 0, 0));
}

From source file:junk.gui.HazardSpectrumApplication.java

/**
 * Initialize the ERF Gui Bean//from w  w  w.j av a  2 s  .  c  o  m
 */
private void initERF_GuiBean() {
    // create the ERF Gui Bean object
    ArrayList erf_Classes = new ArrayList();
    erf_Classes.add(FRANKEL2000_ADJ_FORECAST_CLASS_NAME);
    erf_Classes.add(FRANKEL_ADJ_FORECAST_CLASS_NAME);
    erf_Classes.add(STEP_FORECAST_CLASS_NAME);
    erf_Classes.add(WG02_ERF_LIST_CLASS_NAME);
    erf_Classes.add(STEP_ALASKA_ERF_CLASS_NAME);
    erf_Classes.add(POISSON_FAULT_ERF_CLASS_NAME);
    erf_Classes.add(PEER_AREA_FORECAST_CLASS_NAME);
    erf_Classes.add(PEER_NON_PLANAR_FAULT_FORECAST_CLASS_NAME);
    erf_Classes.add(PEER_MULTI_SOURCE_FORECAST_CLASS_NAME);
    erf_Classes.add(PEER_LOGIC_TREE_FORECAST_CLASS_NAME);

    try {
        if (erfGuiBean == null)
            erfGuiBean = new ERF_GuiBean(erf_Classes);
    } catch (InvocationTargetException e) {
        throw new RuntimeException("Connection to ERF's  failed");
    }
    erfPanel.setLayout(gridBagLayout5);
    erfPanel.removeAll();
    erfPanel.add(erfGuiBean, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, defaultInsets, 0, 0));
    erfPanel.validate();
    erfPanel.repaint();
}

From source file:org.gtdfree.GTDFree.java

private Component getOverviewPane() {
    if (overview == null) {
        overview = new JPanel();
        overview.setLayout(new GridBagLayout());

        int row = 0;

        JLabel l = new JLabel(Messages.getString("GTDFree.OW.Workflow")); //$NON-NLS-1$
        l.setFont(l.getFont().deriveFont((float) (l.getFont().getSize() * 5.0 / 4.0)).deriveFont(Font.BOLD));
        overview.add(l, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                GridBagConstraints.HORIZONTAL, new Insets(18, 18, 7, 18), 0, 0));

        overview.add(/*from   w ww.  ja  va 2s .c om*/
                new OverviewTabPanel(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_collecting),
                        TAB_COLECT, Messages.getString("GTDFree.Collect")), //$NON-NLS-1$
                new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                        GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));
        overview.add(
                new OverviewTabPanel(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_processing),
                        TAB_PROCESS, Messages.getString("GTDFree.Process")), //$NON-NLS-1$
                new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                        GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));
        overview.add(
                new OverviewTabPanel(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_review),
                        TAB_ORGANIZE, Messages.getString("GTDFree.Organize")), //$NON-NLS-1$
                new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.CENTER,
                        GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));
        overview.add(
                new OverviewTabPanel(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_queue_execute),
                        TAB_EXECUTE, Messages.getString("GTDFree.Execute")), //$NON-NLS-1$
                new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                        GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        l = new JLabel(Messages.getString("GTDFree.OW.Summary")); //$NON-NLS-1$
        l.setFont(l.getFont().deriveFont((float) (l.getFont().getSize() * 5.0 / 4.0)).deriveFont(Font.BOLD));
        overview.add(l, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                GridBagConstraints.HORIZONTAL, new Insets(14, 18, 7, 18), 0, 0));

        SummaryLabel sl = new SummaryLabel("inbucketCount") { //$NON-NLS-1$
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent e) {
                tabbedPane.setSelectedIndex(TAB_PROCESS);
            }

            @Override
            void updateText(PropertyChangeEvent arg0) {
                if (getSummaryBean().getInbucketCount() > 0) {
                    label.setText(
                            getSummaryBean().getInbucketCount() + " " + Messages.getString("GTDFree.OW.Bucket") //$NON-NLS-1$//$NON-NLS-2$
                                    + " " + Messages.getString("GTDFree.OW.Process")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(true);
                } else {
                    label.setText(getSummaryBean().getInbucketCount() + " " //$NON-NLS-1$
                            + Messages.getString("GTDFree.OW.Bucket")); //$NON-NLS-1$
                    button.setVisible(false);
                }
            }
        };
        overview.add(sl, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        sl = new SummaryLabel("pastActions") { //$NON-NLS-1$
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent e) {
                tabbedPane.setSelectedIndex(TAB_ORGANIZE);
                organizePane.openTicklerForPast();
            }

            @Override
            void updateText(PropertyChangeEvent arg0) {
                if (getSummaryBean().getPastActions() > 0) {
                    label.setText(
                            getSummaryBean().getPastActions() + " " + Messages.getString("GTDFree.OW.Reminder") //$NON-NLS-1$//$NON-NLS-2$
                                    + " " + Messages.getString("GTDFree.OW.Update")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(true);
                } else {
                    label.setText(getSummaryBean().getPastActions() + " " //$NON-NLS-1$
                            + Messages.getString("GTDFree.OW.Reminder")); //$NON-NLS-1$
                    button.setVisible(false);

                }
            }
        };
        overview.add(sl, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        sl = new SummaryLabel("todayActions") { //$NON-NLS-1$
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent e) {
                tabbedPane.setSelectedIndex(TAB_ORGANIZE);
                organizePane.openTicklerForToday();
            }

            @Override
            void updateText(PropertyChangeEvent arg0) {
                if (getSummaryBean().getTodayActions() > 0) {
                    label.setText(
                            getSummaryBean().getTodayActions() + " " + Messages.getString("GTDFree.OW.Due") //$NON-NLS-1$//$NON-NLS-2$
                                    + " " + Messages.getString("GTDFree.OW.Tickler")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(true);
                } else {
                    label.setText(
                            getSummaryBean().getTodayActions() + " " + Messages.getString("GTDFree.OW.Due")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(false);

                }
            }
        };
        overview.add(sl, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        sl = new SummaryLabel("queueCount") { //$NON-NLS-1$
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent e) {
                tabbedPane.setSelectedIndex(TAB_EXECUTE);
            }

            @Override
            void updateText(PropertyChangeEvent arg0) {
                if (getSummaryBean().getQueueCount() > 0) {
                    label.setText(
                            getSummaryBean().getQueueCount() + " " + Messages.getString("GTDFree.OW.Queue") //$NON-NLS-1$//$NON-NLS-2$
                                    + " " + Messages.getString("GTDFree.OW.Execute")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(true);
                } else {
                    label.setText(
                            getSummaryBean().getQueueCount() + " " + Messages.getString("GTDFree.OW.Queue")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(false);

                }
            }
        };
        overview.add(sl, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        sl = new SummaryLabel("mainCounts") { //$NON-NLS-1$
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent e) {
                GTDFree.this.getActionMap().get("importDialog").actionPerformed(e); //$NON-NLS-1$
                engine.getGlobalProperties().putProperty("examplesImported", true); //$NON-NLS-1$
                updateText(new PropertyChangeEvent(this, "mainCounts", -1, 1)); //$NON-NLS-1$
            }

            @Override
            void updateText(PropertyChangeEvent arg0) {
                if (!getEngine().getGlobalProperties().getBoolean("examplesImported", false)) { //$NON-NLS-1$
                    label.setText(getSummaryBean().getOpenCount() + " " //$NON-NLS-1$
                            + Messages.getString("GTDFree.OW.Open.1") + " " + getSummaryBean().getTotalCount() //$NON-NLS-1$//$NON-NLS-2$
                            + " " + Messages.getString("GTDFree.OW.Open.2") + " " //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
                            + Messages.getString("GTDFree.OW.Import")); //$NON-NLS-1$
                    button.setVisible(true);
                } else {
                    label.setText(getSummaryBean().getOpenCount() + " " //$NON-NLS-1$
                            + Messages.getString("GTDFree.OW.Open.1") + " " + getSummaryBean().getTotalCount() //$NON-NLS-1$//$NON-NLS-2$
                            + " " + Messages.getString("GTDFree.OW.Open.2")); //$NON-NLS-1$ //$NON-NLS-2$
                    button.setVisible(false);

                }
            }
        };
        overview.add(sl, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(0, 18, 4, 18), 0, 0));

        overview.add(new JPanel(), new GridBagConstraints(0, row++, 1, 1, 1, 1, GridBagConstraints.WEST,
                GridBagConstraints.NONE, new Insets(0, 11, 0, 11), 0, 0));

    }

    return overview;
}

From source file:junk.gui.HazardSpectrumApplication.java

/**
 * Initialize the ERF Rup Selector Gui Bean
 *//*from ww w.  j  av  a 2  s  .  c o  m*/
private void initERFSelector_GuiBean() {
    // create the ERF Gui Bean object
    ArrayList erf_Classes = new ArrayList();
    erf_Classes.add(FRANKEL_ADJ_FORECAST_CLASS_NAME);
    erf_Classes.add(FRANKEL2000_ADJ_FORECAST_CLASS_NAME);
    erf_Classes.add(STEP_FORECAST_CLASS_NAME);
    erf_Classes.add(WG02_FORECAST_CLASS_NAME);
    erf_Classes.add(POISSON_FAULT_ERF_CLASS_NAME);
    erf_Classes.add(PEER_AREA_FORECAST_CLASS_NAME);
    erf_Classes.add(PEER_NON_PLANAR_FAULT_FORECAST_CLASS_NAME);
    erf_Classes.add(PEER_MULTI_SOURCE_FORECAST_CLASS_NAME);
    erf_Classes.add(PEER_LOGIC_TREE_FORECAST_CLASS_NAME);

    try {
        if (erfRupSelectorGuiBean == null)
            erfRupSelectorGuiBean = new EqkRupSelectorGuiBean(erf_Classes);
    } catch (InvocationTargetException e) {
        throw new RuntimeException("Connection to ERF's failed");
    }

    erfPanel.removeAll();
    //erfGuiBean = null;
    erfPanel.add(erfRupSelectorGuiBean, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, defaultInsets, 0, 0));
    erfRupSelectorGuiBean.getParameter(ERF_GuiBean.ERF_PARAM_NAME).addParameterChangeListener(this);
    erfPanel.validate();
    erfPanel.repaint();
}