< prev index next >

src/share/classes/sun/tools/jconsole/inspector/XTextField.java

Print this page
rev 1501 : 7017818: NLS: JConsoleResources.java cannot be handled by translation team
Reviewed-by: mchung, mfang

@@ -23,16 +23,11 @@
  * questions.
  */
 package sun.tools.jconsole.inspector;
 
 import java.awt.*;
-import java.awt.dnd.*;
 import java.awt.event.*;
-import java.awt.datatransfer.*;
-import java.io.*;
-import java.util.*;
-import javax.swing.plaf.*;
 import javax.swing.event.*;
 import javax.swing.*;
 
 
 /**

@@ -41,20 +36,12 @@
 @SuppressWarnings("serial")
 public class XTextField extends JPanel
     implements DocumentListener,
                ActionListener {
 
-    private static final Color selF = Color.red;
-    private static final Color selB = Color.yellow;
-    private Color fore=null, back=null;
-    private HashMap items = null; //used for popup menu selection
     private XObject selectedObject;
-    private XObject currentObject;
-    private Class expectedClass;
-    private Object value;
     protected JTextField textField;
-    private JButton browseObjects;
 
     private static boolean allowNullSelection = false;
 
     protected final static int COMPATIBLE_VALUE = 1;
     protected final static int CURRENT_VALUE = 2;

@@ -78,17 +65,16 @@
     public XTextField(Object value, int colWidth) {
         this(value,value.getClass(),colWidth, true, null, null);
     }
 
     public XTextField(Object value,
-                      Class expectedClass,
+                      Class<?> expectedClass,
                       int colWidth,
                       boolean isCallable,
                       JButton button,
                       XOperations operation) {
         super(new BorderLayout());
-        this.expectedClass = expectedClass;
         this.button = button;
         this.operation = operation;
         add(textField = new JTextField(value.toString(),colWidth),
             BorderLayout.CENTER);
         if(isCallable)

@@ -109,21 +95,17 @@
 
     public static boolean getNullSelectionAllowed() {
         return allowNullSelection;
     }
 
-    protected void init(Object value, Class expectedClass) {
-        this.expectedClass = expectedClass;
-        this.value = value;
+    protected void init(Object value, Class<?> expectedClass) {
         boolean fieldEditable =  Utils.isEditableType(expectedClass.getName());
         clearObject();
         if (value != null) {
-            currentObject = new XObject(value);
             textField.setText(value.toString());
         }
         else {
-            currentObject = XObject.NULL_OBJECT;
             //null String value for the moment
             textField.setText("");
         }
         textField.setToolTipText(null);
         if (fieldEditable) {

@@ -137,39 +119,16 @@
                 textField.setEditable(false);
             }
         }
     }
 
-
-
-
-
-    private synchronized void setObject(XObject object) {
-        clearObject();
-        selectedObject = object;
-        currentObject = object;
-        setSelectedColors();
-        textField.setText(object.getText());
-        textField.getDocument().addDocumentListener(this);
-        paintImmediately(getVisibleRect());
-    }
-
     private synchronized void clearObject() {
         textField.getDocument().removeDocumentListener(this);
         selectedObject = null;
-        currentObject = null;
         setDefaultColors();
     }
 
-    private synchronized void setSelectedColors() {
-        // fore = textField.getForeground();
-        // back = textField.getBackground();
-
-        //textField.setForeground(Color.red);
-        // textField.setBackground(Color.yellow);
-    }
-
     private synchronized void setDefaultColors() {
         //  if (fore != null) textField.setForeground(fore);
         // if (back != null)  textField.setBackground(back);
     }
 

@@ -191,16 +150,10 @@
         else {
             return null;
         }
     }
 
-    private JPopupMenu buildEditPopupMenu() {
-        JPopupMenu menu = new JPopupMenu();
-        return menu;
-    }
-
-
     // ACTIONLISTENER IMPLEMENTATION
     public void actionPerformed(ActionEvent e) {
         if (e.getSource() instanceof JTextField) {
             if(operation != null)
                 operation.performInvokeRequest(button);
< prev index next >