Java Code Examples for javax.swing.event.ChangeListener

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project SPREAD, under directory /src/colorpicker/swing/.

Source file: ColorPickerPanel.java

  22 
vote

protected void fireChangeListeners(){
  if (changeListeners == null)   return;
  for (int a=0; a < changeListeners.size(); a++) {
    ChangeListener l=(ChangeListener)changeListeners.get(a);
    try {
      l.stateChanged(new ChangeEvent(this));
    }
 catch (    RuntimeException e) {
      e.printStackTrace();
    }
  }
}
 

Example 2

From project SwingOSC, under directory /src/main/java/de/sciss/swingosc/.

Source file: NumberField.java

  22 
vote

private void fireChange(){
  final ChangeEvent e=new ChangeEvent(this);
  for (int i=0; i < collChangeListeners.size(); i++) {
    final ChangeListener l=(ChangeListener)collChangeListeners.get(i);
    l.stateChanged(e);
  }
}
 

Example 3

From project tomighty, under directory /tomighty-swing/src/main/java/org/tomighty/ui/swing/.

Source file: CheckableFileField.java

  22 
vote

public CheckableFileField(){
  setLayout(new BorderLayout());
  JPanel south=new JPanel(new BorderLayout());
  south.add(filenameField=new JTextField(),CENTER);
  south.add(defaultButton=new JButton(),EAST);
  add(checkBox=new JCheckBox(),NORTH);
  add(south);
  filenameField.setEditable(false);
  filenameField.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  filenameField.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (e.getButton() == MouseEvent.BUTTON1 && filenameField.isEnabled()) {
        chooseFile();
      }
    }
  }
);
  checkBox.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      updateFileSelectionState();
    }
  }
);
  defaultButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      file(null);
    }
  }
);
  updateFileSelectionState();
  file(null);
}
 

Example 4

From project ceres, under directory /ceres-glayer/src/main/java/com/bc/ceres/glayer/swing/.

Source file: AdjustableViewScrollPane.java

  21 
vote

/** 
 * Constructs a new view pane with the given view viewComponent
 * @param viewComponent the view viewComponent. If not null, it must implement {@link AdjustableView}.
 */
public AdjustableViewScrollPane(JComponent viewComponent){
  super(null);
  Assert.notNull(viewComponent,"viewComponent");
  Assert.argument(viewComponent instanceof AdjustableView,"viewComponent");
  scrollArea=new Rectangle2D.Double();
  viewportChangeHandler=new ViewportChangeHandler();
  setViewComponent(viewComponent);
  setCornerComponent(createCornerComponent());
  final ChangeListener scrollBarCH=new ScrollBarChangeHandler();
  horizontalScrollBar=createHorizontalScrollbar();
  horizontalScrollBar.getModel().addChangeListener(scrollBarCH);
  verticalScrollBar=createVerticalScrollBar();
  verticalScrollBar.getModel().addChangeListener(scrollBarCH);
  addComponentListener(new ResizeHandler());
}
 

Example 5

From project Cinch, under directory /src/com/palantir/ptoss/cinch/swing/.

Source file: JSliderWiringHarness.java

  21 
vote

public static Binding bindJSlider(final Mutator mutator,final JSlider slider){
  final ChangeListener changeListener=new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      try {
        if (!slider.getValueIsAdjusting()) {
          mutator.set(slider.getValue());
        }
      }
 catch (      Exception ex) {
        Wiring.logger.error("exception in JSlider binding",ex);
      }
    }
  }
;
  slider.addChangeListener(changeListener);
  Binding binding=new Binding(){
    public <T extends Enum<?> & ModelUpdate>void update(    T... changed){
      try {
        Integer val=(Integer)mutator.get();
        if (val == null) {
          val=-1;
        }
        if (!val.equals(slider.getValue())) {
          slider.removeChangeListener(changeListener);
          slider.setValue(val);
          slider.addChangeListener(changeListener);
        }
      }
 catch (      Exception ex) {
        Wiring.logger.error("exception in JSlider binding",ex);
      }
    }
  }
;
  mutator.getModel().bind(binding);
  return binding;
}
 

Example 6

From project CommunityCase, under directory /src/org/community/intellij/plugins/communitycase/update/.

Source file: UpdateOptionsPanel.java

  21 
vote

/** 
 * The constructor
 */
public UpdateOptionsPanel(){
  myForceRebaseRadioButton.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      boolean keepPossible=!myForceRebaseRadioButton.isSelected();
      if (!keepPossible && myKeepRadioButton.isSelected()) {
        myStashRadioButton.setSelected(true);
      }
      myKeepRadioButton.setEnabled(keepPossible);
    }
  }
);
}
 

Example 7

From project FBReaderJ, under directory /obsolete/swing/src/org/geometerplus/zlibrary/ui/swing/dialogs/.

Source file: ZLBooleanOptionView.java

  21 
vote

protected void createItem(){
  final ZLBooleanOptionEntry booleanEntry=(ZLBooleanOptionEntry)myOption;
  myCheckBox=new JCheckBox(myName);
  myCheckBox.setSelected(booleanEntry.initialState());
  myCheckBox.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      booleanEntry.onStateChanged(myCheckBox.isSelected());
    }
  }
);
  myTab.insertWidget(myCheckBox);
}
 

