Example usage for javax.swing.event ChangeEvent getSource

List of usage examples for javax.swing.event ChangeEvent getSource

Introduction

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

Prototype

public Object getSource() 

Source Link

Document

The object on which the Event initially occurred.

Usage

From source file:com.alvermont.terraj.fracplanet.ui.AbstractTerrainViewerFrame.java

private void tiltSliderStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_tiltSliderStateChanged
{//GEN-HEADEREND:event_tiltSliderStateChanged

    final JSlider source = (JSlider) evt.getSource();

    if (!source.getValueIsAdjusting()) {
        final float value = source.getValue();

        log.debug("Tilt slider set to: " + value);

        display.setObjectTilt(-value);//from ww  w. j  a v a  2  s . co m
    }
}

From source file:com.mirth.connect.client.ui.DashboardPanel.java

public DashboardPanel() {
    this.parent = PlatformUI.MIRTH_FRAME;

    haltableStates.add(DeployedState.DEPLOYING);
    haltableStates.add(DeployedState.UNDEPLOYING);
    haltableStates.add(DeployedState.STARTING);
    haltableStates.add(DeployedState.STOPPING);
    haltableStates.add(DeployedState.PAUSING);
    haltableStates.add(DeployedState.SYNCING);
    haltableStates.add(DeployedState.UNKNOWN);

    initComponents();/*from  w ww.j  av  a2  s . c  o  m*/
    initLayout();

    loadTabPlugins();
    ChangeListener changeListener = new ChangeListener() {

        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
            int index = sourceTabbedPane.getSelectedIndex();

            if (LoadedExtensions.getInstance().getDashboardTabPlugins().size() > 0) {
                loadPanelPlugin(LoadedExtensions.getInstance().getDashboardTabPlugins()
                        .get(sourceTabbedPane.getTitleAt(index)));
            }
        }
    };
    tabPane.addChangeListener(changeListener);

    defaultVisibleColumns = new LinkedHashSet<String>();

    makeStatusTable();
    loadTablePlugins();

    this.setDoubleBuffered(true);

    DashboardTreeTableModel model = (DashboardTreeTableModel) dashboardTable.getTreeTableModel();

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("channelGroupViewEnabled", true)) {
        tableModeGroupsButton.setSelected(true);
        tableModeGroupsButton.setContentFilled(true);
        tableModeChannelsButton.setContentFilled(false);
        model.setGroupModeEnabled(true);
    } else {
        tableModeChannelsButton.setSelected(true);
        tableModeChannelsButton.setContentFilled(true);
        tableModeGroupsButton.setContentFilled(false);
        model.setGroupModeEnabled(false);
    }
}

From source file:com.emental.mindraider.ui.outline.OutlineJPanel.java

/**
 * Creates notebook outline.//w w w .ja va  2s  .co  m
 */
