Example usage for javax.swing.event ChangeListener ChangeListener

List of usage examples for javax.swing.event ChangeListener ChangeListener

Introduction

In this page you can find the example usage for javax.swing.event ChangeListener ChangeListener.

Prototype

ChangeListener

Source Link

Usage

From source file:fr.vdl.android.holocolors.HoloColorsDialog.java

/**
 * @param project/*w  ww  . ja v  a2 s. c o  m*/
 */
public HoloColorsDialog(@Nullable final Project project) {
    super(project, true);

    loadingDialog = new JDialog(getWindow(), "Downloading, please wait...", Dialog.ModalityType.MODELESS);
    loadingDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    loadingDialog.setSize(300, 20);
    loadingDialog.setLocationRelativeTo(ahcPanel);

    this.project = project;

    checkLicence();

    setTitle("Android Holo Colors Generator");
    setResizable(true);

    FileChooserDescriptor workingDirectoryChooserDescriptor = FileChooserDescriptorFactory
            .createSingleFolderDescriptor();
    String title = "Select res directory";
    workingDirectoryChooserDescriptor.setTitle(title);
    resPathTextField.addBrowseFolderListener(title, null, project, workingDirectoryChooserDescriptor);

    colorTextField.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color color = ColorChooser.chooseColor(WindowManager.getInstance().suggestParentWindow(project),
                    "Select color", null);
            if (color != null) {
                colorTextField.setText('#' + ColorUtil.toHex(color));
                colorTextField.setForeground(color);
            }
        }
    });

    // select appcompat by default
    compatComboBox.setSelectedIndex(2);
    oldSdkRadio.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            compatComboBox.setEnabled(oldSdkRadio.isSelected());
        }
    });

    init();
}

From source file:net.pms.movieinfo.MovieInfo.java

@Override
public JComponent config() {
    FormLayout layout = new FormLayout(
            "left:pref, 2dlu, p,2dlu, p,2dlu, p, 2dlu, p, 2dlu, p,2dlu, p,200dlu, pref:grow", //$NON-NLS-1$
            "p, 5dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p,0:grow"); //$NON-NLS-1$
    PanelBuilder builder = new PanelBuilder(layout);
    builder.border(Borders.EMPTY);//  w  ww.  ja va 2  s . c  o m
    builder.opaque(false);

    CellConstraints cc = new CellConstraints();

    JComponent cmp = builder.addSeparator("MOVIE INFO CONFIG", cc.xy(1, 1));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    pluginsField = new JTextField();
    pluginsField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented
    if (configuration.getPlugins() != null)
        pluginsField.setText(configuration.getPlugins());
    pluginsField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            configuration.setPlugins(pluginsField.getText());
        }
    });
    builder.addLabel("Plugins to use (in prioritized order):", cc.xy(1, 3));
    builder.add(pluginsField, cc.xyw(3, 3, 12));

    maxNumberOfActorsField = new JSpinner(new SpinnerNumberModel());
    maxNumberOfActorsField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented
    maxNumberOfActorsField.setValue(configuration.getMaxNumberOfActors());
    maxNumberOfActorsField.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            configuration.setMaxNumberOfActors((Integer) maxNumberOfActorsField.getValue());
        }
    });
    builder.addLabel("Maximum number of actors to display:", cc.xy(1, 5));
    builder.add(maxNumberOfActorsField, cc.xy(3, 5));

    downloadCoverField = new JCheckBox();
    downloadCoverField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented
    downloadCoverField.setSelected(configuration.getDownloadCover());
    downloadCoverField.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            configuration.setDownloadCover(downloadCoverField.isSelected());
        }
    });
    builder.addLabel("Download cover to movie folder:", cc.xy(5, 5));
    builder.add(downloadCoverField, cc.xy(7, 5));

    displayInfoField = new JTextField();
    displayInfoField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented
    if (configuration.getDisplayInfo() != null) {
        displayInfoField.setText(configuration.getDisplayInfoAsString());
    }
    displayInfoField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            //TODO: Needs verification logics
            configuration.setDisplayInfoFromString(displayInfoField.getText());
        }
    });
    builder.addLabel("DisplayInfo:", cc.xy(13, 5));
    builder.add(displayInfoField, cc.xyw(14, 5, 2));

    plotLineLengthField = new JSpinner(new SpinnerNumberModel());
    plotLineLengthField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented
    plotLineLengthField.setValue(configuration.getPlotLineLength());
    plotLineLengthField.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            configuration.setPlotLineLength((Integer) plotLineLengthField.getValue());
        }
    });
    builder.addLabel("Plot line length:", cc.xy(9, 5));
    builder.add(plotLineLengthField, cc.xy(11, 5));

    filterField = new JTextField();
    filterField.setEnabled(false); // Until MovieInfoConfiguration.save() is implemented
    if (configuration.getFilters() != null) {
        filterField.setText(configuration.getFiltersAsString());
    }
    filterField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            //TODO: Needs verification logics
            configuration.setFiltersFromString(filterField.getText());
        }
    });
    ScanPath = new JTextField();
    builder.addLabel("Filter:", cc.xy(1, 7));
    builder.add(filterField, cc.xyw(3, 7, 12));
    builder.addLabel("Scan path:", cc.xy(1, 9));
    builder.add(ScanPath, cc.xyw(3, 9, 12));
    ScanPath.setText((String) PMS.getConfiguration().getCustomProperty("movieinfo.scan_path"));
    JButton scan = new JButton("Scan files");
    scan.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (mdb != null) {
                if (!mdb.isScanLibraryRunning()) {
                    int option = JOptionPane.showConfirmDialog(LooksFrame.get(),
                            Messages.getString("FoldTab.3") + Messages.getString("FoldTab.4"),
                            Messages.getString("Dialog.Question"), JOptionPane.YES_NO_OPTION);
                    if (option == JOptionPane.YES_OPTION) {
                        mdb.scanLibrary(ScanPath.getText());
                    }
                } else {
                    int option = JOptionPane.showConfirmDialog(LooksFrame.get(),
                            Messages.getString("FoldTab.10"), Messages.getString("Dialog.Question"),
                            JOptionPane.YES_NO_OPTION);
                    if (option == JOptionPane.YES_OPTION) {
                        mdb.stopScanLibrary();
                    }
                }
            }
        }
    });
    builder.add(scan, cc.xy(1, 11));

    return builder.getPanel();
}