Example 8

From project freemind, under directory /freemind/freemind/common/.

Source file: NumberProperty.java

  21 
vote

/** 
 */
public NumberProperty(String description,String label,int min,int max,int step){
  this.min=min;
  this.max=max;
  this.step=step;
  spinner=new JSpinner(new SpinnerNumberModel(min,min,max,step));
  this.description=description;
  this.label=label;
  spinner.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent pE){
      firePropertyChangeEvent();
    }
  }
);
}
 

Example 9

From project GenericKnimeNodes, under directory /com.genericworkflownodes.knime.base_plugin/src/com/genericworkflownodes/knime/nodes/io/listimporter/.

Source file: DialogComponentMultiFileChooser.java

  21 
vote

/** 
 * Transfers values from the  {@link SettingsModelStringArray} into theunderlying model.
 * @param model The data model.
 */
public FileListModel(final SettingsModelStringArray model){
  files=new ArrayList<File>();
  updateFromSettingsModel(model);
  model.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    final ChangeEvent event){
      if (event.getSource() instanceof SettingsModelStringArray) {
        SettingsModelStringArray eventSource=(SettingsModelStringArray)event.getSource();
        updateFromSettingsModel(eventSource);
      }
    }
  }
);
}
 

Example 10

From project GraphLab, under directory /src/graphlab/graph/ui/.

Source file: GTabbedGraphPane.java

  21 
vote

public GTabbedGraphPane(BlackBoard b){
  super(b);
  jtp.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      reTab();
    }
  }
);
  b.setData(GTabbedGraphPane.NAME,this);
}
 

Example 11

From project imageflow, under directory /src/de/danielsenff/imageflow/gui/.

Source file: UnitPropertiesDialog.java

  21 
vote

private void addDisplaySilentCheckbox(final UnitElement unit){
  JCheckBox chkDisplay=new JCheckBox("Display result silently");
  chkDisplay.setToolTipText("After the workflow has been executed, nodes that are set to 'display' are displayed as a result.");
  chkDisplay.setSelected(unit.isDisplaySilent());
  chkDisplay.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent event){
      boolean newValue=((JCheckBox)event.getSource()).isSelected();
      unit.setDisplaySilent(newValue);
    }
  }
);
  addForm("",chkDisplay);
}
 

Example 12

From project jMemorize, under directory /src/jmemorize/gui/swing/panels/.

Source file: LearnSettingPanels.java

  21 
vote

private void addScheduleRow(PanelBuilder builder,CellConstraints cc,int level){
  ChangeListener listener=new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      spinnerValueChanged();
    }
  }
;
  m_scheduleDays[level].addChangeListener(listener);
  m_scheduleHours[level].addChangeListener(listener);
  m_scheduleMinutes[level].addChangeListener(listener);
  String deckLabel=MessageFormat.format(Localization.get(LC.LEARN_SETTINGS_DELAY),level);
  builder.addLabel(deckLabel,cc.xy(1,3 + 2 * level));
  builder.add(m_scheduleDays[level],cc.xy(3,3 + 2 * level));
  builder.addLabel(Localization.get(LC.LEARN_SETTINGS_DAYS),cc.xy(5,3 + 2 * level));
  builder.add(m_scheduleHours[level],cc.xy(7,3 + 2 * level));
  builder.addLabel(Localization.get(LC.LEARN_SETTINGS_HOURS),cc.xy(9,3 + 2 * level));
  builder.add(m_scheduleMinutes[level],cc.xy(11,3 + 2 * level));
  builder.addLabel(Localization.get(LC.LEARN_SETTINGS_MINUTES),cc.xy(13,3 + 2 * level));
}
 

Example 13

From project jsmaa, under directory /gui/src/main/java/fi/smaa/jsmaa/gui/components/.

Source file: LambdaPanel.java

  21 
vote

private void initComponents(){
  lambdaSlider=new RangeSlider(50,100,(int)(model.getLambda().getStart() * 100.0),(int)(model.getLambda().getEnd() * 100.0));
  lambdaSlider.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      fireLambdaSliderChanged();
    }
  }
);
  lambdaRangeLabel=new JLabel();
  add(lambdaSlider,BorderLayout.CENTER);
  add(new JLabel("Lambda range"),BorderLayout.NORTH);
  add(lambdaRangeLabel,BorderLayout.SOUTH);
}
 

Example 14

From project parasim, under directory /extensions/visualisation-plot-impl/src/main/java/org/sybila/parasim/visualisation/plot/impl/gui/.

Source file: ProjectionPlotter.java

  21 
vote

private void initSliders(){
  sliders=new JPanel();
  sliders.setLayout(new BoxLayout(sliders,BoxLayout.LINE_AXIS));
  sliders.setBorder(new EmptyBorder(PADDING));
  ChangeListener changed=new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent ce){
      updateView();
    }
  }
;
  axisSliders=new AxisSlider[dimension];
  for (int i=0; i < dimension; i++) {
    axisSliders[i]=new AxisSlider(names.getName(i),changed,extent.getMinBounds().getValue(i),extent.getMaxBounds().getValue(i));
    sliders.add(axisSliders[i]);
  }
  axisSliders[0].setActive(false);
  axisSliders[1].setActive(false);
  add(sliders,BorderLayout.LINE_END);
}
 

