Example #1
0
    @Override
    public void installUI(JComponent c) {
      super.installUI(c);

      jtf = (JTextField) c;

      JTextField editor = jtf;

      UIDefaults uidefaults = XToolkit.getUIDefaults();

      String prefix = getPropertyPrefix();
      Font f = editor.getFont();
      if ((f == null) || (f instanceof UIResource)) {
        editor.setFont(uidefaults.getFont(prefix + ".font"));
      }

      Color bg = editor.getBackground();
      if ((bg == null) || (bg instanceof UIResource)) {
        editor.setBackground(uidefaults.getColor(prefix + ".background"));
      }

      Color fg = editor.getForeground();
      if ((fg == null) || (fg instanceof UIResource)) {
        editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
      }

      Color color = editor.getCaretColor();
      if ((color == null) || (color instanceof UIResource)) {
        editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
      }

      Color s = editor.getSelectionColor();
      if ((s == null) || (s instanceof UIResource)) {
        editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
      }

      Color sfg = editor.getSelectedTextColor();
      if ((sfg == null) || (sfg instanceof UIResource)) {
        editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
      }

      Color dfg = editor.getDisabledTextColor();
      if ((dfg == null) || (dfg instanceof UIResource)) {
        editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
      }

      Border b = editor.getBorder();
      if ((b == null) || (b instanceof UIResource)) {
        editor.setBorder(uidefaults.getBorder(prefix + ".border"));
      }

      Insets margin = editor.getMargin();
      if (margin == null || margin instanceof UIResource) {
        editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
      }
    }
  public ConsoleWindow() {
    if (gui) {
      window = new JFrame("Package Tracking Console");
      window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      window.setSize((int) (screenSize.getWidth() / 4), (int) (screenSize.getHeight() / 1.5));
      window.setLocationRelativeTo(null);
      window.getContentPane().setLayout(new BorderLayout());

      menuBar = new JMenuBar();
      menuBar.add("test", new JLabel("Testing"));
      window.setJMenuBar(menuBar);

      StyleContext sc = new StyleContext();
      document = new DefaultStyledDocument(sc);

      // Styles

      send = sc.addStyle("(Send)", null);
      send.addAttribute(StyleConstants.Foreground, Color.CYAN);

      info = sc.addStyle("(Info)", null);
      info.addAttribute(StyleConstants.Foreground, Color.WHITE);

      warning = sc.addStyle("(Warning)", null);
      warning.addAttribute(StyleConstants.Foreground, Color.YELLOW);

      error = sc.addStyle("(Error)", null);
      error.addAttribute(StyleConstants.Foreground, Color.RED);
      error.addAttribute(StyleConstants.Bold, new Boolean(true));

      textArea = new JTextPane(document);
      textArea.setBackground(new Color(50, 50, 50));
      textArea.setEditable(true);
      textArea.setBorder(null);
      textArea.setForeground(Color.WHITE);

      scrollPane = new JScrollPane(textArea);
      new SmartScroller(scrollPane);

      window.getContentPane().add(scrollPane);

      input = new JTextField();
      input.setBackground(new Color(50, 50, 50));
      input.setForeground(Color.WHITE);
      input.setCaretColor(Color.WHITE);
      input.addActionListener(new test());
      window.getContentPane().add(input, BorderLayout.SOUTH);

      window.setVisible(true);
      info.addAttribute(StyleConstants.Foreground, Color.BLUE);
    }
  }
