Hello. There is a finished project. Using the plugin is not displayed correctly. For some reason, connections are not displayed (inheritance from JApplet and ActionListener). Arrows are not displayed, why so? Here is the code:

package keyboard_app; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class ScreenKeyboard extends JApplet implements ActionListener { String row1[] = {"1","2","3","4","5","6","7","8","9","0","Backspace"}; String row2[] = {"Q","W","E","R","T","Y","U","I","O","P","Enter"}; String row3[] = {"A","S","D","F","G","H","J","K","L",":","Shift"}; String row4[] = {"Z","X","C","V","B","N","M",",",".","?","Spacebar"}; JButton first[]; JButton second[]; JButton third[]; JButton fourth[]; JTextArea ta; private boolean shiftPressed = false; public void init(){ ta = new JTextArea(); ta.setFont(new Font("Times New Roman", 1, 18)); JLabel l = new JLabel("Enter your message here:" ); l.setFont(new Font("TimesNewRoman",Font.BOLD,14)); setLayout(new BorderLayout()); JPanel jpNorth = new JPanel(); JPanel jpCenter = new JPanel(); JPanel jpButtons = new JPanel(); add(jpNorth, BorderLayout.NORTH); add(jpCenter, BorderLayout.CENTER); add(jpButtons, BorderLayout.SOUTH); jpNorth.setLayout(new BorderLayout()); jpNorth.add(l, BorderLayout.WEST); jpNorth.add(l, BorderLayout.SOUTH); jpCenter.setLayout( new BorderLayout()); jpCenter.add(ta, BorderLayout.WEST); jpCenter.add(ta, BorderLayout.CENTER); jpButtons.setLayout(new GridLayout(4,1)); first = new JButton[row1.length]; JPanel p = new JPanel(new GridLayout(1, row1.length)); for(int i = 0; i < row1.length; i++) { JButton bt = new JButton(row1[i]); bt.setPreferredSize(new Dimension(100,50)); first[i] = bt; p.add(first[i]); } jpButtons.add(p); second = new JButton[row2.length]; p = new JPanel(new GridLayout(1, row2.length)); for(int i = 0; i < row2.length; i++) { second[i] = new JButton(row2[i]); p.add(second[i]); } jpButtons.add(p); third = new JButton[row3.length]; p = new JPanel(new GridLayout(1, row3.length)); for(int i = 0; i < row3.length; i++) { third[i] = new JButton(row3[i]); p.add(third[i]); } jpButtons.add(p); fourth = new JButton[row4.length]; p = new JPanel(new GridLayout(1, row4.length)); for(int i = 0; i < row4.length; ++i) { fourth[i] = new JButton(row4[i]); p.add(fourth[i]); } jpButtons.add(p); for(JButton bt : first) bt.addActionListener(this); for(JButton bt : second) bt.addActionListener(this); for(JButton bt : third) bt.addActionListener(this); for(JButton bt : fourth) bt.addActionListener(this); } public void actionPerformed(ActionEvent ae){ String ac = ae.getActionCommand(); String text; switch (ac) { case "Enter": ta.setText(ta.getText() + "\n"); break; case "Spacebar": ta.setText(ta.getText() + " "); break; case "Backspace": text = ta.getText(); ta.setText(text.substring(0, text.length() - 1)); break; case "Shift": shiftPressed = (shiftPressed) ? false : true; break; default: text = String.valueOf(ac); text = (shiftPressed) ? text.toUpperCase() : text.toLowerCase(); ta.setText(ta.getText() + text); break; } } } 

And here are my actions: enter image description here enter image description here enter image description here enter image description here enter image description here

  • So can you somehow do this? - Muscled Boy pm

1 answer 1

In general, the answer is found. First you need to install a special plugin, their various modifications can be freely found on the Internet. The fact that there are no arrows is normal, because JApplet is a standard library class.