There are 43 code examples for javax.swing.JCheckBox.

The API names are highlighted below. You can use suckoo button to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.

Project Name: jbidwatcher Package: com.jbidwatcher.ui

Source Code: SearchInfoDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupUI(){
  final JPanel panel3=new JPanel();
  panel3.setLayout(new BorderLayout());
  panel3.add(boxUp(getButtonOK(),getButtonCancel()),BorderLayout.EAST);
  getBasicContentPane().add(panel3,BorderLayout.SOUTH);
  final JLabel label1=new JLabel("Search Name: ");
  searchNameField=new JTextField(12);
  searchNameField.addMouseListener(JPasteListener.getInstance());
  final JLabel label2=new JLabel(" Search Type: ");
  searchTypeBox=new JComboBox(_search_types);
  periodList=new JComboBox(_periods);
  periodEnabled=new JCheckBox("Enable Repeated Search");
  tabList=new JComboBox();
  buildTabList();
  currencyBox=new JComboBox();
  buildCurrencyList(currencyBox);
  final JLabel searchLabel=new JLabel("Search: ");
  searchField=new JTextField(40);
  searchField.addMouseListener(JPasteListener.getInstance());
  final JLabel tabLabel=new JLabel("Destination Tab: ");
  final JLabel curLabel=new JLabel("Currency: ");
  JPanel form=new JPanel();
  form.setLayout(new SpringLayout());
  form.add(label1);
  form.add(boxUp(boxUp(searchNameField,label2),searchTypeBox));
  form.add(searchLabel);
  form.add(searchField);
  form.add(tabLabel);
  form.add(tabList);
  form.add(curLabel);
  form.add(currencyBox);
  form.add(new JLabel("Repeat every: "));
  form.add(boxUp(periodList,periodEnabled));
  SpringUtilities.makeCompactGrid(form,5,2,6,6,6,3);
  getBasicContentPane().add(form,BorderLayout.CENTER);
}
 

Project Name: jFreeChart Package: org.jfree.chart.editor

Source Code: DefaultPlotEditor.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Allow the user to modify whether or not shapes are drawn at data points
 * by <tt>LineAndShapeRenderer</tt>s and <tt>StandardXYItemRenderer</tt>s.
 */
private void attemptDrawShapesSelection(){
  this.drawShapes=BooleanUtilities.valueOf(this.drawShapesCheckBox.isSelected());
}
 

Project Name: jFreeChart Package: org.jfree.chart.editor

Source Code: DefaultAxisEditor.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Returns the current value of the flag that determines whether or not
 * tick marks are visible.
 * @return <code>true</code> if tick marks are visible.
 */
public boolean isTickMarksVisible(){
  return this.showTickMarksCheckBox.isSelected();
}
 

Project Name: jFreeChart Package: org.jfree.chart.editor

Source Code: DefaultChartEditor.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Returns the current setting of the anti-alias flag.
 * @return <code>true</code> if anti-aliasing is enabled.
 */
public boolean getAntiAlias(){
  return this.antialias.isSelected();
}
 

Project Name: jFreeChart Package: org.jfree.chart.editor

Source Code: DefaultNumberAxisEditor.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Toggle the auto range setting.
 */
public void toggleAutoRange(){
  this.autoRange=this.autoRangeCheckBox.isSelected();
  if (this.autoRange) {
    this.minimumRangeValue.setText(Double.toString(this.minimumValue));
    this.minimumRangeValue.setEnabled(false);
    this.maximumRangeValue.setText(Double.toString(this.maximumValue));
    this.maximumRangeValue.setEnabled(false);
  }
 else {
    this.minimumRangeValue.setEnabled(true);
    this.maximumRangeValue.setEnabled(true);
  }
}
 

Project Name: jFreeChart Package: org.jfree.chart.editor

Source Code: DefaultTitleEditor.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Allow the user the opportunity to change whether the title is
 * displayed on the chart or not.
 */
private void attemptModifyShowTitle(){
  this.showTitle=this.showTitleCheckBox.isSelected();
  this.enableOrDisableControls();
}
 

Project Name: jFreeChart Package: org.jfree.chart.editor

Source Code: DefaultColorBarEditor.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Handles actions from within the property panel.
 * @param event  the event.
 */
public void actionPerformed(ActionEvent event){
  String command=event.getActionCommand();
  if (command.equals("PaletteChoice")) {
    attemptPaletteSelection();
  }
 else   if (command.equals("invertPalette")) {
    this.invertPalette=this.invertPaletteCheckBox.isSelected();
  }
 else   if (command.equals("stepPalette")) {
    this.stepPalette=this.stepPaletteCheckBox.isSelected();
  }
 else {
    super.actionPerformed(event);
  }
}
 

Project Name: jbidwatcher Package: com.jbidwatcher.ui

Source Code: JTabProperties.java (Click to view .java file)

Method Code:
vote
like