From source file:burp.BurpExtender.java

@Override
public void registerExtenderCallbacks(final IBurpExtenderCallbacks callbacks) {
    // keep a reference to our callbacks object
    this.callbacks = callbacks;

    callbacks.registerContextMenuFactory(new ContextMenuFactory(this, callbacks));

    // set our extension name
    callbacks.setExtensionName("Code Dx");

    for (int i = 0; i < refreshSpinner.length; i++)
        refreshSpinner[i] = new ImageIcon(BurpExtender.class.getResource("/" + i + ".png"));

    // create our UI
    SwingUtilities.invokeLater(new Runnable() {
        @Override//w  w w . ja v  a  2  s .  co  m
        public void run() {
            pane = new JScrollPane(createMainPanel());
            refreshAnimation = new ButtonAnimationThread(projectRefresh, refreshSpinner);

            callbacks.customizeUiComponent(pane);

            // add the custom tab to Burp's UI
            callbacks.addSuiteTab(BurpExtender.this);

            // add listener to update projects list when Code Dx tab selected
            Component parent = pane.getParent();
            if (parent instanceof JTabbedPane) {
                final JTabbedPane tabs = (JTabbedPane) parent;
                final ChangeListener tabChangeListener = new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent arg0) {
                        if (pane == tabs.getSelectedComponent() && !updating && !"".equals(serverUrl.getText())
                                && !"".equals(apiKey.getText())) {
                            Thread updateThread = new Thread() {
                                public void run() {
                                    updateTargets();
                                    updateProjects(true);
                                }
                            };
                            updateThread.start();
                        } else if (pane != tabs.getSelectedComponent()) {
                            NameValuePair project = getProject();
                            if (project != null)
                                callbacks.saveExtensionSetting(BurpExtender.PROJECT_KEY, project.getValue());
                        }
                    }

                };
                tabs.addChangeListener(tabChangeListener);
                //Remove the change listener when the extension is unloaded
                callbacks.registerExtensionStateListener(new IExtensionStateListener() {
                    @Override
                    public void extensionUnloaded() {
                        tabs.removeChangeListener(tabChangeListener);
                    }
                });
            }
        }
    });
}