Example 15

From project pomodoro-tm, under directory /src/ru/greeneyes/project/pomidoro/settings/.

Source file: SettingsPresenter.java

  21 
vote

private void setupUIBindings(){
  final ActionListener actionListener=new ActionListener(){
    @Override public void actionPerformed(    ActionEvent event){
      updateUIModel();
      updateUI();
    }
  }
;
  ChangeListener changeListener=new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      actionListener.actionPerformed(null);
    }
  }
;
  settingsForm.pomodoroLengthComboBox.addActionListener(actionListener);
  settingsForm.breakLengthComboBox.addActionListener(actionListener);
  settingsForm.popupCheckBox.addChangeListener(changeListener);
  settingsForm.blockDuringBreak.addChangeListener(changeListener);
  settingsForm.ringVolumeSlider.addChangeListener(changeListener);
  settingsForm.showToolWindowCheckbox.addChangeListener(changeListener);
}
 

Example 16

From project QView, under directory /QView-suite/MQProject/src/org/qview/control/.

Source file: ExplorerTree.java

  21 
vote

protected void addNotify(){
  refreshList();
  PropertiesNotifier.addChangeListener(listener=new ChangeListener(){
    public void stateChanged(    ChangeEvent ev){
      refreshList();
    }
  }
);
}
 

Example 17

From project RegexTagForMusic, under directory /src/org/essembeh/rtfm/gui/panel/center/.

Source file: TabManager.java

  21 
vote

/** 
 * Constructor
 * @param controller
 */
public TabManager(final GuiController controller){
  this.listOfTabs=new ArrayList<Tab>();
  this.filterableTab=new FilterableTab(controller);
  createNewTab(filterableTab,Translator.get(StringId.tabAll));
  createNewTab(new Tab(controller,CommonFilters.filterOnAttribute("tagged","false")),Translator.get(StringId.tabNew));
  createNewTab(new Tab(controller,CommonFilters.filterOnType("UNKNOWN")),Translator.get(StringId.tabUnknown));
  addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      controller.updateAfterTabChange();
    }
  }
);
}
 

Example 18

From project skmclauncher, under directory /src/main/java/com/sk89q/mclauncher/.

Source file: OptionsPanel.java

  21 
vote

/** 
 * Build the "set" checkbox.
 * @param component component to control
 * @return checkbox
 */
private JCheckBox buildSetCheck(final Component component){
  final JCheckBox check=new JCheckBox("Set:");
  check.setBorder(null);
  check.setOpaque(false);
  check.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      component.setEnabled(check.isSelected());
    }
  }
);
  return check;
}
 

Example 19

From project TransFile, under directory /src/net/sourceforge/transfile/ui/swing/.

Source file: NetworkPanel.java

  21 
vote

/** 
 * TODO doc
 * @return <br>Not null <br>New
 */
private final PortSpinner createLocalPortSpinner(){
  final PortSpinner localPortSpinner=new PortSpinner();
  localPortSpinner.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      onUserActionChangeLocalPort();
    }
  }
);
  return localPortSpinner;
}
 

Example 20

From project treeGenerator, under directory /arbaro_1_9_8/src/net/sourceforge/arbaro/gui/.

Source file: TreePreview.java

  21 
vote

public TreePreview(PreviewTree prvTree,int perspect,Config config){
  super();
  this.config=config;
  setMinimumSize(new Dimension(100,100));
  setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
  setOpaque(true);
  setBackground(Color.WHITE);
  previewTree=prvTree;
  perspective=perspect;
  initRotation();
  previewTree.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      repaint();
    }
  }
);
}
 

Example 21

From project Valkyrie-RCP, under directory /valkyrie-rcp-core/src/main/java/org/valkyriercp/dialog/control/.

Source file: ExtTabbedPane.java

  21 
vote

public ExtTabbedPane(JTabbedPane tabbedPane){
  this.tabbedPane=tabbedPane;
  tabbedPane.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      changeListeners.fire("stateChanged",e);
    }
  }
);
}
 

Example 22

From project watchmaker, under directory /swing/src/java/main/org/uncommons/watchmaker/swing/.

Source file: NumericParameterControl.java

  21 
vote

public NumericParameterControl(T minimum,T maximum,T stepSize,T initialValue){
  this.defaultValue=initialValue;
  this.numberGenerator=new AdjustableNumberGenerator<T>(this.defaultValue);
  control=new JSpinner(new SpinnerNumberModel(initialValue,minimum,maximum,stepSize));
  control.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent changeEvent){
      @SuppressWarnings("unchecked") T value=(T)control.getValue();
      numberGenerator.setValue(value);
    }
  }
);
}
 

Example 23

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/corecomponents/.

Source file: DataContentViewerMedia.java

  20 
vote

private void customizeComponents(){
  Gst.init();
  progressSlider.addChangeListener(new ChangeListener(){
    /** 
 * Should always try to synchronize any call to progressSlider.setValue() to avoid a different thread changing playbin while stateChanged() is processing
 */
    @Override public void stateChanged(    ChangeEvent e){
      int time=progressSlider.getValue();
synchronized (playbinLock) {
        if (playbin2 != null && !autoTracking) {
          State orig=playbin2.getState();
          playbin2.pause();
          playbin2.seek(ClockTime.fromMillis(time));
          playbin2.setState(orig);
        }
      }
    }
  }
);
}
 