private JPanel buildColumnPanel(){
  JPanel columnChecks=new JPanel();
  if (columns2Boxes == null)   columns2Boxes=new TreeMap<String,JCheckBox>();
  columnChecks.setBorder(BorderFactory.createTitledBorder("Custom Column Settings"));
  JPanel internal=new JPanel();
  internal.setLayout(new GridLayout(0,4,2 * 10,0));
  List<String> columns=ListManager.getInstance().getColumns(_tab);
  Object[] names=TableColumnController.getInstance().getColumnNames().toArray();
  Arrays.sort(names);
  for (  Object name1 : names) {
    String s=(String)name1;
    if (s != null) {
      JCheckBox jch=new JCheckBox(s,columns.contains(s));
      jch.addActionListener(this);
      columns2Boxes.put(s,jch);
      internal.add(jch);
    }
  }
  columnChecks.add(internal,BorderLayout.CENTER);
  return columnChecks;
}
 

Project Name: jbidwatcher Package: com.jbidwatcher.ui

Source Code: SnipeDialog.java (Click to view .java file)

Method Code:
vote
like

private void setupUI(){
  auctionInfo=new JLabel();
  auctionInfo.setText("Auction Information");
  getBasicContentPane().add(auctionInfo);
  JPanel inputPane=new JPanel();
  inputPane.setLayout(new BoxLayout(inputPane,BoxLayout.Y_AXIS));
  snipeAmount=new JTextField(10);
  snipeAmount.setText(mInitialValue);
  quantityField=new JTextField(10);
  quantityField.setEnabled(false);
  quantityField.setText("1");
  subtractShipping=new JCheckBox();
  subtractShipping.setSelected(JConfig.queryConfiguration("snipe.subtract_shipping","false").equals("true"));
  subtractShipping.setText("Auto-subtract shipping and insurance (p/p)");
  JPanel promptPane=new JPanel(new SpringLayout());
  JLabel snipeLabel;
  promptPane.add(snipeLabel=new JLabel("How much do you wish to snipe?",JLabel.TRAILING));
  snipeLabel.setLabelFor(snipeAmount);
  promptPane.add(snipeAmount);
  promptPane.add(quantityLabel=new JLabel("Quantity?",JLabel.TRAILING));
  quantityLabel.setLabelFor(quantityField);
  promptPane.add(quantityField);
  SpringUtilities.makeCompactGrid(promptPane,2,2,6,6,6,3);
  getBasicContentPane().add(promptPane);
  getBasicContentPane().add(subtractShipping);
  JPanel bottomPanel=new JPanel();
  bottomPanel.setLayout(new BorderLayout());
  bottomPanel.add(JConfigTab.makeLine(getButtonOK(),getButtonCancel()),BorderLayout.EAST);
  getBasicContentPane().add(bottomPanel);
  SpringUtilities.makeCompactGrid(getBasicContentPane(),4,1,6,6,6,6);
}
 

Project Name: jbidwatcher Package: com.jbidwatcher.ui.commands

Source Code: UserActions.java (Click to view .java file)

Method Code:
vote
like

public void actionPerformed(ActionEvent listen_ae){
  String actionString=listen_ae.getActionCommand();
  if (actionString.equals("Don't prompt in the future.")) {
    JCheckBox jch=(JCheckBox)listen_ae.getSource();
    mDontPrompt=jch.isSelected();
  }
 else {
    if (actionString.equals("Yes")) {
      for (      EntryInterface entry : mEntries) {
        entry.cancelSnipe(false);
        MQFactory.getConcrete("delete").enqueue(entry.getIdentifier());
        DeletedEntry.create(entry.getIdentifier());
      }
      AuctionEntry.deleteAll(mEntries);
      if (mDontPrompt) {
        JConfig.setConfiguration("prompt.hide_delete_confirm","true");
      }
    }
    m_within.dispose();
    m_within=null;
  }
}
 

Project Name: jbidwatcher Package: com.jbidwatcher.ui.config

Source Code: JConfigBrowserTab.java (Click to view .java file)

Method Code:
vote
like

private JPanel buildOverridePreference(){
  JPanel tp=new JPanel();
  tp.setBorder(BorderFactory.createTitledBorder("Browser Command"));
  tp.setLayout(new GridLayout(2,2));
  JPanel buttonPanel=new JPanel();
  JButton detectButton=new JButton("Detect Browser");
  String overrideOn=JConfig.queryConfiguration("browser.override","false");
  buttonPanel.setLayout(new BorderLayout());
  overrideDefault=new JCheckBox("Override 'detected' browser");
  overrideDefault.setSelected(overrideOn.equals("true"));
  detectButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent ae){
      if (ae.getActionCommand().equals("Detect Browser")) {
        if (JConfig.getOS().equalsIgnoreCase("windows")) {
          String browser;
          browser=Browser.getBrowserCommand();
          if (browser != null) {
            windowsBrowserLaunchCommand.setText(browser);
          }
 else {
            JOptionPane.showMessageDialog(null,"This Java Virtual Machine cannot detect the default browser type.\nUpgrading to a post-1.4 version of Java might help.","Cannot detect browser",JOptionPane.INFORMATION_MESSAGE);
          }
        }
 else {
          linuxBrowserLaunchCommand.setText(Browser.getBrowserCommand());
        }
      }
    }
  }
);
  tp.add(buttonPanel,BorderLayout.WEST);
  buttonPanel.add(detectButton,BorderLayout.WEST);
  buttonPanel.add(buildTestButton(),BorderLayout.EAST);
  tp.add(overrideDefault,BorderLayout.SOUTH);
  return tp;
}
 