private OutlineJPanel() {
    setDoubleBuffered(true);
    setLayout(new BorderLayout());

    /*
     * toolbar
     */

    JToolBar toolbar = createToolbar();

    /*
     * tree
     */

    // tree table itself
    outlineTableTree = OutlineTreeInstance.getInstance();
    outlineTableTreeModel = new NotebookOutlineModel(outlineTableTree.getOutlineRoot());
    treeTable = new JTreeTable(outlineTableTreeModel);
    treeTable.tree.addTreeSelectionListener(new TreeSelectionListenerImplementation());
    // add key listener
    treeTable.addKeyListener(new KeyListenerImplementation());

    // label column
    TableColumn tableColumn = treeTable
            .getColumn(NotebookOutlineModel.columnNames[NotebookOutlineModel.COLUMN_LABEL]);
    tableColumn.setMaxWidth(LABEL_COLUMN_MAX_WIDTH);
    tableColumn.setMinWidth(0);
    tableColumn.setPreferredWidth(LABEL_COLUMN_PREFERRED_WIDTH);
    // date column
    tableColumn = treeTable.getColumn(NotebookOutlineModel.columnNames[NotebookOutlineModel.COLUMN_CREATED]);
    tableColumn.setMaxWidth(DATE_COLUMN_MAX_WIDTH);
    tableColumn.setMinWidth(0);
    tableColumn.setPreferredWidth(DATE_COLUMN_PREFERRED_WIDTH);
    // and the rest will be annotation
    JScrollPane treeTableScrollPane = new JScrollPane(treeTable);

    // outline treetabble + toolbar panel
    JPanel treeAndToolbarPanel = new JPanel(new BorderLayout());
    treeAndToolbarPanel.add(toolbar, BorderLayout.NORTH);
    treeAndToolbarPanel.add(treeTableScrollPane, BorderLayout.CENTER);

    /*
     * outline / list tabbed pane
     */

    outlineAndTreeTabbedPane = new JTabbedPane(JTabbedPane.BOTTOM);
    outlineAndTreeTabbedPane.add(treeAndToolbarPanel, "Outline");
    outlineSorterJPanel = new OutlineSorterJPanel();
    outlineAndTreeTabbedPane.add(outlineSorterJPanel, "Sorter");
    outlineArchiveJPanel = new OutlineArchiveJPanel();
    outlineAndTreeTabbedPane.add(outlineArchiveJPanel, "Archive");

    /*
     * concept sidebar
     */

    conceptJPanel = (ConceptJPanel) MindRaiderSpringContext.getCtx().getBean("conceptPanel");

    /*
     * vertical split of notebook outline and RDF graph
     */

    treeAndSpidersSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    treeAndSpidersSplit.setContinuousLayout(true);
    treeAndSpidersSplit.setOneTouchExpandable(true);
    treeAndSpidersSplit.setDividerLocation(200);
    treeAndSpidersSplit.setLastDividerLocation(150);
    treeAndSpidersSplit.setDividerSize(6);
    treeAndSpidersSplit.add(outlineAndTreeTabbedPane);

    // spiders & tags visual navigation
    spidersAndTagsTabs = new JTabbedPane(JTabbedPane.BOTTOM);
    if (MindRaider.profile.isEnableSpiders()) {
        // notebook mind map
        spidersAndTagsTabs.addTab("Mind Map", MindRaider.spidersGraph.getPanel()); // TODO bundle
    }
    // global tags
    spidersAndTagsTabs.addTab("Tag Cloud", MindRaider.tagCustodian.getPanel()); // TODO bundle
    // global mind map
    //spidersAndTagsTabs.addTab("Global Mind Map",new JPanel()); // TODO bundle

    // lazy spiders rendering
    spidersAndTagsTabs.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
            if (sourceTabbedPane.getSelectedIndex() == 0) {
                MindRaider.spidersGraph.renderModel();
            }
        }
    });

    if (!new ConfigurationBean().isDefaultTabMindMap()) {
        spidersAndTagsTabs.setSelectedIndex(1);
    }

    MindRaider.tagCustodian.redraw();

    // add spiders panel
    treeAndSpidersSplit.add(spidersAndTagsTabs);

    /*
     * horizontal split of outline/graph slit and concept sidebar
     */

    rightSiderbarSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeAndSpidersSplit, conceptJPanel);
    rightSiderbarSplitPane.setOneTouchExpandable(true);
    rightSiderbarSplitPane.setContinuousLayout(true);
    rightSiderbarSplitPane.setDividerLocation(500);
    rightSiderbarSplitPane.setLastDividerLocation(500);
    rightSiderbarSplitPane.setDividerSize(6);

    add(rightSiderbarSplitPane);
}

From source file:oct.analysis.application.OCTAnalysisUI.java

private void lrpSmoothingSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_lrpSmoothingSliderStateChanged
    //update smoothing factor for LRPs
    int value = ((JSlider) evt.getSource()).getValue();
    value = (value == 0) ? 1 : value; //can't have a value of zero for smoothing
    selectionLRPManager.setLrpSmoothingFactor(value);
    //update LRPs to use new smoothing factor
    selectionLRPManager.updateLRPs();/*from w w  w  . j  av  a  2s.co  m*/
}

From source file:oct.analysis.application.OCTAnalysisUI.java

private void octSmoothingSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_octSmoothingSliderStateChanged
    SwingUtilities.invokeLater(() -> {
        //update smoothing factor for OCT
        double value = (double) ((JSlider) evt.getSource()).getValue() * 0.1D;
        BlurOperation blurOp = new BlurOperation(value);
        ImageOperationManager.getInstance().updateBlurOperation(blurOp);
        //redraw OCT use new smoothing factor
        octAnalysisPanel.repaint();//from  ww w  .  j a v  a2  s . c  om
        //redraw LRPs to update with new information
        selectionLRPManager.updateLRPs();
    });
}

From source file:oct.analysis.application.OCTAnalysisUI.java

private void octSharpWeightSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_octSharpWeightSliderStateChanged
    SwingUtilities.invokeLater(() -> {
        //update weight of sharpen filter for the OCT 
        float value = ((JSlider) evt.getSource()).getValue() * 0.01f;
        SharpenOperation sharpOp = new SharpenOperation(((double) octSharpRadiusSlider.getValue()) * 0.1D,
                value);/*w w w  .  j a va 2  s .c  o m*/
        ImageOperationManager.getInstance().updateSharpenOperation(sharpOp);
        //redraw OCT use new sharpen weight
        octAnalysisPanel.repaint();
        //redraw LRPs to update with new information
        selectionLRPManager.updateLRPs();
    });
}