From source file:com.rapidminer.gui.plotter.charts.HistogramChart.java

public HistogramChart(final PlotterConfigurationModel settings) {
    super(settings);

    logScaleBox = new ListeningJCheckBox(PARAMETER_LOG_SCALE, "Log Scale", false);
    logScaleBox.addActionListener(new ActionListener() {

        @Override/*from   w  w w .j  av a2  s  .  co m*/
        public void actionPerformed(ActionEvent e) {
            settings.setParameterAsBoolean(PARAMETER_LOG_SCALE, logScaleBox.isSelected());
        }
    });

    binNumberSlider = new ListeningJSlider(PARAMETER_NUMBER_OF_BINS, MIN_BIN_NUMBER, MAX_BIN_NUMBER,
            DEFAULT_BIN_NUMBER);
    binNumberSlider.setMajorTickSpacing(MAX_BIN_NUMBER - MIN_BIN_NUMBER);
    binNumberSlider.setMinorTickSpacing((MAX_BIN_NUMBER - MIN_BIN_NUMBER) / 10);
    binNumberSlider.setPaintTicks(true);
    binNumberSlider.setPaintLabels(true);
    binNumberSlider.setToolTipText("Set the number of bins which should be displayed.");
    binNumberSlider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            if (!binNumberSlider.getValueIsAdjusting()) {
                settings.setParameterAsInt(PARAMETER_NUMBER_OF_BINS, binNumberSlider.getValue());
            }
        }
    });

    opaquenessSlider = new ListeningJSlider(PARAMETER_OPAQUENESS, 0, 100, (int) (this.opaqueness * 100));
    opaquenessSlider.setPaintTicks(true);
    opaquenessSlider.setPaintLabels(true);
    opaquenessSlider.setToolTipText("Set the amount of opaqueness / transparency.");
    opaquenessSlider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            if (!opaquenessSlider.getValueIsAdjusting()) {
                settings.setParameterAsInt(PARAMETER_OPAQUENESS, opaquenessSlider.getValue());
            }
        }
    });

}

From source file:de.codesourcery.flocking.ui.NumberInputField.java

/**
 * Create instance.//w  ww.  ja  v a 2 s.c o  m
 *  
 * <p>Creates a resizable panel that holds a label, a textfield and a slider
 * for entering/adjusting a numeric value.</p>
 * 
 * @param label the label to display
 * @param model the model that is used to read/write the value to be edited. If the model returns <code>null</code> values,
 * these will be treated as "0" (or "0.0" respectively).
 * @param minValue valid minimum value (inclusive) the user may enter
 * @param maxValue vali maximum value (inclusive) the user may enter
 * @param onlyIntValues whether the user may enter only integers or integers <b>and</b> floating-point numbers. 
 */
