Package com.cburch.draw.util

Source Code of com.cburch.draw.util.EditableLabelField

/* Copyright (c) 2010, Carl Burch. License information is located in the
* com.cburch.logisim.Main source code and at www.cburch.com/logisim/. */

package com.cburch.draw.util;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.BorderFactory;
import javax.swing.JTextField;

public class EditableLabelField extends JTextField {
  static final int FIELD_BORDER = 2;

  public EditableLabelField() {
    super(10);
    setBackground(new Color(255, 255, 255, 128));
    setOpaque(false);
    setBorder(BorderFactory.createCompoundBorder(
        BorderFactory.createLineBorder(Color.BLACK),
        BorderFactory.createEmptyBorder(1, 1, 1, 1)));
  }
 
  @Override
  protected void paintComponent(Graphics g) {
    g.setColor(getBackground());
    g.fillRect(0,0, getWidth(),getHeight());
    super.paintComponent(g);
  }
}
TOP

Related Classes of com.cburch.draw.util.EditableLabelField

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.