From source file:oct.analysis.application.OCTAnalysisUI.java

private void octSharpRadiusSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_octSharpRadiusSliderStateChanged
    SwingUtilities.invokeLater(() -> {
        //update weight of sharpen filter for the OCT 
        double value = (double) ((JSlider) evt.getSource()).getValue() * 0.1D;
        SharpenOperation sharpOp = new SharpenOperation(value,
                ((float) octSharpWeightSlider.getValue()) * 0.01F);
        ImageOperationManager.getInstance().updateSharpenOperation(sharpOp);
        //redraw OCT use new sharpen weight
        octAnalysisPanel.repaint();//from  w  w w . j ava2  s  .  c om
        //redraw LRPs to update with new information
        selectionLRPManager.updateLRPs();
    });
}

From source file:com.emental.mindraider.ui.frames.MindRaiderMainWindow.java

private MindRaiderMainWindow() {
    super(MindRaider.getTitle(), Gfx.getGraphicsConfiguration());
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);/*from www  .jav a 2  s . c om*/
        }
    });
    // catch resize
    addComponentListener(this);

    configuration = new ConfigurationBean();

    // drag & drop registration
    DropTarget dropTarget = new DropTarget(this, (DropTargetListener) this);
    this.setDropTarget(dropTarget);

    // warn on different java version
    // checkJavaVersion();

    singleton = this;

    setIconImage(IconsRegistry.getImage("programIcon.gif"));
    SplashScreen splash = new SplashScreen(this, false);
    splash.showSplashScreen();

    // kernel init
    MindRaider.preSetProfiles();
    // message in here because of locales
    logger.debug(Messages.getString("MindRaiderJFrame.bootingKernel"));

    // master control panel
    MindRaider.setMasterToolBar(new MasterToolBar());
    getContentPane().add(MindRaider.masterToolBar, BorderLayout.NORTH);

    // status bar
    getContentPane().add(StatusBar.getStatusBar(), BorderLayout.SOUTH);

    // build menu
    buildMenu(MindRaider.spidersGraph);
    // profile
    MindRaider.setProfiles();

    // left sidebar: folder/notebooks hierarchy, taxonomies, ...
    final JTabbedPane leftSidebar = new JTabbedPane(SwingConstants.BOTTOM);
    leftSidebar.setTabPlacement(SwingConstants.TOP);
    // TODO add icons to tabs
    leftSidebar.addTab(Messages.getString("MindRaiderJFrame.explorer"), ExplorerJPanel.getInstance());

    // TODO just blank panel
    //leftSidebar.addTab("Tags",new OutlookBarMain());

    leftSidebar.addTab(
            Messages.getString("MindRaiderJFrame.trash"), /* IconsRegistry.getImageIcon("trashFull.png"), */
            TrashJPanel.getInstance());

    leftSidebar.setSelectedIndex(0);
    leftSidebar.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent arg0) {
            if (arg0.getSource() instanceof JTabbedPane) {
                if (leftSidebar.getSelectedIndex() == 1) {
                    // refresh trash
                    TrashJPanel.getInstance().refresh();
                }
            }
        }
    });

    // main panel: (notebook outline & RDF Navigator) + Control panel
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(OutlineJPanel.getInstance(), BorderLayout.CENTER);

    // split: left sidebar/main panel
    leftSidebarSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSidebar, mainPanel);
    leftSidebarSplitPane.setOneTouchExpandable(true);
    leftSidebarSplitPane.setDividerLocation(200);
    leftSidebarSplitPane.setLastDividerLocation(200);
    leftSidebarSplitPane.setDividerSize(6);
    leftSidebarSplitPane.setContinuousLayout(true);
    getContentPane().add(leftSidebarSplitPane, BorderLayout.CENTER);

    Gfx.centerAndShowWindow(this, 1024, 768);

    MindRaider.postSetProfiles();

    if (!configuration.isShowSpidersTagSnailPane()) {
        OutlineJPanel.getInstance().hideSpiders();
    }

    splash.hideSplash();
}

From source file:javazoom.jlgui.player.amp.PlayerUI.java