Example 24

From project beanmill_1, under directory /src/main/java/com/traxel/lumbermill/filter/.

Source file: FilterSetControl.java

  20 
vote

/** 
 * Creates a new FilterSetControl object.
 */
public FilterSetControl(){
  filterPerTree=new HashMap<FilterControl,Filter>();
  filterSetView=new FilterSetView();
  filterSet=new FilterSet();
  treeControl=new TreeControl();
  final List<FilterControl> filterControls=new ArrayList();
  filterControls.add(treeControl);
  allFilterControls=Collections.unmodifiableList(filterControls);
  final JCheckBoxMenuItem[] filterItems=new JCheckBoxMenuItem[allFilterControls.size()];
  for (int i=0; i < allFilterControls.size(); i++) {
    final FilterControl fc=allFilterControls.get(i);
    final Action action=new FilterCheckBoxAction(fc);
    filterItems[i]=new JCheckBoxMenuItem(action);
    filterItems[i].setState(true);
    apply(fc);
  }
  filterSetMenu=new FilterSetMenu("Filters",filterItems);
  filterSetView.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    final ChangeEvent evt){
      if (LOG.isDebugEnabled()) {
        LOG.debug("stateChanged: " + evt);
      }
      for (      final FilterControl fc : filterPerTree.keySet()) {
        if (!(fc.getFilter() instanceof Regex)) {
          fc.getFilter().setActive(false);
        }
      }
      try {
        getActiveComponent().getFilter().setActive(true);
        filterSet.fireFilterAdded(null);
      }
 catch (      Exception e) {
        LOG.warn("could not set active filter",e);
      }
    }
  }
);
}
 

Example 25

From project ChkBugReport, under directory /src/com/sonyericsson/chkbugreport/.

Source file: Gui.java

  20 
vote

private void buildSettings(JPanel settingsPanel){
  final Settings settings=mMain.getSettings();
  for (  Setting setting : settings) {
    if (setting instanceof BoolSetting) {
      final BoolSetting bs=(BoolSetting)setting;
      final JCheckBox chk=new JCheckBox(setting.getDescription());
      settingsPanel.add(chk);
      chk.setSelected(bs.get());
      chk.addChangeListener(new ChangeListener(){
        @Override public void stateChanged(        ChangeEvent e){
          bs.set(chk.isSelected());
          settings.save();
        }
      }
);
    }
  }
}
 

Example 26

From project gitblit, under directory /src/com/gitblit/client/.

Source file: GitblitPanel.java

  20 
vote

public GitblitPanel(GitblitRegistration reg,RegistrationsDialog.RegistrationListener listener){
  this.gitblit=new GitblitClient(reg);
  this.listener=listener;
  tabs=new JTabbedPane(JTabbedPane.BOTTOM);
  tabs.addTab(Translation.get("gb.repositories"),createRepositoriesPanel());
  tabs.addTab(Translation.get("gb.activity"),createFeedsPanel());
  tabs.addTab(Translation.get("gb.teams"),createTeamsPanel());
  tabs.addTab(Translation.get("gb.users"),createUsersPanel());
  tabs.addTab(Translation.get("gb.settings"),createSettingsPanel());
  tabs.addTab(Translation.get("gb.status"),createStatusPanel());
  tabs.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      tabs.getSelectedComponent().requestFocus();
    }
  }
);
  setLayout(new BorderLayout());
  add(tabs,BorderLayout.CENTER);
}
 

Example 27

From project JaamSim, under directory /com/sandwell/JavaSimulation3D/.

Source file: EditBox.java

  20 
vote

private EditBox(){
  super("Input Editor");
  cellRenderer=new CellRenderer();
  helpKeyListener=new HelpKeyListener();
  setDefaultCloseOperation(FrameBox.HIDE_ON_CLOSE);
  buildingTable=false;
  jTabbedPane=new JTabbedPane();
  jTabbedPane.setBackground(INACTIVE_TAB_COLOR);
  jTabbedPane.setPreferredSize(new Dimension(700,400));
  getContentPane().add(jTabbedPane);
  jTabbedPane.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent evt){
      JTabbedPane pane=(JTabbedPane)evt.getSource();
      if (buildingTable || pane.getSelectedIndex() < 0)       return;
      jTabbedPane.setBackgroundAt(presentPage,INACTIVE_TAB_COLOR);
      presentPage=jTabbedPane.getSelectedIndex();
      jTabbedPane.setBackgroundAt(presentPage,ACTIVE_TAB_COLOR);
      updateValues();
    }
  }
);
  JLabel helpLabel=new JLabel("Press F1 for help on any cell",JLabel.CENTER);
  helpLabel.setFont(helpLabel.getFont().deriveFont(9f));
  getContentPane().add("South",helpLabel);
  pack();
  setLocation(220,710);
  setSize(530,290);
}
 

Example 28

From project jmeter-components, under directory /src/main/java/com/atlantbh/jmeter/plugins/rest/gui/.

Source file: RestGui.java

  20 
vote

