Home > Back-end >  Add event Java interface design
Add event Java interface design

Time:09-20

O answer!!!!! Interface has been written, is the event didn't write it, write half wrong, thank you!!!!!!

CodePudding user response:

 package CSDN. 

Import the Java. The awt. BorderLayout.
import java.awt.Color;
import java.awt.Font;
Import the Java. The awt. GridLayout;
Import the Java. The awt. Event. An ActionEvent;
Import the Java. The awt. Event. ActionListener;

The import javax.mail. Swing. ButtonGroup;
The import javax.mail. Swing. JButton;
The import javax.mail. Swing. JFrame;
The import javax.mail. Swing. JLabel;
The import javax.mail. Swing. JPanel;
The import javax.mail. Swing. JRadioButton;
The import javax.mail. Swing. JTextField;

@ SuppressWarnings (" serial ")
Public class DataTransfer extends JFrame {
Private JLabel label1=null;
Private JTextField tf1=null;
Private JRadioButton rBtn1=null;
Private JRadioButton rBtn2=null;
Private JRadioButton rBtn3=null;
Private JRadioButton rBtn4=null;

Private JLabel label2=null;
Private JTextField tf2=null;
Private JRadioButton rBtn5=null;
Private JRadioButton rBtn6=null;
Private JRadioButton rBtn7=null;
Private JRadioButton rBtn8=null;

Strings str1 str2;

Private JButton btn1=null;
Private JButton btn2=null;

Private JPanel panel0=new JPanel ();
Private JPanel panel1=new JPanel ();
Private JPanel panel2=new JPanel ();
Private JPanel panel3=new JPanel ();
Private JPanel panel4=new JPanel ();
Private JPanel panel5=new JPanel ();
Private JPanel panel6=new JPanel ();
Private JPanel panel7=new JPanel ();

Public DataTransfer () {
super();
Enclosing setTitle (" Gui experimental subject ");
Enclosing setBounds (100, 100, 400, 400);
Panel0. SetLayout (new GridLayout (7, 1));
Enclosing setContentPane (panel0);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
This.com ponentInit ();
Enclosing addActionListener ();
this.setVisible(true);
}



/* *
* action to monitor
*/
Private void addActionListener () {
Btn1. AddActionListener (new ActionListener () {
@ Override
Public void actionPerformed (an ActionEvent e) {
{if (rBtn1. An isSelected ())
If (rBtn5. An isSelected ()) {//2
Tf2. SetText (tf1. GetText ());
} else if (rBtn6. An isSelected ()) {//8
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1, 2);
Str1=Integer. ToOctalString (I);
Tf2. SetText (str1);
} else if (rBtn7. An isSelected ()) {//10
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1, 2);
Str1=Integer. ToString (I);
Tf2. SetText (str1);
} else if (rBtn8. An isSelected ()) {//16
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1, 2);
Str1=Integer. ToHexString (I);
Tf2. SetText (str1);
}
} else if (rBtn2. An isSelected ()) {
If (rBtn5. An isSelected ()) {//2
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1, 8).
Str1=Integer. ToBinaryString (I);
Tf2. SetText (str1);
} else if (rBtn6. An isSelected ()) {//8
Tf2. SetText (tf1. GetText ());
} else if (rBtn7. An isSelected ()) {//10
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1, 8).
Str1=Integer. ToString (I);
Tf2. SetText (str1);
} else if (rBtn8. An isSelected ()) {//16
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1, 8).
Str1=Integer. ToHexString (I);
Tf2. SetText (str1);
}
} else if (rBtn3. An isSelected ()) {
If (rBtn5. An isSelected ()) {//2
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1);
Str1=Integer. ToBinaryString (I);
Tf2. SetText (str1);
} else if (rBtn6. An isSelected ()) {//8
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1);
Str1=Integer. ToOctalString (I);
Tf2. SetText (str1);
} else if (rBtn7. An isSelected ()) {//10
Tf2. SetText (tf1. GetText ());
} else if (rBtn8. An isSelected ()) {//16
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1);
Str1=Integer. ToHexString (I);
Tf2. SetText (str1);
}
} else if (rBtn4. An isSelected ()) {
If (rBtn5. An isSelected ()) {//2
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1, 16);
Str1=Integer. ToBinaryString (I);
Tf2. SetText (str1);
} else if (rBtn6. An isSelected ()) {//8
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1, 16);
Str1=Integer. ToOctalString (I);
Tf2. SetText (str1);
} else if (rBtn7. An isSelected ()) {//10
Str1=tf1. GetText ();
Int I=Integer. The valueOf (str1, 16);
Str1=Integer. ToString (I);
Tf2. SetText (str1);
} else if (rBtn8. An isSelected ()) {//16
Tf2. SetText (tf1. GetText ());
}
}
}
});

Btn2. AddActionListener (new ActionListener () {
@ Override
Public void actionPerformed (an ActionEvent e) {
System. The exit (0);
}
});
}

/* *
* add the component
*/
Private void componentInit () {
////////////////////////////
Label1=new JLabel (" data conversion ");
Label1. SetForeground (Color. RED); nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related