Project Name: jbidwatcher Package: com.jbidwatcher.ui.config

Source Code: JConfigMyJBidwatcherTab.java (Click to view .java file)

Method Code:
vote
like

private JCheckBox createSettingsCheckbox(String text,String identifier){
  String cfgAllowed="my.jbidwatcher.allow." + identifier;
  boolean allowed=JConfig.queryConfiguration(cfgAllowed,"false").equals("true");
  String cfgSetting="my.jbidwatcher." + identifier;
  boolean set=JConfig.queryConfiguration(cfgSetting,"false").equals("true");
  final JCheckBox cb=new JCheckBox(text);
  cb.setEnabled(allowed);
  cb.setSelected(set);
  mConfigurationMap.put(cb,cfgSetting);
  mEnabledMap.put(cb,cfgAllowed);
  return cb;
}
 

Project Name: jbidwatcher Package: com.jbidwatcher.ui.config

Source Code: JConfigWebserverTab.java (Click to view .java file)

Method Code:
vote
like

private JPanel buildCheckboxPanel(){
  JPanel tp=new JPanel();
  tp.setBorder(BorderFactory.createTitledBorder("Webserver Options"));
  tp.setLayout(new GridLayout(1,2));
  String doLocalServer=JConfig.queryConfiguration("server.enabled","false");
  String doAllowSyndication=JConfig.queryConfiguration("allow.syndication","true");
  localServerBrowseBox=new JCheckBox("Use internal web server");
  localServerBrowseBox.setToolTipText("<html><body>Turning this on enables JBidwatchers internal web server; 'Show in Browser' will go through JBidwatcher<br>first, in order to allow it to show old/deleted auctions,and to avoid the need to log in regularly.<br>The internal web server is password protected with your auction server username/password.</body></html>");
  localServerBrowseBox.setSelected(doLocalServer.equals("true"));
  tp.add(localServerBrowseBox);
  openSyndication=new JCheckBox("Allow syndication to bypass authentication");
  openSyndication.setToolTipText("Allows syndication requests and thumbnail requests to be resolved without requiring a username/password.");
  openSyndication.setSelected(doAllowSyndication.equals("true"));
  tp.add(openSyndication);
  return tp;
}
 

Project Name: jbidwatcher Package: com.jbidwatcher.ui.config

Source Code: JConfigSnipeTab.java (Click to view .java file)

Method Code:
vote
like

private JPanel buildExtraSettings(){
  JPanel tp=new JPanel();
  tp.setBorder(BorderFactory.createTitledBorder("Snipe Settings"));
  tp.setLayout(new BorderLayout());
  autoSubtractShippingBox=new JCheckBox("Subtract shipping/insurance from bid amounts by default");
  autoSubtractShippingBox.setToolTipText("Determines the default behaviour of deducting shipping/insurance from bid amounts. This behaviour can be overridden on a per-bid basis.");
  tp.add(autoSubtractShippingBox);
  return tp;
}
 

Project Name: jbidwatcher Package: com.jbidwatcher.ui.config

Source Code: JConfigFirewallTab.java (Click to view .java file)

Method Code:
vote
like