private JPanel getResourceConfigPanel(){
  automaticRedirect=new JCheckBox(JMeterUtils.getResString("follow_redirects"));
  httpMethods=new JLabeledChoice("Method",new String[]{"GET","POST","PUT","DELETE"});
  httpMethods.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      JLabeledChoice c=(JLabeledChoice)e.getSource();
      String text=c.getText();
      if ("PUT".equals(text) || "POST".equals(text)) {
        automaticRedirect.setSelected(false);
        automaticRedirect.setEnabled(false);
      }
 else {
        automaticRedirect.setEnabled(true);
      }
    }
  }
);
  useKeepAlive=new JCheckBox(JMeterUtils.getResString("use_keepalive"));
  hostBaseUrl=new JLabeledTextField("Base Url",25);
  resource=new JLabeledTextField("Resource",20);
  port=new JLabeledTextField("Port",10);
  VerticalPanel panel=new VerticalPanel();
  HorizontalPanel panel1=new HorizontalPanel();
  panel1.add(httpMethods);
  panel1.add(useKeepAlive);
  panel1.add(automaticRedirect);
  HorizontalPanel panel2=new HorizontalPanel();
  panel2.add(hostBaseUrl);
  panel2.add(port);
  HorizontalPanel panel3=new HorizontalPanel();
  panel3.add(resource);
  panel.add(panel1);
  panel.add(panel2);
  panel.add(panel3);
  return panel;
}
 

Example 29

From project knime-scripting, under directory /knutils/src/de/mpicbg/tds/knime/knutils/ui/.

Source file: DialogOptionListFilter.java

  20 
vote

public DialogOptionListFilter(final SettingsModelFilterString model,final int inPortIndex,ListCellRenderer cellRenderer){
  super(model);
  m_inPortIndex=inPortIndex;
  m_specInFilter=null;
  m_columnFilter=new TwoPaneSelectionPanel(false,cellRenderer);
  getComponentPanel().add(m_columnFilter);
  m_columnFilter.addChangeListener(new ChangeListener(){
    public void stateChanged(    final ChangeEvent e){
      updateModel();
    }
  }
);
  getModel().addChangeListener(new ChangeListener(){
    public void stateChanged(    final ChangeEvent e){
      updateComponent();
    }
  }
);
  updateModel();
}
 

Example 30

From project Laserschein, under directory /src/laserschein/ui/.

Source file: BooleanTweaker.java

  20 
vote

public BooleanTweaker(String theTitle,boolean theDefault){
  super();
  this.setOpaque(false);
  _myLabel=new JLabel(theTitle);
  _myLabel.setFocusable(false);
  this.add(_myLabel);
  _myCheckbox=new JCheckBox();
  _myCheckbox.setSelected(theDefault);
  _myCheckbox.setFocusable(true);
  this.add(_myCheckbox);
  _myCheckbox.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      notifyListeners();
    }
  }
);
}
 

Example 31

From project nenya, under directory /tools/src/main/java/com/threerings/media/tools/.

Source file: RecolorImage.java

  20 
vote

public SliderAndLabel(float minf,float maxf,float valuef){
  int min=(int)(minf * CONVERSION);
  int max=(int)(maxf * CONVERSION);
  int value=(int)(valuef * CONVERSION);
  setLayout(new VGroupLayout(VGroupLayout.STRETCH));
  _intField=new JLabel(String.valueOf(value / CONVERSION));
  _slider=new JSlider(min,max,value);
  _slider.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent ce){
      _intField.setText(String.valueOf((_slider.getValue()) / CONVERSION));
      convert();
    }
  }
);
  add(_intField);
  add(_slider);
}
 

Example 32

From project nuxeo-distribution, under directory /nuxeo-launcher/src/main/java/org/nuxeo/launcher/gui/.

Source file: NuxeoFrame.java

  20 
vote

protected JComponent buildTabbedPanel(){
  tabbedPanel=new JTabbedPane(SwingConstants.TOP);
  tabbedPanel.addTab(NuxeoLauncherGUI.getMessage("tab.summary.title"),buildSummaryPanel());
  logsTab=buildLogsTab();
  tabbedPanel.addTab(NuxeoLauncherGUI.getMessage("tab.logs.title"),logsTab);
  tabbedPanel.addTab(NuxeoLauncherGUI.getMessage("tab.shell.title"),buildConsolePanel());
  tabbedPanel.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      JTabbedPane pane=(JTabbedPane)e.getSource();
      if (pane.getSelectedIndex() == 2) {
        consolePanel.getConsole().requestFocusInWindow();
      }
    }
  }
);
  return tabbedPanel;
}
 

Example 33

From project OWASP-WebScarab, under directory /src/org/owasp/webscarab/ui/swing/.

Source file: ContentPanel.java

  20 
vote

/** 
 * Creates new form ContentPanel 
 */
public ContentPanel(){
  initComponents();
  viewTabbedPane.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      if (_creatingPanels)       return;
      updateData(_selected);
      _selected=viewTabbedPane.getSelectedIndex();
      if (_selected > -1) {
        updatePanel(_selected);
        String name=_editors[_selected].getName();
        _preferred.remove(name);
        _preferred.add(name);
      }
    }
  }
);
}
 

Example 34

From project pegadi, under directory /client/src/main/java/org/pegadi/artis/.

Source file: Artis.java

  20 
vote