public void stateChanged(ChangeEvent e) {
    Object src = e.getSource();
    //log.debug("State (EDT=" + SwingUtilities.isEventDispatchThread() + ")");
    // Volume/* ww w  . ja  va  2  s  . co  m*/
    if (src == ui.getAcVolume()) {
        Object[] args = { String.valueOf(ui.getAcVolume().getValue()) };
        String volumeText = MessageFormat.format(ui.getResource("slider.volume.text"), args);
        ui.getAcTitleLabel().setAcText(volumeText);
        try {
            int gainValue = ui.getAcVolume().getValue();
            int maxGain = ui.getAcVolume().getMaximum();
            if (gainValue == 0)
                theSoundPlayer.setGain(0);
            else
                theSoundPlayer.setGain(((double) gainValue / (double) maxGain));
            config.setVolume(gainValue);
        } catch (BasicPlayerException ex) {
            log.debug("Cannot set gain", ex);
        }
    }
    // Balance
    else if (src == ui.getAcBalance()) {
        Object[] args = { String.valueOf(Math.abs(ui.getAcBalance().getValue() * 100 / Skin.BALANCEMAX)) };
        String balanceText = null;
        if (ui.getAcBalance().getValue() > 0) {
            balanceText = MessageFormat.format(ui.getResource("slider.balance.text.right"), args);
        } else if (ui.getAcBalance().getValue() < 0) {
            balanceText = MessageFormat.format(ui.getResource("slider.balance.text.left"), args);
        } else {
            balanceText = MessageFormat.format(ui.getResource("slider.balance.text.center"), args);
        }
        ui.getAcTitleLabel().setAcText(balanceText);
        try {
            float balanceValue = ui.getAcBalance().getValue() * 1.0f / Skin.BALANCEMAX;
            theSoundPlayer.setPan(balanceValue);
        } catch (BasicPlayerException ex) {
            log.debug("Cannot set pan", ex);
        }
    } else if (src == ui.getAcPosBar()) {
        if (ui.getAcPosBar().getValueIsAdjusting() == false) {
            if (posDragging == true) {
                posDragging = false;
                posValue = ui.getAcPosBar().getValue() * 1.0 / Skin.POSBARMAX;
                processSeek(posValue);
            }
        } else {
            posDragging = true;
            posValueJump = true;
        }
    }
}

From source file:edu.ku.brc.specify.dbsupport.cleanuptools.GeographyAssignISOs.java

/**
 * @return/*from ww  w . j ava  2 s  .c o m*/
 */
@SuppressWarnings("rawtypes")
public boolean buildAsync(final int earthID) {
    this.earthId = earthID;

    if (processingPhase == ProcessingState.eInitialPass) {
        processingPhase = ProcessingState.eAllCountriesPass;
        doAllCountries = new boolean[] { true, false, false, false };
        doInvCountry = new boolean[] { false, false, false, false };
        doIndvCountryId = null;

        // Check to see if it needs indexing.
        boolean shouldIndex = luceneSearch.shouldIndex();

        if (shouldIndex) {
            frame = new ProgressFrame("Building Geography Authority..."); // I18N
            frame.getCloseBtn().setVisible(false);
            frame.turnOffOverAll();
            frame.setDesc("Loading Geonames data..."); // I18N
            frame.pack();
            frame.setSize(450, frame.getBounds().height + 10);
            UIHelper.centerAndShow(frame, 450, frame.getBounds().height + 10);

            luceneSearch.startIndexingProcessAsync(earthId, frame, new ChangeListener() {
                @Override
                public void stateChanged(ChangeEvent e) {
                    frame.setVisible(false);
                    frame = null;
                    if (((Boolean) e.getSource())) {
                        GeographyAssignISOs.this.startTraversal();
                    }
                }
            });

        } else {
            String sql = "SELECT Name, geonameId, iso_alpha2 FROM countryinfo";
            for (Object[] row : query(sql)) {
                countryInfo.add(new GeoSearchResultsItem((String) row[0], (Integer) row[1], (String) row[2]));
            }
            startTraversal();
        }
    } else {
        if (processingPhase == ProcessingState.eStartIndvCountryPass) {
            String sql = "SELECT GeographyID FROM geography WHERE GeographyCode = 'US'";
            for (Integer recId : queryForInts(sql)) {
                usaIds.add(recId);
            }
            processingPhase = ProcessingState.eIndvCountryPass;
        }

        if (usaIds.size() > 0) {
            doAllCountries = new boolean[] { true, false, false, false };
            doInvCountry = new boolean[] { true, true, false, false };
            doIndvCountryId = usaIds.get(0);
            usaIds.remove(0);
            startTraversal();
        } else {
            processingPhase = ProcessingState.eProcessingDone;
            shutdown();
        }
    }

    return true;
}