private JPanel buildHTTPSProxyPanel(){
  JPanel proxyPanel=new JPanel();
  radioAction rad=new radioAction();
  proxyPanel.setBorder(BorderFactory.createTitledBorder("HTTPS/Secure Proxy Settings"));
  proxyPanel.setLayout(new BoxLayout(proxyPanel,BoxLayout.Y_AXIS));
  httpsProxyHost=new JTextField();
  httpsProxyPort=new JTextField();
  setAllHTTPSStatus(false);
  adjustField(httpsProxyHost,"Host name or IP address of HTTPS proxy server",firewallTextFieldListener);
  adjustField(httpsProxyPort,"Port number that the HTTPS proxy server runs on",firewallTextFieldListener);
  proxyHttps=new JCheckBox("Enable HTTPS (secure http) proxy?");
  proxyHttps.addActionListener(rad);
  JPanel checkboxPanel=new JPanel(new BorderLayout());
  checkboxPanel.add(proxyHttps,BorderLayout.WEST);
  proxyPanel.add(checkboxPanel);
  proxyPanel.add(makeLine(new JLabel("HTTPS Host: "),httpsProxyHost));
  proxyPanel.add(makeLine(new JLabel("HTTPS Port: "),httpsProxyPort));
  return proxyPanel;
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: PlanetaryConditionsDialog.java (Click to view .java file)

Method Code:
vote
like

private void setConditions(){
  conditions.setLight(choLight.getSelectedIndex());
  conditions.setWeather(choWeather.getSelectedIndex());
  conditions.setWindStrength(choWind.getSelectedIndex());
  conditions.setMinWindStrength(choMinWind.getSelectedIndex());
  conditions.setMaxWindStrength(choMaxWind.getSelectedIndex());
  conditions.setAtmosphere(choAtmosphere.getSelectedIndex());
  conditions.setFog(choFog.getSelectedIndex());
  conditions.setBlowingSand(cBlowingSands.isSelected());
  conditions.setShiftingWindDirection(cShiftWindDir.isSelected());
  conditions.setShiftingWindStrength(cShiftWindStr.isSelected());
  conditions.setTemperature(Integer.parseInt(fldTemp.getText()));
  conditions.setGravity(Float.parseFloat(fldGrav.getText()));
  conditions.setEMI(cEMI.isSelected());
  conditions.setTerrainAffected(cTerrainAffected.isSelected());
  if (client != null) {
    send();
  }
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: AdvancedSearchDialog.java (Click to view .java file)

Method Code:
vote
like

protected megamek.common.MechSearchFilter getMechSearchFilter(){
  MechSearchFilter ret=new MechSearchFilter();
  ret.sWalk=tWalk.getText();
  ret.iWalk=cWalk.getSelectedIndex();
  ret.sJump=tJump.getText();
  ret.iJump=cJump.getSelectedIndex();
  ret.iArmor=cArmor.getSelectedIndex();
  ret.sWep1Count=tWeapons1.getText();
  ret.sWep2Count=tWeapons2.getText();
  ret.oWep1=cWeapons1.getSelectedItem();
  ret.oWep2=cWeapons2.getSelectedItem();
  ret.sStartYear=tStartYear.getText();
  ret.sEndYear=tEndYear.getText();
  ret.iWepAndOr=cOrAnd.getSelectedIndex();
  ret.bCheckEquipment=chkEquipment.isSelected();
  ret.oEquipment=cEquipment.getSelectedItem();
  return ret;
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: CommonSettingsDialog.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Handle the player clicking checkboxes. <p/> Implements the
 * <code>ItemListener</code> interface.
 * @param event - the <code>ItemEvent</code> that initiated this call.
 */
public void itemStateChanged(ItemEvent event){
  Object source=event.getItemSelectable();
  if (source.equals(keepGameLog)) {
    gameLogFilename.setEnabled(keepGameLog.isSelected());
  }
 else   if (source.equals(stampFilenames)) {
    stampFormat.setEnabled(stampFilenames.isSelected());
  }
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: LOSDialog.java (Click to view .java file)

Method Code:
vote
like

public boolean getMechInSecond(){
  return checkboxes2[0].isSelected();
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: HostDialog.java (Click to view .java file)

Method Code:
vote
like

public void actionPerformed(ActionEvent e){
  if (!"cancel".equals(e.getActionCommand())) {
    try {
      playerName=yourNameF.getText();
      serverPass=serverPassF.getText();
      register=registerC.isSelected();
      metaserver=metaserverF.getText();
      port=Integer.parseInt(portF.getText());
    }
 catch (    NumberFormatException ex) {
      System.err.println(ex.getMessage());
      port=2346;
    }
    PreferenceManager.getClientPreferences().setLastPlayerName(playerName);
    PreferenceManager.getClientPreferences().setLastServerPass(serverPass);
    PreferenceManager.getClientPreferences().setLastServerPort(port);
    PreferenceManager.getClientPreferences().setValue("megamek.megamek.metaservername",metaserver);
  }
  setVisible(false);
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: DialogOptionComponent.java (Click to view .java file)

Method Code:
vote
like

public void itemStateChanged(ItemEvent itemEvent){
  dialogOptionListener.optionClicked(this,option,checkbox.isSelected());
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: ExitsDialog.java (Click to view .java file)

Method Code:
vote
like

public int getExits(){
  int exits=0;
  exits|=cheExit0.isSelected() ? 1 : 0;
  exits|=cheExit1.isSelected() ? 2 : 0;
  exits|=cheExit2.isSelected() ? 4 : 0;
  exits|=cheExit3.isSelected() ? 8 : 0;
  exits|=cheExit4.isSelected() ? 16 : 0;
  exits|=cheExit5.isSelected() ? 32 : 0;
  return exits;
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: BotConfigDialog.java (Click to view .java file)

Method Code:
vote
like

/** 
 * gets the selected, configured bot from the dialog
 * @param host
 * @param port
 * @return
 */
BotClient getSelectedBot(String host,int port){
  if (testbot_radiobutton.isSelected()) {
    return new TestBot(getBotName(),host,port);
  }
 else   if (princess_radiobutton.isSelected()) {
    Princess toreturn=new Princess(getBotName(),host,port);
    toreturn.verbosity=princess_verbosity.getSelectedIndex();
    toreturn.aggression=aggression_slidebar.getValue();
    for (int i=0; i < princess_targets_list_model.getSize(); i++) {
      int xpos=Integer.parseInt(((String)princess_targets_list_model.get(i)).substring(0,2)) - 1;
      int ypos=Integer.parseInt(((String)princess_targets_list_model.get(i)).substring(2,4)) - 1;
      System.err.println("adding " + Integer.toString(xpos) + " , "+ Integer.toString(ypos)+ " to strategic targets list");
      toreturn.strategic_targets.add(new Coords(xpos,ypos));
    }
    toreturn.forced_withdrawal=princess_forcedwithdrawal.isSelected();
    toreturn.homeEdge=BasicPathRanker.HomeEdge.getHomeEdge(princess_homeedge.getSelectedIndex());
    return toreturn;
  }
  return null;
}
 

Project Name: megamek Package: megamek.client.ui.swing

Source Code: ConfirmDialog.java (Click to view .java file)

Method Code:
vote
like

public boolean getShowAgain(){
  if (botherCheckbox == null) {
    return true;
  }
  return !botherCheckbox.isSelected();
}
 

Project Name: vfsjfilechooser Package: net.sf.vfsjfilechooser.accessories.bookmarks

Source Code: BookmarksEditorPanel.java (Click to view .java file)

Method Code:
vote
like

private void resetFields(){
  this.isPortTextFieldDirty=false;
  bookmarkNameTextField.setText("");
  hostnameTextField.setText("");
  protocolList.setSelectedItem(Protocol.FTP);
  usernameTextField.setText("");
  passwordTextField.setText("");
  defaultRemotePathTextField.setText("");
  passiveFtpOption.setSelected(true);
}
 

Project Name: vfsjfilechooser Package: net.sf.vfsjfilechooser.accessories.connection

Source Code: ConnectionDialog.java (Click to view .java file)

Method Code:
vote
like

private void resetFields(){
  this.isPortTextFieldDirty=false;
  hostnameTextField.setText("");
  protocolList.setSelectedItem(Protocol.FTP);
  usernameTextField.setText("");
  passwordTextField.setText("");
  defaultRemotePathTextField.setText("");
  passiveFtpOption.setSelected(true);
}
 

Project Name: weka Package: weka.gui

Source Code: GUIChooser.java (Click to view .java file)

Method Code:
vote
like

public void run(){
  JCheckBox dontShow=new JCheckBox("Do not show this message again");
  Object[] stuff=new Object[2];
  stuff[0]="Weka has a package manager that you\n" + "can use to install many learning schemes and tools.\nThe package manager can be " + "found under the \"Tools\" menu.\n";
  stuff[1]=dontShow;
  JOptionPane.showMessageDialog(GUIChooser.this,stuff,"Weka GUIChooser",JOptionPane.OK_OPTION);
  if (dontShow.isSelected()) {
    try {
      Utils.setDontShowDialog("weka.gui.GUIChooser.HowToFindPackageManager");
    }
 catch (    Exception ex) {
    }
  }
}
 

Project Name: weka Package: weka.gui

Source Code: PackageManager.java (Click to view .java file)

Method Code:
vote
like

private void updateInstallUninstallButtonEnablement(){
  boolean enableInstall=false;
  boolean enableUninstall=false;
  m_unofficialBut.setEnabled(true);
  if (!m_installing) {
    int[] selectedRows=m_table.getSelectedRows();
    for (int i=0; i < selectedRows.length; i++) {
      if (!enableInstall || !enableUninstall) {
        enableInstall=true;
        String packageName=m_table.getValueAt(selectedRows[i],getColumnIndex(PACKAGE_COLUMN)).toString();
        try {
          Package p=WekaPackageManager.getRepositoryPackageInfo(packageName);
          if (!enableUninstall) {
            enableUninstall=p.isInstalled();
          }
        }
 catch (        Exception e1) {
          enableUninstall=true;
          enableInstall=false;
        }
      }
    }
  }
 else {
    m_unofficialBut.setEnabled(false);
  }
  m_installBut.setEnabled(enableInstall);
  m_forceBut.setEnabled(enableInstall);
  m_uninstallBut.setEnabled(enableUninstall);
}
 

Project Name: weka Package: weka.gui

Source Code: LogWindow.java (Click to view .java file)

Method Code:
vote
like

/** 
 * toggles the wordwrap<br/>
 * override wordwrap from: 
 * http://forum.java.sun.com/thread.jspa?threadID=498535&messageID=2356174
 */
public void setWordwrap(boolean wrap){
  Container parent;
  JTextPane outputOld;
  m_UseWordwrap=wrap;
  if (m_CheckBoxWordwrap.isSelected() != m_UseWordwrap)   m_CheckBoxWordwrap.setSelected(m_UseWordwrap);
  parent=m_Output.getParent();
  outputOld=m_Output;
  if (m_UseWordwrap)   m_Output=new JTextPane();
 else   m_Output=new JTextPane(){
    private static final long serialVersionUID=-8275856175921425981L;
    public void setSize(    Dimension d){
      if (d.width < getGraphicsConfiguration().getBounds().width)       d.width=getGraphicsConfiguration().getBounds().width;
      super.setSize(d);
    }
    public boolean getScrollableTracksViewportWidth(){
      return false;
    }
  }
;
  m_Output.setEditable(false);
  m_Output.addCaretListener(this);
  m_Output.setDocument(outputOld.getDocument());
  m_Output.setCaretPosition(m_Output.getDocument().getLength());
  parent.add(m_Output);
  parent.remove(outputOld);
}
 

Project Name: weka Package: weka.gui.beans

Source Code: SubstringLabelerCustomizer.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Handle a closing event under an OK condition 
 */
protected void closingOK(){
  StringBuffer buff=new StringBuffer();
  for (int i=0; i < m_listModel.size(); i++) {
    SubstringLabeler.Match m=(SubstringLabeler.Match)m_listModel.elementAt(i);
    buff.append(m.toStringInternal());
    if (i < m_listModel.size() - 1) {
      buff.append("@@match-rule@@");
    }
  }
  m_labeler.setMatchDetails(buff.toString());
  m_labeler.setNominalBinary(m_nominalBinaryCheck.isSelected());
  m_labeler.setConsumeNonMatching(m_consumeNonMatchingCheck.isSelected());
  m_labeler.setMatchAttributeName(m_matchAttNameField.getText());
}
 

Project Name: weka Package: weka.gui.beans

Source Code: KnowledgeFlowApp.java (Click to view .java file)

Method Code:
vote
like

public void actionPerformed(ActionEvent e){
  if (!Utils.getDontShowDialog("weka.gui.beans.KnowledgeFlow.PerspectiveInfo")) {
    JCheckBox dontShow=new JCheckBox("Do not show this message again");
    Object[] stuff=new Object[2];
    stuff[0]="Perspectives are environments that take over the\n" + "Knowledge Flow UI and provide major additional functionality.\n" + "Many perspectives will operate on a set of instances. Instances\n"+ "Can be sent to a perspective by placing a DataSource on the\n"+ "layout canvas, configuring it and then selecting \"Send to perspective\"\n"+ "from the contextual popup menu that appears when you right-click on\n"+ "it. Several perspectives are built in to the Knowledge Flow, others\n"+ "can be installed via the package manager.\n";
    stuff[1]=dontShow;
    JOptionPane.showMessageDialog(KnowledgeFlowApp.this,stuff,"Perspective information",JOptionPane.OK_OPTION);
    if (dontShow.isSelected()) {
      try {
        Utils.setDontShowDialog("weka.gui.beans.KnowledgeFlow.PerspectiveInfo");
      }
 catch (      Exception ex) {
      }
    }
  }
  popupPerspectiveConfigurer();
}
 

Project Name: weka Package: weka.gui.beans

Source Code: ClassifierCustomizer.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Set the classifier object to be edited
 * @param object an <code>Object</code> value
 */
public void setObject(Object object){
  m_dsClassifier=(weka.gui.beans.Classifier)object;
  try {
    m_backup=(weka.classifiers.Classifier)GenericObjectEditor.makeCopy(m_dsClassifier.getClassifierTemplate());
  }
 catch (  Exception ex) {
  }
  m_ClassifierEditor.setEnvironment(m_env);
  m_ClassifierEditor.setTarget(m_dsClassifier.getClassifierTemplate());
  m_resetIncrementalClassifier.setSelected(m_dsClassifier.getResetIncrementalClassifier());
  m_updateIncrementalClassifier.setSelected(m_dsClassifier.getUpdateIncrementalClassifier());
  m_executionSlotsText.setText("" + m_dsClassifier.getExecutionSlots());
  m_blockOnLastFold.setSelected(m_dsClassifier.getBlockOnLastFold());
  checkOnClassifierType();
}
 

Project Name: weka Package: weka.gui.beans

Source Code: SerializedModelSaverCustomizer.java (Click to view .java file)

Method Code:
vote
like

public void actionPerformed(ActionEvent e){
  try {
    m_smSaver.setPrefix(m_prefixText.getText());
    m_smSaver.setDirectory(new File(m_directoryText.getText()));
    m_smSaver.setIncludeRelationName(m_includeRelationName.isSelected());
    m_smSaver.setUseRelativePath(m_relativeFilePath.isSelected());
    Tag selected=(Tag)m_fileFormatBox.getSelectedItem();
    if (selected != null) {
      m_smSaver.setFileFormat(selected);
    }
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  if (m_modifyListener != null) {
    m_modifyListener.setModifiedStatus(SerializedModelSaverCustomizer.this,true);
  }
  m_parentWindow.dispose();
}
 

Project Name: weka Package: weka.gui.beans

Source Code: SaverCustomizer.java (Click to view .java file)

Method Code:
vote
like

public void actionPerformed(ActionEvent e){
  try {
    (m_dsSaver.getSaverTemplate()).setFilePrefix(m_prefixText.getText());
    (m_dsSaver.getSaverTemplate()).setDir(m_directoryText.getText());
    m_dsSaver.setRelationNameForFilename(m_relationNameForFilename.isSelected());
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  if (m_modifyListener != null) {
    m_modifyListener.setModifiedStatus(SaverCustomizer.this,true);
  }
  m_parentWindow.dispose();
}
 

Project Name: weka Package: weka.gui.beans

Source Code: SubstringReplacerCustomizer.java (Click to view .java file)

Method Code:
vote
like

public void actionPerformed(ActionEvent e){
  Object mr=m_list.getSelectedValue();
  if (mr != null) {
    ((SubstringReplacer.MatchReplace)mr).setIgnoreCase(m_ignoreCaseCheck.isSelected());
    m_list.repaint();
  }
}
 

Project Name: weka Package: weka.gui.boundaryvisualizer

Source Code: BoundaryVisualizer.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Sets up the BoundaryPanel object so that it is ready for plotting.
 * @return an error code:<br/>
 * 0 - SUCCESS<br/>
 * 1 - ERROR - Kernel bandwidth < 0<br/>
 * 2 - ERROR - Kernel bandwidth >= number of training instances.
 */
public int setUpBoundaryPanel() throws Exception {
  int returner=0;
  int tempSamples=m_numberOfSamplesFromEachRegion;
  try {
    tempSamples=Integer.parseInt(m_regionSamplesText.getText().trim());
  }
 catch (  Exception ex) {
    m_regionSamplesText.setText("" + tempSamples);
  }
  m_numberOfSamplesFromEachRegion=tempSamples;
  m_boundaryPanel.setNumSamplesPerRegion(tempSamples);
  tempSamples=m_generatorSamplesBase;
  try {
    tempSamples=Integer.parseInt(m_generatorSamplesText.getText().trim());
  }
 catch (  Exception ex) {
    m_generatorSamplesText.setText("" + tempSamples);
  }
  m_generatorSamplesBase=tempSamples;
  m_boundaryPanel.setGeneratorSamplesBase((double)tempSamples);
  tempSamples=m_kernelBandwidth;
  try {
    tempSamples=Integer.parseInt(m_kernelBandwidthText.getText().trim());
  }
 catch (  Exception ex) {
    m_kernelBandwidthText.setText("" + tempSamples);
  }
  m_kernelBandwidth=tempSamples;
  m_dataGenerator.setKernelBandwidth(tempSamples);
  if (m_kernelBandwidth < 0)   returner=1;
  if (m_kernelBandwidth >= m_trainingInstances.numInstances())   returner=2;
  m_trainingInstances.setClassIndex(m_classAttBox.getSelectedIndex());
  m_boundaryPanel.setClassifier(m_classifier);
  m_boundaryPanel.setTrainingData(m_trainingInstances);
  m_boundaryPanel.setXAttribute(m_xIndex);
  m_boundaryPanel.setYAttribute(m_yIndex);
  m_boundaryPanel.setPlotTrainingData(m_plotTrainingData.isSelected());
  return returner;
}
 

Project Name: weka Package: weka.gui.experiment

Source Code: OutputFormatDialog.java (Click to view .java file)

Method Code:
vote
like

/** 
 * gets the data from GUI components.
 */
private void getData(){
  if (m_IgnoreChanges)   return;
  try {
    if (!m_ResultMatrix.getClass().equals(m_OutputFormatClasses.get(m_OutputFormatComboBox.getSelectedIndex()))) {
      if (m_OutputFormatClasses.get(m_OutputFormatComboBox.getSelectedIndex()).equals(ExperimenterDefaults.getOutputFormat().getClass()))       m_ResultMatrix=ExperimenterDefaults.getOutputFormat();
 else       m_ResultMatrix=(ResultMatrix)((Class)m_OutputFormatClasses.get(m_OutputFormatComboBox.getSelectedIndex())).newInstance();
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    m_ResultMatrix=new ResultMatrixPlainText();
  }
  m_ResultMatrix.setMeanPrec(Integer.parseInt(m_MeanPrecSpinner.getValue().toString()));
  m_ResultMatrix.setStdDevPrec(Integer.parseInt(m_StdDevPrecSpinner.getValue().toString()));
  m_ResultMatrix.setShowAverage(m_ShowAverageCheckBox.isSelected());
  m_ResultMatrix.setRemoveFilterName(m_RemoveFilterNameCheckBox.isSelected());
  m_ResultMatrixEditor.setValue(m_ResultMatrix);
}
 

Project Name: weka Package: weka.gui.experiment

Source Code: ResultsPanel.java (Click to view .java file)

Method Code:
vote
like

/** 
 * displays the Dialog for the output format and sets the chosen settings, 
 * if the user approves.
 */
public void setOutputFormatFromDialog(){
  OutputFormatDialog dialog=new OutputFormatDialog(PropertyDialog.getParentFrame(this));
  m_ResultMatrix.setShowStdDev(m_ShowStdDevs.isSelected());
  dialog.setResultMatrix(m_ResultMatrix);
  dialog.setLocationRelativeTo(this);
  if (dialog.showDialog() == OutputFormatDialog.APPROVE_OPTION) {
    m_ResultMatrix=dialog.getResultMatrix();
    m_ShowStdDevs.setSelected(m_ResultMatrix.getShowStdDev());
  }
}
 

Project Name: weka Package: weka.gui.experiment

Source Code: DistributeExperimentPanel.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Enable objects to listen for changes to the check box
 * @param al an ActionListener
 */
public void addCheckBoxActionListener(ActionListener al){
  m_enableDistributedExperiment.addActionListener(al);
}
 

Project Name: weka Package: weka.gui.explorer

Source Code: PreprocessPanel.java (Click to view .java file)

Method Code:
vote
like

public void run(){
  try {
    final DataGeneratorPanel generatorPanel=new DataGeneratorPanel();
    final JDialog dialog=new JDialog();
    final JButton generateButton=new JButton("Generate");
    final JCheckBox showOutputCheckBox=new JCheckBox("Show generated data as text, incl. comments");
    showOutputCheckBox.setMnemonic('S');
    generatorPanel.setLog(m_Log);
    generatorPanel.setGenerator(m_DataGenerator);
    generatorPanel.setPreferredSize(new Dimension(300,(int)generatorPanel.getPreferredSize().getHeight()));
    generateButton.setMnemonic('G');
    generateButton.setToolTipText("Generates the dataset according the settings.");
    generateButton.addActionListener(new ActionListener(){
      public void actionPerformed(      ActionEvent evt){
        generatorPanel.execute();
        boolean generated=(generatorPanel.getInstances() != null);
        if (generated)         setInstances(generatorPanel.getInstances());
        dialog.dispose();
        m_DataGenerator=generatorPanel.getGenerator();
        if ((generated) && (showOutputCheckBox.isSelected()))         showGeneratedInstances(generatorPanel.getOutput());
      }
    }
);
    dialog.setTitle("DataGenerator");
    dialog.getContentPane().add(generatorPanel,BorderLayout.CENTER);
    dialog.getContentPane().add(generateButton,BorderLayout.EAST);
    dialog.getContentPane().add(showOutputCheckBox,BorderLayout.SOUTH);
    dialog.pack();
    dialog.setVisible(true);
  }
 catch (  Exception ex) {
    ex.printStackTrace();
    m_Log.logMessage(ex.getMessage());
  }
  m_IOThread=null;
}
 

Project Name: weka Package: weka.gui.sql

Source Code: SqlViewerDialog.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Returns whether sparse data is generated.
 * @return		true if sparse data is to be generated
 */
public boolean getGenerateSparseData(){
  return m_CheckBoxSparseData.isSelected();
}
 

Project Name: weka Package: weka.gui.visualize

Source Code: MatrixPanel.java (Click to view .java file)

Method Code:
vote
like

/** 
 * paints this JPanel (PlotsPanel)
 */
public void paintComponent(Graphics g){
  paintME(g);
  if (m_osi != null && m_fastScroll.isSelected()) {
    g.drawImage(m_osi,0,0,this);
  }
}
 

Project Name: weka Package: weka.gui.visualize

Source Code: PrintableComponent.java (Click to view .java file)

Method Code:
vote
like

/** 
 * displays a save dialog for saving the panel to a file.  
 * Fixes a bug with the Swing JFileChooser: if you entered a new
 * filename in the save dialog and press Enter the <code>getSelectedFile</code>
 * method returns <code>null</code> instead of the filename.<br>
 * To solve this annoying behavior we call the save dialog once again s.t. the
 * filename is set. Might look a little bit strange to the user, but no 
 * NullPointerException! ;-)
 */
public void saveComponent(){
  int result;
  JComponentWriter writer;
  File file;
  JComponentWriterFileFilter filter;
  m_FileChooserPanel.setDialogTitle(getSaveDialogTitle());
  do {
    result=m_FileChooserPanel.showSaveDialog(getComponent());
    if (result != JFileChooser.APPROVE_OPTION)     return;
  }
 while (m_FileChooserPanel.getSelectedFile() == null);
  try {
    filter=(JComponentWriterFileFilter)m_FileChooserPanel.getFileFilter();
    file=m_FileChooserPanel.getSelectedFile();
    writer=filter.getWriter();
    if (!file.getAbsolutePath().toLowerCase().endsWith(writer.getExtension().toLowerCase()))     file=new File(file.getAbsolutePath() + writer.getExtension());
    writer.setComponent(getComponent());
    writer.setFile(file);
    writer.setScale(getXScale(),getYScale());
    writer.setUseCustomDimensions(m_CustomDimensionsCheckBox.isSelected());
    if (m_CustomDimensionsCheckBox.isSelected()) {
      writer.setCustomWidth(Integer.parseInt(m_CustomWidthText.getText()));
      writer.setCustomHeight(Integer.parseInt(m_CustomHeightText.getText()));
    }
 else {
      writer.setCustomWidth(-1);
      writer.setCustomHeight(-1);
    }
    writer.toOutput();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}