public NumberInputField(String label, IModel<T> model, double minValue, double maxValue,
        final boolean onlyIntValues) {
    if (model == null) {
        throw new IllegalArgumentException("model must not be NULL.");
    }

    this.model = model;
    this.minValue = minValue;
    this.maxValue = maxValue;
    this.onlyIntValues = onlyIntValues;

    textField = new JTextField("0");
    textField.setColumns(5);
    textField.setHorizontalAlignment(JTextField.RIGHT);

    slider = new JSlider(0, SLIDER_RESOLUTION);

    textField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (selfTriggeredEvent) {
                return;
            }

            final String s = textField.getText();
            if (!StringUtils.isBlank(s)) {
                Number number = null;
                try {
                    if (onlyIntValues) {
                        number = Long.parseLong(s.trim());
                    } else {
                        number = Double.parseDouble(s.trim());
                    }
                } catch (Exception ex) {
                    textField.setText(numberToString(NumberInputField.this.model.getObject()));
                    return;
                }

                updateModelValue(number);
            }
        }
    });

    textField.setText(numberToString(model.getObject()));

    slider.getModel().setValue(calcSliderValue(model.getObject()));
    slider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            if (selfTriggeredEvent) {
                return;
            }
            final double percentage = slider.getModel().getValue() / (double) SLIDER_RESOLUTION; // 0...1

            final double range = Math.abs(NumberInputField.this.maxValue - NumberInputField.this.minValue);
            final double newValue = NumberInputField.this.minValue + range * percentage;

            updateModelValue(newValue);
        }
    });

    slider.setMinimumSize(new Dimension(100, 20));
    slider.setPreferredSize(new Dimension(100, 20));

    // do layout
    setLayout(new GridBagLayout());

    GridBagConstraints cnstrs = new GridBagConstraints();
    cnstrs.fill = GridBagConstraints.NONE;
    cnstrs.weightx = 0;
    cnstrs.weighty = 0;
    cnstrs.gridx = 0;
    cnstrs.gridy = 0;

    final JLabel l = new JLabel(label);
    l.setMinimumSize(new Dimension(1500, 20));
    l.setPreferredSize(new Dimension(150, 20));
    l.setVerticalAlignment(SwingConstants.TOP);
    add(l, cnstrs);

    cnstrs = new GridBagConstraints();
    cnstrs.fill = GridBagConstraints.NONE;
    cnstrs.weightx = 0;
    cnstrs.weighty = 0;
    cnstrs.gridx = 1;
    cnstrs.gridy = 0;
    cnstrs.insets = new Insets(0, 0, 0, 10);

    add(textField, cnstrs);

    cnstrs = new GridBagConstraints();
    cnstrs.fill = GridBagConstraints.HORIZONTAL;
    cnstrs.weightx = 1.0;
    cnstrs.weighty = 1.0;
    cnstrs.gridx = 2;
    cnstrs.gridy = 0;

    add(slider, cnstrs);
}

From source file:edu.gmu.cs.sim.util.media.chart.XYChartGenerator.java

protected void buildGlobalAttributes(LabelledList list) {

    // create the chart
    ((XYPlot) (chart.getPlot())).setDomainGridlinesVisible(false);
    ((XYPlot) (chart.getPlot())).setRangeGridlinesVisible(false);
    ((XYPlot) (chart.getPlot())).setDomainGridlinePaint(new Color(200, 200, 200));
    ((XYPlot) (chart.getPlot())).setRangeGridlinePaint(new Color(200, 200, 200));

    xLabel = new PropertyField() {
        public String newValue(String newValue) {
            setXAxisLabel(newValue);/*from  ww  w  . j  av  a2  s. c  om*/
            getChartPanel().repaint();
            return newValue;
        }
    };
    xLabel.setValue(getXAxisLabel());

    list.add(new JLabel("X Label"), xLabel);

    yLabel = new PropertyField() {
        public String newValue(String newValue) {
            setYAxisLabel(newValue);
            getChartPanel().repaint();
            return newValue;
        }
    };
    yLabel.setValue(getYAxisLabel());

    list.add(new JLabel("Y Label"), yLabel);

    xLog = new JCheckBox();
    xLog.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (xLog.isSelected()) {
                LogarithmicAxis logAxis = new LogarithmicAxis(xLabel.getValue());
                logAxis.setStrictValuesFlag(false);
                chart.getXYPlot().setDomainAxis(logAxis);
            } else {
                chart.getXYPlot().setDomainAxis(new NumberAxis(xLabel.getValue()));
            }
        }
    });

    yLog = new JCheckBox();
    yLog.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (yLog.isSelected()) {
                LogarithmicAxis logAxis = new LogarithmicAxis(yLabel.getValue());
                logAxis.setStrictValuesFlag(false);
                chart.getXYPlot().setRangeAxis(logAxis);
            } else {
                chart.getXYPlot().setRangeAxis(new NumberAxis(yLabel.getValue()));
            }
        }
    });

    Box box = Box.createHorizontalBox();
    box.add(new JLabel("X"));
    box.add(xLog);
    box.add(new JLabel(" Y"));
    box.add(yLog);
    box.add(Box.createGlue());
    list.add(new JLabel("Log Axis"), box);

    final JCheckBox xgridlines = new JCheckBox();
    xgridlines.setSelected(false);
    ItemListener il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                chart.getXYPlot().setDomainGridlinesVisible(true);
            } else {
                chart.getXYPlot().setDomainGridlinesVisible(false);
            }
        }
    };
    xgridlines.addItemListener(il);

    final JCheckBox ygridlines = new JCheckBox();
    ygridlines.setSelected(false);
    il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                chart.getXYPlot().setRangeGridlinesVisible(true);
            } else {
                chart.getXYPlot().setRangeGridlinesVisible(false);
            }
        }
    };
    ygridlines.addItemListener(il);

    box = Box.createHorizontalBox();
    box.add(new JLabel("X"));
    box.add(xgridlines);
    box.add(new JLabel(" Y"));
    box.add(ygridlines);
    box.add(Box.createGlue());
    list.add(new JLabel("Grid Lines"), box);
}