Example #3
0
 public JTextField createTextField() {
   JTextField field = new JTextField();
   field.setBackground(fieldBg);
   field.setForeground(fieldtextColor);
   field.setCaretColor(fieldtextColor);
   if (fieldBorder != null)
     field.setBorder(
         BorderFactory.createCompoundBorder(
             BorderFactory.createLineBorder(fieldBorder, 1),
             BorderFactory.createEmptyBorder(0, 3, 0, 3)));
   return field;
 }
  /** contructor Create the frame. */
  public D_DesactivarCurso() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 684, 519);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setBackground(new Color(0, 206, 209));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JButton home = new JButton("");
    home.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Menu_administrativo bn = new Menu_administrativo();
            bn.setVisible(true);
            setVisible(false);
          }
        });
    home.setIcon(
        new ImageIcon("D:\\projectos eclipse\\UsuarioSwing\\src\\imagenes\\ic_home_64.png"));
    home.setBorder(null);
    home.setBackground(new Color(32, 178, 170));
    home.setBounds(544, 27, 59, 55);
    contentPane.add(home);

    JLabel label_2 = new JLabel("");
    label_2.setIcon(new ImageIcon("D:\\projectos eclipse\\UsuarioSwing\\src\\imagenes\\Dr1.png"));
    label_2.setHorizontalAlignment(SwingConstants.CENTER);
    label_2.setBounds(42, 0, 116, 119);
    contentPane.add(label_2);

    txtBienvenido = new JTextField();
    txtBienvenido.setBorder(null);
    txtBienvenido.setFont(new Font("Calibri", Font.BOLD, 30));
    txtBienvenido.setForeground(new Color(255, 255, 255));
    txtBienvenido.setBackground(new Color(32, 178, 170));
    txtBienvenido.setEditable(false);
    txtBienvenido.setHorizontalAlignment(SwingConstants.CENTER);
    txtBienvenido.setText("Desactivar Curso");
    txtBienvenido.setBounds(0, 0, 668, 119);
    contentPane.add(txtBienvenido);
    txtBienvenido.setColumns(10);

    JPanel panel = new JPanel();
    panel.setLayout(null);
    panel.setBorder(null);
    panel.setBackground(new Color(32, 178, 170));
    panel.setBounds(93, 155, 505, 299);
    contentPane.add(panel);

    JButton btnIngresar = new JButton("Ingresar");
    btnIngresar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            String id = idCur.getText();
            String di = dir.getText();
            if (id.length() != 0 && di.length() != 0) {
              if (id.matches("[0-9]*")) {
                int numid = Integer.parseInt(id);
                try {
                  String[] datosCurso = sc.buscarCurso(numid);
                  if (datosCurso != null) {
                    nomCur.setText(datosCurso[0]);
                    idCurso = numid;
                    rutD = di;
                    idCur.setText("");
                    dir.setText("");
                  } else {
                    JOptionPane.showMessageDialog(null, "El curso no Existe");
                    idCur.setText("");
                    dir.setText("");
                  }
                } catch (RemoteException e) {
                  e.printStackTrace();
                }
              } else {
                JOptionPane.showMessageDialog(null, "No ingrese Letras");
              }

            } else {
              JOptionPane.showMessageDialog(null, "Faltan campos requeridos");
            }
            //				sc.desactivarCurso(id, rutDirector);
          }
        });
    btnIngresar.setFont(new Font("Calibri", Font.BOLD, 17));
    btnIngresar.setBounds(196, 69, 83, 30);
    panel.add(btnIngresar);

    btnIngresar.setBorder(null);
    btnIngresar.setForeground(new Color(255, 255, 255));
    btnIngresar.setBackground(new Color(0, 206, 209));

    idCur = new JTextField();
    idCur.setHorizontalAlignment(SwingConstants.CENTER);
    idCur.setForeground(new Color(32, 178, 170));
    idCur.setFont(new Font("Calibri", Font.BOLD, 19));
    idCur.setCaretColor(new Color(0, 206, 209));
    idCur.setBorder(null);
    idCur.setBackground(new Color(255, 255, 255));
    idCur.setBounds(50, 47, 116, 30);
    panel.add(idCur);
    idCur.setColumns(10);

    JLabel lblRutProfesor = new JLabel("Codigo Curso");
    lblRutProfesor.setForeground(new Color(255, 255, 255));
    lblRutProfesor.setFont(new Font("Calibri", Font.BOLD, 16));
    lblRutProfesor.setHorizontalAlignment(SwingConstants.CENTER);
    lblRutProfesor.setBounds(50, 18, 97, 30);
    panel.add(lblRutProfesor);

    JLabel lblNombre = new JLabel("Nombre Curso:");
    lblNombre.setHorizontalAlignment(SwingConstants.RIGHT);
    lblNombre.setForeground(Color.WHITE);
    lblNombre.setFont(new Font("Calibri", Font.BOLD, 16));
    lblNombre.setBounds(101, 162, 128, 30);
    panel.add(lblNombre);
    JButton btnRegistrar = new JButton("Desactivar");
    btnRegistrar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (nomCur.getText().length() != 0) {
              descativar(idCurso, rutD);
            } else {
              JOptionPane.showMessageDialog(null, "Primero ingrese los datos");
            }
          }
        });

    btnRegistrar.setForeground(Color.WHITE);
    btnRegistrar.setFont(new Font("Calibri", Font.BOLD, 17));
    btnRegistrar.setBorder(null);
    btnRegistrar.setBackground(new Color(0, 206, 209));
    btnRegistrar.setBounds(180, 252, 116, 36);
    panel.add(btnRegistrar);

    nomCur = new JTextField();
    nomCur.setEditable(false);
    nomCur.setHorizontalAlignment(SwingConstants.CENTER);
    nomCur.setForeground(new Color(32, 178, 170));
    nomCur.setFont(new Font("Calibri", Font.BOLD, 19));
    nomCur.setColumns(10);
    nomCur.setCaretColor(new Color(0, 206, 209));
    nomCur.setBorder(null);
    nomCur.setBackground(Color.WHITE);
    nomCur.setBounds(261, 164, 116, 25);
    panel.add(nomCur);

    JLabel lblNewLabel = new JLabel("");
    lblNewLabel.setBorder(
        new TitledBorder(
            new LineBorder(new Color(255, 255, 255), 2, true),
            "Informacion Curso",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(255, 255, 255)));
    lblNewLabel.setBounds(75, 110, 339, 131);
    panel.add(lblNewLabel);

    dir = new JTextField();
    dir.setHorizontalAlignment(SwingConstants.CENTER);
    dir.setForeground(new Color(32, 178, 170));
    dir.setFont(new Font("Calibri", Font.BOLD, 19));
    dir.setColumns(10);
    dir.setCaretColor(new Color(0, 206, 209));
    dir.setBorder(null);
    dir.setBackground(Color.WHITE);
    dir.setBounds(311, 47, 116, 30);
    panel.add(dir);

    JLabel lblRutDirector = new JLabel("Rut Director");
    lblRutDirector.setHorizontalAlignment(SwingConstants.CENTER);
    lblRutDirector.setForeground(Color.WHITE);
    lblRutDirector.setFont(new Font("Calibri", Font.BOLD, 16));
    lblRutDirector.setBounds(311, 18, 97, 30);
    panel.add(lblRutDirector);
  }
