weka.gui.beans.EnvironmentField Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weka-dev Show documentation
Show all versions of weka-dev Show documentation
The Waikato Environment for Knowledge Analysis (WEKA), a machine
learning workbench. This version represents the developer version, the
"bleeding edge" of development, you could say. New functionality gets added
to this version.
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/*
* EnvironmentField.java
* Copyright (C) 2009-2012 University of Waikato, Hamilton, New Zealand
*
*/
package weka.gui.beans;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyEditor;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import weka.core.Environment;
import weka.core.EnvironmentHandler;
import weka.gui.CustomPanelSupplier;
/**
* Widget that displays a label and a combo box for selecting environment
* variables. The enter arbitrary text, select an environment variable or a
* combination of both. Any variables are resolved (if possible) and resolved
* values are displayed in a tip-text.
*
* @author Mark Hall (mhall{[at]}pentaho{[dot]}com)
* @version $Revision: 10220 $
*/
public class EnvironmentField extends JPanel implements EnvironmentHandler,
PropertyEditor, CustomPanelSupplier {
/** For serialization */
private static final long serialVersionUID = -3125404573324734121L;
/** The label for the widget */
protected JLabel m_label;
/** The combo box */
protected JComboBox m_combo;
/** The current environment variables */
protected Environment m_env;
protected String m_currentContents = "";
protected int m_firstCaretPos = 0;
protected int m_previousCaretPos = 0;
protected int m_currentCaretPos = 0;
protected PropertyChangeSupport m_support = new PropertyChangeSupport(this);
/**
* Combo box that allows the drop-down list to be wider than the component
* itself.
*
* @author Mark Hall (mhall{[at]}pentaho{[dot]}com)
*/
public static class WideComboBox extends JComboBox {
/**
* For serialization
*/
private static final long serialVersionUID = -6512065375459733517L;
public WideComboBox() {
}
public WideComboBox(final Object items[]) {
super(items);
}
public WideComboBox(Vector
© 2015 - 2024 Weber Informatics LLC | Privacy Policy