import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.util.*; import java.io.*; import EqAfin; public class EqPanel extends JPanel { JTextField A; JTextField B; JTextField C; JTextField D; JTextField E; JTextField F; JTextField P; JButton Col; EqPanel(EqAfin Eq) { setLayout(new GridLayout(1,8)); setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""),BorderFactory.createEmptyBorder(0,0,0,0))); A=new JTextField(Double.toString(((double)Math.round((double)(Eq.getA())/8.192))/1000),5); B=new JTextField(Double.toString(((double)Math.round((double)(Eq.getB())/8.192))/1000),5); C=new JTextField(Double.toString(((double)Math.round((double)(Eq.getC())/8.192))/1000),5); D=new JTextField(Double.toString(((double)Math.round((double)(Eq.getD())/8.192))/1000),5); E=new JTextField(Double.toString(((double)Math.round((double)(Eq.getE())/8.192))/1000),5); F=new JTextField(Double.toString(((double)Math.round((double)(Eq.getF())/8.192))/1000),5); P=new JTextField(Double.toString(((double)Math.round((double)(Eq.getP())/8.192))/1000),5); Col=new JButton(); Col.setBackground(Eq.getCol()); Col.addActionListener(CBut); add(A); add(B); add(C); add(D); add(E); add(F); add(P); add(Col); } EqAfin getEq() { EqAfin Eq=new EqAfin((int)(8192*Double.parseDouble(A.getText())),(int)(8192*Double.parseDouble(B.getText())),(int)(8192*Double.parseDouble(C.getText())),(int)(8192*Double.parseDouble(D.getText())),(int)(8192*Double.parseDouble(E.getText())),(int)(8192*Double.parseDouble(F.getText())),(int)(8192*Double.parseDouble(P.getText())),Col.getBackground()); return Eq; } ActionListener CBut = new ActionListener() { public void actionPerformed(ActionEvent evento) { Color c; c=JColorChooser.showDialog(EqPanel.this,"Seleccione Color",((JButton)(evento.getSource())).getBackground()); if (c!=null) { ((JButton)(evento.getSource())).setBackground(c); } } }; }