Example #5
0
  Console() throws IllegalAccessException, InvocationTargetException, IOException {
    super(new BorderLayout());

    history = new History();

    console = new JTextArea();
    console.setMargin(new Insets(5, 5, 5, 5));
    console.setFont(new Font("Monospaced", Font.PLAIN, SMALL_FONT));
    console.setForeground(Color.green);
    console.setBackground(Color.black);

    console.setDoubleBuffered(true);
    console.setEditable(false);
    console.setFocusable(false);
    console.setLineWrap(true);

    prompt = new JTextField();
    prompt.setMargin(new Insets(5, 5, 5, 5));
    prompt.setFont(new Font("Monospaced", Font.PLAIN, BIG_FONT));
    prompt.setForeground(Color.green);
    prompt.setCaretColor(Color.green);

    setPrompt(false);
    setEmacsKeyMap(prompt, history);

    add(new JScrollPane(console), BorderLayout.CENTER);
    add(prompt, BorderLayout.SOUTH);

    final Environment env = new Environment();
    final PrintWriter out = new PrintWriter(new TextAreaStream(console, true), true);
    final Log log = new StandardLog(out, out);
    final View view = new PrintView(out, log);
    final Controller controller =
        new Controller() {
          public final void exit(boolean interact) {
            if (!interact) throw new ExitException();
            EventQueue.invokeLater(
                new Runnable() {
                  public final void run() {
                    log.info("exiting...");
                    postWindowClosingEvent(getFrame(Console.this));
                  }
                });
          }

          public final void ready() {
            EventQueue.invokeLater(
                new Runnable() {
                  public final void run() {
                    setPrompt(true);
                  }
                });
          }
        };

    final Repo repo = new Repo(env.getRepo());
    repo.init();
    doogal =
        new AsyncDoogal(
            log, new PromptDoogal(controller, new SyncDoogal(env, view, controller, repo)));

    prompt.addActionListener(
        new ActionListener() {
          public final void actionPerformed(ActionEvent ev) {
            final String s = prompt.getText();
            history.add(s);
            final Reader reader = new StringReader(s);
            prompt.setText("");
            setPrompt(false);
            try {
              Shellwords.parse(reader, doogal);
            } catch (final EvalException e) {
              log.error(e.getLocalizedMessage());
            } catch (final IOException e) {
              log.error(e.getLocalizedMessage());
            } catch (final ParseException e) {
              log.error(e.getLocalizedMessage());
            }
          }
        });

    printResource("motd.txt", out);
  }
  /** Create the panel. */
  public Receiveui(JFrame m, JPanel jp, LoginPO loginPO) {
    main = m;
    JPanel lastui = jp;
    Receiveui nowPanel = this;
    setLayout(null);
    ImageIcon image1 = new ImageIcon("image/transparent_circle.png");

    JButton button = new JButton("");
    button.setBounds(13, -9, 63, 63);
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setIcon(image1);
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            button.setIcon(new ImageIcon("image/mask_circle.png"));
          }
        });
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            main.remove(nowPanel);
            main.getContentPane().add(lastui);
            main.invalidate();
            main.repaint();
            main.setVisible(true);
          }
        });
    add(button);

    JLabel lblHello = new JLabel("Hello! " + loginPO.getName());
    lblHello.setForeground(Color.WHITE);
    lblHello.setBounds(655, 12, 100, 15);
    add(lblHello);

    JToolBar toolBar = new JToolBar();
    toolBar.setEnabled(false);
    toolBar.setBounds(8, 540, 750, 35);
    toolBar.setOpaque(false);
    toolBar.setBorder(null);
    add(toolBar);

    JLabel label_4 = new JLabel("״̬À¸");
    label_4.setForeground(Color.WHITE);
    toolBar.add(label_4);

    textField = new JTextField("ÊäÈë×°Ô˵¥±àºÅ");
    textField.setOpaque(false);
    textField.setBorder(null);
    textField.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 18));
    textField.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent e) {
            label_4.setText("״̬À¸");
            if (!(Character.isDigit(e.getKeyChar()))) {
              e.consume();
            }
          }
        });
    textField.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            textField.setText("");
          }
        });
    textField.setBounds(205, 244, 347, 44);
    textField.setForeground(new Color(255, 255, 255, 200));
    textField.setCaretColor(new Color(248, 179, 28));
    add(textField);
    textField.setColumns(10);

    JButton button_1 = new JButton("");
    button_1.setContentAreaFilled(false);
    button_1.setBorderPainted(false);
    button_1.setBounds(349, 316, 52, 52);
    ImageIcon image2 = new ImageIcon("image/transparent_circle.png");
    @SuppressWarnings("static-access")
    Image temp1 =
        image2
            .getImage()
            .getScaledInstance(
                button_1.getWidth(), button_1.getHeight(), image2.getImage().SCALE_DEFAULT);
    image2 = new ImageIcon(temp1);
    button_1.setIcon(image2);
    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (textField.getText().length() != 10) {
              label_4.setText("ÇëÊäÈëÕýÈ·×°Ô˵¥ºÅ");
            } else {
              ReceiveBLService rbs = new ReceiveBL();
              LoadorderVO lv = rbs.checkUnreceive_loadorderPO(textField.getText());
              if (lv == null) {
                label_4.setText("δ¼ì²âµ½¸Ã×°Ô˵¥");
              } else {
                Arriverorder a = new Arriverorder(main, nowPanel, lv, loginPO);
                main.remove(nowPanel);
                main.getContentPane().add(a);
                main.invalidate();
                main.repaint();
                main.setVisible(true);
              }
            }
          }
        });
    add(button_1);
  }
  @SuppressWarnings("static-access")
  public editSalary(SalaryVO vo, JFrame main, LoginPO loginPO) {
    editSalary editSalary = this;
    setBounds(100, 100, 750, 600);
    setLayout(null);
    this.setVisible(true);
    // first
    rdbtnNewRadioButton = new JRadioButton("\u6309\u6708");
    rdbtnNewRadioButton.setOpaque(false);
    rdbtnNewRadioButton.setBorder(null);
    rdbtnNewRadioButton.setBounds(371, 290, 83, 23);
    rdbtnNewRadioButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = SalaryModel.ByMonth;
          }
        });
    add(rdbtnNewRadioButton);

    // second
    radioButton = new JRadioButton("\u6309\u6B21");
    radioButton.setBounds(371, 326, 83, 23);
    radioButton.setOpaque(false);
    radioButton.setBorder(null);
    radioButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = salaryModel.ByTimes;
          }
        });
    add(radioButton);

    // third
    radioButton_1 = new JRadioButton("\u6309\u63D0\u6210");
    radioButton_1.setBounds(371, 366, 100, 23);
    radioButton_1.setOpaque(false);
    radioButton_1.setBorder(null);
    radioButton_1.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = salaryModel.ByBenefit;
          }
        });
    add(radioButton_1);

    buttonGroup = new ButtonGroup();
    buttonGroup.add(rdbtnNewRadioButton);
    buttonGroup.add(radioButton);
    buttonGroup.add(radioButton_1);

    if (vo.getTypeOfStrategy() == SalaryModel.ByMonth) {
      rdbtnNewRadioButton.setSelected(true);
      salaryModel = SalaryModel.ByMonth;
    } else if (vo.getTypeOfStrategy() == salaryModel.ByTimes) {
      radioButton.setSelected(true);
      salaryModel = salaryModel.ByTimes;
    } else {
      radioButton_1.setSelected(true);
      salaryModel = salaryModel.ByBenefit;
    }

    JButton btnNewButton = new JButton("\u786E\u5B9A");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int n = JOptionPane.showConfirmDialog(null, "确认修改?", "no", JOptionPane.YES_NO_OPTION);
            if (n == JOptionPane.YES_OPTION) {
              if (textField_1.getText().equals("")) {
                label_4.setText("请输入价格");
                Thread thread = new Thread(editSalary);
                thread.start();
              } else {
                SalaryVO salaryVO =
                    new SalaryVO(
                        textField.getText(),
                        Double.parseDouble(textField_1.getText()),
                        salaryModel);
                SalaryPolicybl salaryPolicybl = new SalaryPolicybl();
                salaryPolicybl.editSalary(salaryVO);
                Salary salary = new Salary(salaryVO, main, loginPO);
                main.remove(editSalary);
                main.getContentPane().add(salary);
                main.invalidate();
                main.repaint();
                main.setVisible(true);
              }
            }
          }
        });
    btnNewButton.setBounds(283, 419, 52, 52);
    ImageIcon image1 = new ImageIcon("image/transparent_circle.png");
    Image temp1 =
        image1
            .getImage()
            .getScaledInstance(
                btnNewButton.getWidth(), btnNewButton.getHeight(), image1.getImage().SCALE_DEFAULT);
    image1 = new ImageIcon(temp1);
    btnNewButton.setIcon(image1);
    btnNewButton.setContentAreaFilled(false);
    btnNewButton.setBorderPainted(false);
    add(btnNewButton);

    JButton button = new JButton("");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Salary salary = new Salary(vo, main, loginPO);
            main.remove(editSalary);
            main.getContentPane().add(salary);
            main.invalidate();
            main.repaint();
            main.setVisible(true);
          }
        });
    button.setBounds(13, -9, 63, 63);
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setIcon(new ImageIcon("image/transparent_circle.png"));
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            button.setIcon(new ImageIcon("image/mask_circle.png"));
          }
        });

    add(button);

    textField = new JTextField();
    textField.setColumns(10);
    textField.setBounds(373, 189, 108, 21);
    textField.setText(vo.getTypeOfStaff());
    textField.setEnabled(false);
    textField.setForeground(new Color(88, 93, 103));
    textField.setCaretColor(new Color(88, 93, 103));
    textField.setOpaque(false);
    textField.setBorder(null);
    add(textField);

    textField_1 = new JTextField();
    textField_1.setColumns(10);
    textField_1.setDocument(new JTextFieldLimit(7));
    textField_1.setBounds(373, 239, 108, 21);
    textField_1.addKeyListener(new InputNumber());
    textField_1.setText(vo.getSalary() + "");
    textField_1.setForeground(new Color(88, 93, 103));
    textField_1.setCaretColor(new Color(88, 93, 103));
    textField_1.setOpaque(false);
    textField_1.setBorder(null);
    add(textField_1);

    JToolBar toolBar = new JToolBar();
    toolBar.setBounds(8, 541, 750, 35);
    toolBar.setOpaque(false);
    toolBar.setBorder(null);
    add(toolBar);

    label_4 = new JLabel("\u72B6\u6001\u680F");
    label_4.setForeground(Color.WHITE);
    toolBar.add(label_4);

    JButton button2 = new JButton("取消");
    button2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            editSalary neweditSalary = new editSalary(vo, main, loginPO);
            main.remove(editSalary);
            main.getContentPane().add(neweditSalary);
            main.invalidate();
            main.repaint();
            main.setVisible(true);
          }
        });

    button2.setBounds(416, 418, 52, 52);
    ImageIcon image2 = new ImageIcon("image/transparent_circle.png");
    Image temp2 =
        image2
            .getImage()
            .getScaledInstance(
                button2.getWidth(), button2.getHeight(), image2.getImage().SCALE_DEFAULT);
    image2 = new ImageIcon(temp2);
    button2.setIcon(image2);
    button2.setContentAreaFilled(false);
    button2.setBorderPainted(false);
    add(button2);
  }
