Как конвертировать из awt в swing на java
package cubaawt1; import java.awt.*; public class L1F1044 { L1F1044() { Frame f = new Frame(""); f.setBackground(Color.pink); f.setSize(360,400); f.setLayout(new BorderLayout()); //menu bar declaration MenuBar menubar = new MenuBar(); Menu menu = new Menu("Menu"); MenuItem mi1 =new MenuItem("Introduction"); MenuItem mi2 = new MenuItem("Exit"); menu.add(mi1); menu.add(mi2); menubar.add(menu); f.setMenuBar(menubar); //set label and label declaration Label label = new Label("My Mini Calculator- by Akashah"); //make panel for My mini Calculator... Panel p1 = new Panel(); p1.setBackground(Color.cyan); p1.setFont(new Font("Monospaced",Font.PLAIN,18)); p1.add(label); f.add("North",p1); //label 1 Label lbl1 = new Label("First Number"); lbl1.setForeground(Color.darkGray); TextField tf1 = new TextField(15); //label 2 Label lbl2 = new Label("Second Number"); lbl2.setForeground(Color.darkGray); TextField tf2 = new TextField(15); //label 3 Label lbl3 = new Label("Result"); lbl3.setForeground(Color.darkGray); TextField tf3 = new TextField(15); tf3.setEditable(false); Button btn5 = new Button("Clear"); //add all label and btn5 in panel p2 Panel p2 = new Panel(); p2.add(lbl1); p2.add(tf1); p2.add(lbl2); p2.add(tf2); p2.add(lbl3); p2.add(tf3); p2.add(btn5); f.add(p2); Button btn1 = new Button("Add"); Button btn2 = new Button("Sub"); Button btn3 = new Button("Mult"); Button btn4 = new Button("Div"); Panel p3 = new Panel(); p3.setBackground(Color.gray); p3.add(btn1); p3.add(btn2); p3.add(btn3); p3.add(btn4); f.add("East",p3); f.setVisible(true); } public static void main(String [] args) { //call method L1F1044 L1F1044 Lab = new L1F1044(); } }
Что я уже пробовал:
[ничего]