From source file:sim.util.media.chart.XYChartGenerator.java

protected void buildGlobalAttributes(LabelledList list) {

    // create the chart
    ((XYPlot) (chart.getPlot())).setDomainGridlinesVisible(false);
    ((XYPlot) (chart.getPlot())).setRangeGridlinesVisible(false);
    ((XYPlot) (chart.getPlot())).setDomainGridlinePaint(new Color(200, 200, 200));
    ((XYPlot) (chart.getPlot())).setRangeGridlinePaint(new Color(200, 200, 200));

    xLabel = new PropertyField() {
        public String newValue(String newValue) {
            setXAxisLabel(newValue);/*from www.j av a 2s. c o m*/
            getChartPanel().repaint();
            return newValue;
        }
    };
    xLabel.setValue(getXAxisLabel());

    list.add(new JLabel("X Label"), xLabel);

    yLabel = new PropertyField() {
        public String newValue(String newValue) {
            setYAxisLabel(newValue);
            getChartPanel().repaint();
            return newValue;
        }
    };
    yLabel.setValue(getYAxisLabel());

    list.add(new JLabel("Y Label"), yLabel);

    xLog = new JCheckBox();
    xLog.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (xLog.isSelected()) {
                LogarithmicAxis logAxis = new LogarithmicAxis(xLabel.getValue());
                logAxis.setStrictValuesFlag(false);
                chart.getXYPlot().setDomainAxis(logAxis);
            } else
                chart.getXYPlot().setDomainAxis(new NumberAxis(xLabel.getValue()));
        }
    });

    yLog = new JCheckBox();
    yLog.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (yLog.isSelected()) {
                LogarithmicAxis logAxis = new LogarithmicAxis(yLabel.getValue());
                logAxis.setStrictValuesFlag(false);
                chart.getXYPlot().setRangeAxis(logAxis);
            } else
                chart.getXYPlot().setRangeAxis(new NumberAxis(yLabel.getValue()));
        }
    });

    Box box = Box.createHorizontalBox();
    box.add(new JLabel("X"));
    box.add(xLog);
    box.add(new JLabel(" Y"));
    box.add(yLog);
    box.add(Box.createGlue());
    list.add(new JLabel("Log Axis"), box);

    final JCheckBox xgridlines = new JCheckBox();
    xgridlines.setSelected(false);
    ItemListener il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                chart.getXYPlot().setDomainGridlinesVisible(true);
            } else {
                chart.getXYPlot().setDomainGridlinesVisible(false);
            }
        }
    };
    xgridlines.addItemListener(il);

    final JCheckBox ygridlines = new JCheckBox();
    ygridlines.setSelected(false);
    il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                chart.getXYPlot().setRangeGridlinesVisible(true);
            } else {
                chart.getXYPlot().setRangeGridlinesVisible(false);
            }
        }
    };
    ygridlines.addItemListener(il);

    box = Box.createHorizontalBox();
    box.add(new JLabel("X"));
    box.add(xgridlines);
    box.add(new JLabel(" Y"));
    box.add(ygridlines);
    box.add(Box.createGlue());
    list.add(new JLabel("Grid Lines"), box);
}

From source file:net.schweerelos.parrot.CombinedParrotApp.java