/** 
 * Creates the user interface for the editor.
 */
protected void createUI(){
  createActions();
  setJMenuBar(createMenu());
  setGlassPane(easter);
  leftPane=new JTabbedPane(JTabbedPane.TOP);
  rightPane=new JTabbedPane(JTabbedPane.TOP);
  splitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  splitPane.setOneTouchExpandable(true);
  charCountLabel=new JLabel(strings.getString("status_charcount"));
  statusPanel=new JPanel();
  FlowLayout statusLayout=new FlowLayout(FlowLayout.LEFT);
  statusLayout.setHgap(10);
  statusPanel.setLayout(statusLayout);
  statusPanel.add(charCountLabel);
  getContentPane().setLayout(new BorderLayout());
  getContentPane().add(splitPane,BorderLayout.CENTER);
  getContentPane().add(statusPanel,BorderLayout.SOUTH);
  ImageIcon icon=new ImageIcon(getClass().getResource(strings.getString("icon_artis")));
  setIconImage(icon.getImage());
  setTitle(strings.getString("application_title") + " " + ApplicationLauncher.getVersion());
  setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
  addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      exitAction(null);
    }
  }
);
  leftPane.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      editorChanged((Editor)leftPane.getSelectedComponent());
    }
  }
);
  splitPane.setDividerLocation(1.0);
}
 

Example 35

From project pomodoro4nb, under directory /src/org/matveev/pomodoro4nb/prefs/.

Source file: PreferencesDialog.java

  20 
vote

private void updateComponentsWithPrefs(){
  enableReminderCheckbox.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      final JCheckBox box=(JCheckBox)e.getSource();
      reminderIntervalSpinner.setEnabled(box.isSelected());
    }
  }
);
  pomodoroLengthSpinner.setValue(provider.getInteger(POMODORO_LENGTH_KEY,DefaultPreferencesProvider.DEFAULT_POMODORO_LENGTH));
  shorBreakLengthSpinner.setValue(provider.getInteger(SHORT_BREAK_LENGTH_KEY,DefaultPreferencesProvider.DEFAULT_SHORT_BREAK_LENGTH));
  longBreakLengthSpinner.setValue(provider.getInteger(LONG_BREAK_LENGTH_KEY,DefaultPreferencesProvider.DEFAULT_LONG_BREAK_LENGTH));
  longBreakIntervalSpinner.setValue(provider.getInteger(LONG_BREAK_INTERVAL_KEY,DefaultPreferencesProvider.DEFAULT_LONG_BREAK_INTERVAL));
  enableSoundsCheckbox.setSelected(provider.getBoolean(ENABLE_SOUNDS_KEY,true));
  enableReminderCheckbox.setSelected(provider.getBoolean(ENABLE_REMINDER_KEY,true));
  reminderIntervalSpinner.setEnabled(provider.getBoolean(ENABLE_REMINDER_KEY,true));
}
 

Example 36

From project QuakeInjector, under directory /src/de/haukerehfeld/quakeinjector/.

Source file: QuakeInjector.java

  20 
vote

private void showEngineConfig(boolean rogueInstalled,boolean hipnoticInstalled){
  final EngineConfigDialog d=new EngineConfigDialog(QuakeInjector.this,getConfig().EnginePath,getConfig().EngineExecutable,getConfig().DownloadPath,getConfig().EngineCommandLine,rogueInstalled,hipnoticInstalled);
  d.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      try {
        saveEngineConfig(d.getEnginePath(),d.getEngineExecutable(),d.getDownloadPath(),d.getCommandline(),d.getRogueInstalled(),d.getHipnoticInstalled());
      }
 catch (      IOException err) {
        savingFailedDialogue(err);
      }
    }
  }
);
  d.pack();
  d.setLocationRelativeTo(this);
  d.show();
}
 

Example 37

From project seadas, under directory /seadas-processing/src/main/java/gov/nasa/gsfc/seadas/processing/l2gen/userInterface/.

Source file: L2genForm.java

  20 
vote

public L2genForm(AppContext appContext,String xmlFileName,File iFile,boolean showIOFields){
  setOpenInAppCheckBox(new JCheckBox("Open in " + appContext.getApplicationName()));
  getOpenInAppCheckBox().setSelected(true);
  l2genData.showIOFields=showIOFields;
  if (getL2genData().initXmlBasedObjects()) {
    createMainTab();
    createProductsTab();
    createCategoryParamTabs();
    tabIndex=jTabbedPane.getSelectedIndex();
    getjTabbedPane().addChangeListener(new ChangeListener(){
      public void stateChanged(      ChangeEvent evt){
        tabChangeHandler();
      }
    }
);
    setLayout(new GridBagLayout());
    add(getjTabbedPane(),new GridBagConstraintsCustom(0,0,1,1,GridBagConstraints.WEST,GridBagConstraints.BOTH));
    add(getOpenInAppCheckBox(),new GridBagConstraintsCustom(0,1,0,0,GridBagConstraints.EAST,GridBagConstraints.NONE));
    getL2genData().disableEvent(L2genData.PARSTRING);
    getL2genData().disableEvent(L2genData.L2PROD);
    if (iFile != null) {
      getL2genData().setInitialValues(iFile);
    }
 else {
      getL2genData().setInitialValues(getInitialSelectedSourceFile());
    }
    getL2genData().fireAllParamEvents();
    getL2genData().enableEvent(L2genData.L2PROD);
    getL2genData().enableEvent(L2genData.PARSTRING);
  }
 else {
    add(new JLabel("Problem initializing userInterface"));
  }
}
 

