Если кто изучал Java, и кто понимает в чём ошибки, можете написать этот же код с учётом ошибок пожалуйста.//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import javax.swing.JButton; import javax.swing.JTextField; import javax.swing.JCheckBox; import javax.swing.Jlist; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.Color; public class SwingDemoHelp extends JFrame{ private final String[] data1 = { "if" ,"switch" ,"for","while", "do-while"}; public SwingDemoHelp() { JFrame jfrm = new JFrame(*Java Sintaxyx*); jfrm.setSize(600, 300); jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jfrm.setVisible(true); JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); Jlable jlab = new JLable("Информация об ключевых словах Java"); JButton button1 = new JButton("Info"); button1.setPreferredSize(new Dimension(60, 25)); Checkbox checkbox1 = new Checkbox("Red"); Checkbox checkbox2 = new Checkbox("Green"); Checkbox checkbox3 = new Checkbox("Blue"); checkbox1.setBackground(Color.red); checkbox2.setBackground(Color.green); checkbox3.setBackground(Color.blue); add(checkbox1); add(checkbox2); add(checkbox3); Jlist list = new Jlist(); list.addListSelectionListener(new ListSelectionListener()){ public void valueChanged(ListSelectionEvent arg0){ String operator = list.getSelectedValue().toString(); switch (operator){ case "if": button1.setActionCommand("if(условие) - оператор условия, else - второй оператор условия"); break; case "switch": button1.setActionCommand("switch(выражение) - оператор сбора выражений для константы case - оператора выбора"); break; case "for": button1.setActionCommand("for - оператор инициализации, условия, итерации, простой оператор"); break; case "whille": button1.setActionCommand("while(условие) оператор"); break; case "do-whille": button1.setActionCommand("do { Оператор } while (условине)"); break; } } } } } public static void main(String args[]) { // Create the frame on the event dispatching thread. SwingUtilities.invokeLater(new Runnable()){ public void run() { new SwingDemo(); } } }


/////////////////////////////////////////////////////////////////////////////////////////////////////Вот что говорит отладчик: Main.java:20: error: illegal start of expression JFrame jfrm = new JFrame(*Java Sintaxyx*); ^ Main.java:20: error: ')' expected JFrame jfrm = new JFrame(*Java Sintaxyx*); ^ Main.java:20: error: illegal start of expression JFrame jfrm = new JFrame(*Java Sintaxyx*); ^ Main.java:20: error: ';' expected JFrame jfrm = new JFrame(*Java Sintaxyx*); ^ Main.java:47: error: ';' expected list.addListSelectionListener(new ListSelectionListener()){ ^ Main.java:48: error: illegal start of expression public void valueChanged(ListSelectionEvent arg0){ ^ Main.java:48: error: illegal start of expression public void valueChanged(ListSelectionEvent arg0){ ^ Main.java:48: error: ';' expected public void valueChanged(ListSelectionEvent arg0){ ^ Main.java:48: error: ';' expected public void valueChanged(ListSelectionEvent arg0){ ^ Main.java:75: error: class, interface, or enum expected public static void main(String args[]) { ^ Main.java:78: error: class, interface, or enum expected public void run() { ^ Main.java:80: error: class, interface, or enum expected } ^ 12 errors
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.