private void initGUI(Properties properties) {
    try {//  w w w . j a  v a  2  s. c  om
        this.setTitle(APP_TITLE);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                for (MainViewComponent mainViewComponent : mainViews) {
                    if (mainViewComponent instanceof ParrotStateListener) {
                        ((ParrotStateListener) mainViewComponent).parrotExiting();
                    }
                }
            }
        });
        setSize(920, 690);

        getContentPane().setLayout(new BorderLayout());

        UserInterfaceManager uiManager = new UserInterfaceManager(properties);
        navigators = new ArrayList<NavigatorComponent>(4);

        // main view
        listView = uiManager.createMainViewComponent(Style.TABLE);
        graphView = uiManager.createMainViewComponent(Style.GRAPH);
        mainViews.add(listView);
        mainViews.add(graphView);

        final JTabbedPane mainPanel = new JTabbedPane();
        mainPanel.add(graphView.getTitle(), graphView.asJComponent());
        mainPanel.add(listView.getTitle(), listView.asJComponent());

        mainPanel.setSelectedIndex(0);
        activeMainView = graphView;
        mainPanel.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                if (e.getSource() != mainPanel) {
                    return;
                }
                int selectedIndex = mainPanel.getSelectedIndex();
                if (selectedIndex == 0) {
                    activeMainView = graphView;
                } else if (selectedIndex == 1) {
                    activeMainView = listView;
                } else {
                    Logger logger = Logger.getLogger(CombinedParrotApp.class);
                    logger.warn("unknown tab index selected: " + selectedIndex);
                }
            }
        });

        add(mainPanel, BorderLayout.CENTER);

        // navigators
        JToolBar navigatorsBar = new JToolBar(JToolBar.HORIZONTAL);
        navigatorsBar.setMargin(new Insets(0, 11, 0, 0));
        navigatorsBar.setFloatable(false);
        getContentPane().add(navigatorsBar, BorderLayout.PAGE_START);

        // timeline
        NavigatorComponent timelineNavigator = uiManager.createTimelineNavigationComponent();
        navigators.add(timelineNavigator);

        JFrame timelineFrame = new JFrame(timelineNavigator.getNavigatorName() + "  " + APP_TITLE);

        timelineFrame.getContentPane().add(timelineNavigator.asJComponent());
        timelineFrame.pack();
        Point preferredLocation = new Point(0, 0);
        preferredFrameLocations.put(timelineFrame, preferredLocation);

        if (timelineNavigator.hasShowHideListener()) {
            timelineFrame.addComponentListener(timelineNavigator.getShowHideListener());
        }
        timelineFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

        JToggleButton timelineButton = setupNavigatorButton(timelineNavigator.getNavigatorName(),
                timelineNavigator.getAcceleratorKey(), timelineNavigator);
        navigatorsBar.add(timelineButton);

        // map      
        NavigatorComponent mapNavigator = uiManager.createMapNavigationComponent();
        navigators.add(mapNavigator);

        JFrame mapFrame = new JFrame(mapNavigator.getNavigatorName() + "  " + APP_TITLE);

        mapFrame.getContentPane().add(mapNavigator.asJComponent());
        mapFrame.pack();
        preferredLocation = new Point(0,
                Toolkit.getDefaultToolkit().getScreenSize().height - mapFrame.getHeight());
        preferredFrameLocations.put(mapFrame, preferredLocation);

        if (mapNavigator.hasShowHideListener()) {
            mapFrame.addComponentListener(mapNavigator.getShowHideListener());
        }
        mapFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

        JToggleButton mapButton = setupNavigatorButton(mapNavigator.getNavigatorName(),
                mapNavigator.getAcceleratorKey(), mapNavigator);
        navigatorsBar.add(mapButton);

        // search      
        NavigatorComponent searchNavigator = uiManager.createSearchComponent();
        navigators.add(searchNavigator);

        JFrame searchFrame = new JFrame(searchNavigator.getNavigatorName() + "  " + APP_TITLE);

        searchFrame.getContentPane().add(searchNavigator.asJComponent());
        searchFrame.pack();
        preferredLocation = new Point(
                Toolkit.getDefaultToolkit().getScreenSize().width - searchFrame.getWidth(), 0);
        preferredFrameLocations.put(searchFrame, preferredLocation);

        if (searchNavigator.hasShowHideListener()) {
            searchFrame.addComponentListener(searchNavigator.getShowHideListener());
        }
        searchFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

        JToggleButton searchButton = setupNavigatorButton(searchNavigator.getNavigatorName(),
                searchNavigator.getAcceleratorKey(), searchNavigator);
        navigatorsBar.add(searchButton);

        // connections
        NavigatorComponent chainNavigator = uiManager.createChainNavigationComponent();
        navigators.add(chainNavigator);

        if (chainNavigator instanceof PickListener) {
            for (MainViewComponent mainViewComponent : mainViews) {
                mainViewComponent.addPickListener((PickListener) chainNavigator);
            }
        }

        if (chainNavigator.hasShowHideListener()) {
            chainNavigator.asJComponent().addComponentListener(chainNavigator.getShowHideListener());
        }

        JToggleButton connectionsButton = setupNavigatorButton(chainNavigator.getNavigatorName(),
                chainNavigator.getAcceleratorKey(), chainNavigator);
        navigatorsBar.add(connectionsButton);

        add(chainNavigator.asJComponent(), BorderLayout.PAGE_END);
        chainNavigator.asJComponent().setVisible(false);
    } catch (RuntimeException e) {
        e.printStackTrace(System.err);
        System.exit(1);
    } catch (UnknownStyleException e) {
        e.printStackTrace(System.err);
        System.exit(1);
    }
}