Example 38

From project subsonic, under directory /subsonic-main/src/main/java/net/sourceforge/subsonic/service/jukebox/.

Source file: PlayerTest.java

  20 
vote

private void createGUI(){
  JFrame frame=new JFrame();
  JButton startButton=new JButton("Start");
  JButton stopButton=new JButton("Stop");
  JButton resetButton=new JButton("Reset");
  final JSlider gainSlider=new JSlider(0,1000);
  startButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      player.play();
    }
  }
);
  stopButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      player.pause();
    }
  }
);
  resetButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      player.close();
    }
  }
);
  gainSlider.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      float gain=(float)gainSlider.getValue() / 1000.0F;
      player.setGain(gain);
    }
  }
);
  frame.setLayout(new FlowLayout());
  frame.add(startButton);
  frame.add(stopButton);
  frame.add(resetButton);
  frame.add(gainSlider);
  frame.pack();
  frame.setVisible(true);
}
 

Example 39

From project subsonic_1, under directory /subsonic-main/src/main/java/net/sourceforge/subsonic/service/jukebox/.

Source file: PlayerTest.java

  20 
vote

private void createGUI(){
  JFrame frame=new JFrame();
  JButton startButton=new JButton("Start");
  JButton stopButton=new JButton("Stop");
  JButton resetButton=new JButton("Reset");
  final JSlider gainSlider=new JSlider(0,1000);
  startButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      player.play();
    }
  }
);
  stopButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      player.pause();
    }
  }
);
  resetButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      player.close();
    }
  }
);
  gainSlider.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      float gain=(float)gainSlider.getValue() / 1000.0F;
      player.setGain(gain);
    }
  }
);
  frame.setLayout(new FlowLayout());
  frame.add(startButton);
  frame.add(stopButton);
  frame.add(resetButton);
  frame.add(gainSlider);
  frame.pack();
  frame.setVisible(true);
}
 

Example 40

From project Supersonic, under directory /subsonic-main/src/main/java/net/sourceforge/subsonic/service/jukebox/.

Source file: PlayerTest.java

  20 
vote

private void createGUI(){
  JFrame frame=new JFrame();
  JButton startButton=new JButton("Start");
  JButton stopButton=new JButton("Stop");
  JButton resetButton=new JButton("Reset");
  final JSlider gainSlider=new JSlider(0,1000);
  startButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      player.play();
    }
  }
);
  stopButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      player.pause();
    }
  }
);
  resetButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      player.close();
    }
  }
);
  gainSlider.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      float gain=(float)gainSlider.getValue() / 1000.0F;
      player.setGain(gain);
    }
  }
);
  frame.setLayout(new FlowLayout());
  frame.add(startButton);
  frame.add(stopButton);
  frame.add(resetButton);
  frame.add(gainSlider);
  frame.pack();
  frame.setVisible(true);
}
 

Example 41

From project Twister, under directory /src/client/userinterface/java/src/.

Source file: MainPanel.java

  20 
vote

public MainPanel(boolean applet){
  InputMap map=getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
  KeyStroke keyStroke=KeyStroke.getKeyStroke(KeyEvent.VK_UP,InputEvent.CTRL_MASK,false);
  map.put(keyStroke,"DoNothing");
  Repository.intro.setStatus("Started Main initialization");
  Repository.intro.addPercent(0.035);
  Repository.intro.repaint();
  Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
  this.applet=applet;
  p1=new Panel1("",applet,(int)screenSize.getWidth());
  p2=new Panel2(applet);
  p4=new Panel4();
  setBounds(0,5,(int)screenSize.getWidth() - 50,672);
  addTab("Suites",new ImageIcon(),p1);
  addTab("Monitoring",p2);
  addTab("Reports",null);
  addTab("Configuration",p4);
  askForFile();
  if (applet) {
    addChangeListener(new ChangeListener(){
      public void stateChanged(      ChangeEvent e){
        if (getSelectedIndex() == 2) {
          try {
            Repository.window.container.getAppletContext().showDocument(new URL("http://" + Repository.host + ":"+ Repository.getHTTPServerPort()+ "/report/"+ Repository.getUser()),"_blank");
          }
 catch (          Exception ex) {
            ex.printStackTrace();
          }
          setSelectedIndex(1);
        }
      }
    }
);
  }
  Repository.intro.setStatus("Finished Main initialization");
  Repository.intro.addPercent(0.035);
  Repository.intro.repaint();
}
 

Example 42

From project uniquery, under directory /src/org/uniquery/gui/query/.

Source file: QueryTabbedPane.java

  20 
vote

