Nome da classe Classe JFrame

1 resposta
Thaylan_Araujo

eu queria saber porque a minha classe na qual eu estendo o JFrame fica com o seu nome sublinhado de amarelo?

package ExemplosApostilas;

import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;

public class ExemploRadioButton extends JFrame
{
	private JTextField textField;
	private Font plainFont;
	private Font boldFont;
	private Font italicFont;
	private Font boldItalicFont;
	private JRadioButton plainRadioButton;
	private JRadioButton boldRadioButton;
	private JRadioButton italicRadioButton;
	private JRadioButton boldItalicRadioButton;
	private ButtonGroup radioGroup;
	
	public ExemploRadioButton()
	{
		super("Usando RadioButton");
		setLayout(new FlowLayout());
		
		textField = new JTextField("Observe a nudança de estilo da fonte", 25);
		add(textField);
		
		plainRadioButton = new JRadioButton("Plain", true);
		boldRadioButton = new JRadioButton("Bold", false);
		italicRadioButton = new JRadioButton("Italic", false);
		boldItalicRadioButton = new JRadioButton("Bold", false);
		add(plainRadioButton);
		add(italicRadioButton);
		add(boldRadioButton);
		add(boldItalicRadioButton);
		
		radioGroup = new ButtonGroup();
		radioGroup.add(plainRadioButton);
		radioGroup.add(boldRadioButton);
		radioGroup.add(italicRadioButton);
		radioGroup.add(boldItalicRadioButton);
		
		plainFont = new Font("Serif", Font.PLAIN,14);
		boldFont = new Font("Serif", Font.BOLD, 14);
		italicFont = new Font("Serif", Font.ITALIC, 14);
		boldItalicFont = new Font("Serif", Font.BOLD + Font.ITALIC, 14);
		textField.setFont(plainFont);
		
		plainRadioButton.addItemListener(new RadioButtonHandler(plainFont));
		boldRadioButton.addItemListener(new RadioButtonHandler(boldFont));
		italicRadioButton.addItemListener(new RadioButtonHandler(italicFont));
		boldItalicRadioButton.addItemListener(new RadioButtonHandler(boldItalicFont));
	}
	
	private class RadioButtonHandler implements ItemListener
	{
		Font font;
		
		public RadioButtonHandler(Font f)
		{
			font = f;
		}
		
		public void itemStateChanged(ItemEvent i)
		{
			textField.setFont(font);
		}
	}
	
	public static void main(String [] args)
	{
		ExemploRadioButton erb = new ExemploRadioButton();
		erb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		erb.setSize(300, 100);
		erb.setVisible(true);
	}
}

1 Resposta

Demys_Cota

É só pra vc criar um id de versão da sua classe, ou fazer ela implementar Serializable

Criado 14 de abril de 2013
Ultima resposta 28 de abr. de 2013
Respostas 1
Participantes 2