From source file:net.sf.jclal.gui.view.components.chart.ExternalBasicChart.java

/**
 *
 * @param windowsTitleParam The title of the window.
 * @param chartTitleParam The title of the chart panel.
 * @param xTitleParam The X-axis label.//  w  ww. j  ava 2  s  . c om
 */
public ExternalBasicChart(String windowsTitleParam, String chartTitleParam, String xTitleParam) {

    reportFrecuency = 1;

    menubar = new JMenuBar();
    menubar.add(createMenu());

    max = -1;

    windowsTitle = windowsTitleParam;
    chartTitle = chartTitleParam;
    xTitle = xTitleParam;

    queryNames = new ArrayList<String>();
    evaluationsCollection = new ArrayList<List<AbstractEvaluation>>();
    controlCurveColor = new HashMap<String, Color>();
    set = new HashSet<Integer>();
    setSeries = new HashSet<String>();
    colors = new ArrayList<Color>();

    chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(640, 480));
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseWheelEnabled(true);

    slider = new JSlider(JSlider.HORIZONTAL);
    slider.setPaintTicks(true);
    slider.setPaintLabels(true);
    slider.setToolTipText("Changes the report frecuency");
    slider.setSnapToTicks(true);
    slider.setMinimum(1);
    slider.setMinorTickSpacing(1);

    slider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(javax.swing.event.ChangeEvent evt) {

            reportFrecuency = ((JSlider) evt.getSource()).getValue();

            slider.setToolTipText(String.valueOf(reportFrecuency));

            jComboBoxItemStateChanged();
        }
    });

    comboBox = new JComboBox<String>();

    comboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent evt) {

            jComboBoxItemStateChanged();
        }
    });

    content = new JPanel(new BorderLayout());
    content.add(comboBox, BorderLayout.NORTH);
    content.add(chartPanel, BorderLayout.CENTER);
    content.add(slider, BorderLayout.SOUTH);

    setJMenuBar(menubar);
    setTitle(windowsTitle);
    setContentPane(this.content);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

}

From source file:de.tbuchloh.kiskis.gui.SecuredElementView.java

private void createNeverBox() {
    _neverBox = new JCheckBox(M.getString("never_label")); //$NON-NLS-1$
    _neverBox.setToolTipText(M.getString("never_tt")); //$NON-NLS-1$
    _neverBox.addChangeListener(new ChangeListener() {
        @Override/* ww  w .  j ava 2  s .  c o  m*/
        public void stateChanged(final ChangeEvent e) {
            _dateField.setEnabled(!_neverBox.isSelected());
            fireContentChangedEvent(true);
        }
    });
    _neverBox.setSelected(_element.expiresNever());
}