public QueryTabbedPane(Gui parent){
  super();
  this.gui=parent;
  this.queryTabs=new ArrayList<QueryTab>();
  InfoTab welcomeTab=new InfoTab("Welcome");
  addTab(welcomeTab.getTitle(),welcomeTab);
  addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      Component selectedComponent=getSelectedComponent();
      MainMenuBar mainMenu=gui.getMainMenuBar();
      if (selectedComponent instanceof QueryTab) {
        QueryTab qt=(QueryTab)selectedComponent;
        boolean enabled=qt.queryFieldHasText();
        mainMenu.setFormatQueryItemEnabled(enabled);
        mainMenu.setExecuteQueryItemEnabled(enabled);
        mainMenu.setCloseQueryItemEnabled(true);
        mainMenu.setSaveQueryItemEnabled(enabled);
      }
 else {
        mainMenu.setCloseQueryItemEnabled(false);
        mainMenu.setFormatQueryItemEnabled(false);
        mainMenu.setExecuteQueryItemEnabled(false);
        mainMenu.setSaveQueryItemEnabled(false);
      }
    }
  }
);
}
 

Example 43

From project coffeescript-netbeans, under directory /src/coffeescript/nb/project/sample/.

Source file: CoffeeScriptApplicationWizardPanel.java

  19 
vote

protected final void fireChangeEvent(){
  Set<ChangeListener> ls;
synchronized (listeners) {
    ls=new HashSet<ChangeListener>(listeners);
  }
  ChangeEvent ev=new ChangeEvent(this);
  for (  ChangeListener l : ls) {
    l.stateChanged(ev);
  }
}
 

Example 44

From project enclojure, under directory /netbeans/plugins/org-enclojure-plugin/src/main/java/org/enclojure/ide/nb/clojure/project/.

Source file: ClojureTemplateWizardPanel.java

  19 
vote

protected final void fireChangeEvent(){
  Set<ChangeListener> ls;
synchronized (listeners) {
    ls=new HashSet<ChangeListener>(listeners);
  }
  ChangeEvent ev=new ChangeEvent(this);
  for (  ChangeListener l : ls) {
    l.stateChanged(ev);
  }
}
 

Example 45

From project flyingsaucer, under directory /flying-saucer-core/src/main/java/org/xhtmlrenderer/swing/.

Source file: SelectionHighlighter.java

  19 
vote

protected void fireStateChanged(){
  Object[] listeners=listenerList.getListenerList();
  for (int i=listeners.length - 2; i >= 0; i-=2) {
    if (listeners[i] == ChangeListener.class) {
      if (changeEvent == null)       changeEvent=new ChangeEvent(this);
      ((ChangeListener)listeners[i + 1]).stateChanged(changeEvent);
    }
  }
}
 

Example 46

From project lilith, under directory /lilith/src/main/java/de/huxhorn/lilith/swing/.

Source file: ViewContainer.java

  19 
vote

public void addChangeListener(ChangeListener listener){
  boolean changed=false;
synchronized (changeListeners) {
    if (!changeListeners.contains(listener)) {
      changeListeners.add(listener);
      changed=true;
    }
  }
  if (changed) {
    fireChange();
  }
}
 

Example 47

From project netbeans-plugin, under directory /src/org/netbeans/modules/php/nette/wizards/.

Source file: NewNetteProjectPanel.java

  19 
vote

/** 
 * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked") private void initComponents(){
  copyNetteCheckbox=new javax.swing.JCheckBox();
  optionsLabel=new javax.swing.JLabel();
  copyNetteCheckbox.setText(org.openide.util.NbBundle.getMessage(NewNetteProjectPanel.class,"NewNetteProjectPanel.copyNetteCheckbox.text"));
  copyNetteCheckbox.addChangeListener(new javax.swing.event.ChangeListener(){
    public void stateChanged(    javax.swing.event.ChangeEvent evt){
      copyNetteCheckboxStateChanged(evt);
    }
  }
);
  optionsLabel.setForeground(java.awt.Color.blue);
  optionsLabel.setText(org.openide.util.NbBundle.getMessage(NewNetteProjectPanel.class,"NewNetteProjectPanel.optionsLabel.text"));
  optionsLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
  optionsLabel.addMouseListener(new java.awt.event.MouseAdapter(){
    public void mouseReleased(    java.awt.event.MouseEvent evt){
      optionsLabelMouseReleased(evt);
    }
  }
);
  javax.swing.GroupLayout layout=new javax.swing.GroupLayout(this);
  this.setLayout(layout);
  layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING,layout.createSequentialGroup().addContainerGap().addComponent(copyNetteCheckbox).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,97,Short.MAX_VALUE).addComponent(optionsLabel,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE)));
  layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(optionsLabel,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.PREFERRED_SIZE).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(copyNetteCheckbox))).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE)));
}
 

Example 48

From project nodebox, under directory /src/main/java/nodebox/client/.

Source file: ColorWell.java

  19 
vote

protected void fireStateChanged(){
  if (changeEvent == null) {
    changeEvent=new ChangeEvent(this);
  }
  for (  EventListener l : listenerList.getListeners(ChangeListener.class)) {
    ((ChangeListener)l).stateChanged(changeEvent);
  }
}
 

Example 49

From project TraVis, under directory /src/travis/view/project/tree/.

Source file: CheckBoxTreeCellRenderer.java

  19 
vote

public void fireStateChanged(){
  ChangeListener[] listeners=listenerList.getListeners(ChangeListener.class);
  ChangeEvent e=new ChangeEvent(this);
  for (  ChangeListener listener : listeners) {
    listener.stateChanged(e);
  }
}