Example #8
0
    public ChatPanel(final Client client) {
        this.client = client;

        input = new JTextField();
        //prevent unintended focus (by window activate etc. - allow focus just on direct click)
        input.setFocusable(false);
        input.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                activateChat();
            }
        });
        input.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                    clean();
                }
            }
        });
        input.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                String msg = input.getText();
                if (!"".equals(msg)) {
                    forceFocus = true; //prevent panel flashing
                    client.getConnection().send(createPostChatMessage(msg));
                }
                clean();
            }
        });
        input.addFocusListener(new FocusListener() {
            @Override
            public void focusLost(FocusEvent e) {
                updateMessaagesVisibility();
            }

            @Override
            public void focusGained(FocusEvent e) {
                updateMessaagesVisibility();
            }
        });

        input.setOpaque(false);
        input.setBackground(client.getTheme().getTransparentInputBg());
        Color textColor = client.getTheme().getTextColor();
        if (textColor != null) {
            input.setForeground(client.getTheme().getTextColor());
            input.setCaretColor(client.getTheme().getTextColor());
        }
        TextPrompt tp = new TextPrompt(_("Type to chat"), input);
        tp.setShow(Show.FOCUS_LOST);
        tp.changeStyle(Font.ITALIC);
        tp.changeAlpha(0.4f);

        messagesPane = new JTextPane();
        messagesPane.setEditorKit(new WrapEditorKit());
        messagesPane.setFocusable(false);
        messagesPane.setOpaque(false);

        setBackground(client.getTheme().getTransparentPanelBg());
        setLayout(new MigLayout(""));
        add(messagesPane, "pos 10 n (100%-10) (100%-35)");
        add(input, "pos 10 (100%-35) (100%-10) (100%-10)");
    }