Пример #1
0
  /**
   * Méthode de création du panelInit
   *
   * @return
   */
  private JPanel createPanelInit() {

    JPanel panRight = new JPanel();
    panRight.setLayout(new BoxLayout(panRight, BoxLayout.Y_AXIS));

    butListParty = new JButton("Liste des parties");
    butListParty.addActionListener(this);

    JPanel panCreate = new JPanel();
    panCreate.setLayout(new BoxLayout(panCreate, BoxLayout.X_AXIS));
    textCreate = new JTextField("", 40);
    textCreate.setMaximumSize(textCreate.getPreferredSize());
    butCreateParty = new JButton("Creation de parties ");
    butCreateParty.addActionListener(this);
    SpinnerModel model = new SpinnerNumberModel(3, 2, 8, 1);
    spinNbPlayer = new JSpinner(model);
    spinNbPlayer.setMaximumSize(spinNbPlayer.getPreferredSize());
    panCreate.add(new JLabel("Nouveau nom de partie : "));
    panCreate.add(textCreate);
    panCreate.add(Box.createHorizontalStrut(20));
    panCreate.add(new JLabel("Nombres de joueurs : "));
    panCreate.add(spinNbPlayer);
    panCreate.add(butCreateParty);

    JPanel panJoin = new JPanel();
    panJoin.setLayout(new BoxLayout(panJoin, BoxLayout.X_AXIS));
    textJoin = new JTextField("", 2);
    textJoin.setMaximumSize(textJoin.getPreferredSize());
    butJoinParty = new JButton("Rejoindre la partie ");
    butJoinParty.addActionListener(this);
    panJoin.add(new JLabel("Num Partie : "));
    panJoin.add(textJoin);
    panJoin.add(butJoinParty);

    panRight.add(butListParty);
    panRight.add(panCreate);
    panRight.add(panJoin);
    panRight.add(Box.createVerticalGlue());

    textInfoInit = new JTextArea(20, 100);
    textInfoInit.setLineWrap(true);

    JScrollPane scroll =
        new JScrollPane(
            textInfoInit,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    JPanel panAll = new JPanel();
    panAll.setLayout(new BoxLayout(panAll, BoxLayout.X_AXIS));
    panAll.add(scroll);
    panAll.add(panRight);

    return panAll;
  }
 public void addGroupComponent(JComponent component) {
   handleComponentAdded(component);
   Insets insets;
   if (currentRow == 0) {
     insets = INSETS;
   } else if (component instanceof JRadioButton) {
     insets = INSETS;
   } else if (component instanceof JCheckBox) {
     insets = INSETS;
   } else {
     insets = new Insets(4, 0, 4, 0);
   }
   backingPanel.add(
       component,
       new GridBagConstraints(
           1,
           currentRow,
           2,
           1,
           100,
           0,
           GridBagConstraints.BASELINE_LEADING,
           GridBagConstraints.NONE,
           insets,
           0,
           0));
   if (component instanceof JTextField) {
     JTextField field = (JTextField) component;
     field.setMinimumSize(field.getPreferredSize());
   }
   currentRow++;
 }
Пример #3
0
 void addTextField(JPanel panel, String key, String label) {
   JLabel lab = new JLabel(label);
   lab.setAlignmentX(LEFT_ALIGNMENT);
   panel.add(lab);
   JTextField field = new JTextField();
   field.setText(sketch.configFile.get(key));
   field.setMaximumSize(new Dimension(Integer.MAX_VALUE, field.getPreferredSize().height));
   fields.put(key, field);
   panel.add(field);
 }
Пример #4
0
  private static void insertQuestion(final JTextPane textPane, String str) {
    Document doc = textPane.getDocument();
    try {
      doc.insertString(doc.getLength(), str, null);

      final int pos = doc.getLength();
      System.out.println(pos);
      final JTextField field =
          new JTextField(4) {
            @Override
            public Dimension getMaximumSize() {
              return getPreferredSize();
            }
          };
      field.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK));
      field.addFocusListener(
          new FocusListener() {
            @Override
            public void focusGained(FocusEvent e) {
              try {
                Rectangle rect = textPane.modelToView(pos);
                rect.grow(0, 4);
                rect.setSize(field.getSize());
                // System.out.println(rect);
                // System.out.println(field.getLocation());
                textPane.scrollRectToVisible(rect);
              } catch (BadLocationException ex) {
                ex.printStackTrace();
              }
            }

            @Override
            public void focusLost(FocusEvent e) {
              /* not needed */
            }
          });
      Dimension d = field.getPreferredSize();
      int baseline = field.getBaseline(d.width, d.height);
      field.setAlignmentY(baseline / (float) d.height);

      SimpleAttributeSet a = new SimpleAttributeSet();
      StyleConstants.setLineSpacing(a, 1.5f);
      textPane.setParagraphAttributes(a, true);

      textPane.insertComponent(field);
      doc.insertString(doc.getLength(), "\n", null);
    } catch (BadLocationException e) {
      e.printStackTrace();
    }
  }
Пример #5
0
    private JTextField addField(JPanel directoryPanel, String label, String defaultText) {
      JTextField field = new JTextField(defaultText);

      directoryPanel.add(new JLabel(label, SwingConstants.RIGHT));

      Box fieldBox = new Box(BoxLayout.Y_AXIS);
      fieldBox.add(Box.createGlue());
      Dimension dim = field.getPreferredSize();
      dim.width = Integer.MAX_VALUE;
      field.setMaximumSize(dim);
      fieldBox.add(field);
      fieldBox.add(Box.createGlue());
      directoryPanel.add(fieldBox);
      JButton choose = new JButton("Choose...");
      choose.setRequestFocusEnabled(false);
      choose.addActionListener(new ActionHandler(field));
      directoryPanel.add(choose);

      return field;
    }
 public void addIndentedGroupComponent(JComponent component) {
   handleComponentAdded(component);
   backingPanel.add(
       component,
       new GridBagConstraints(
           1,
           currentRow,
           2,
           1,
           100,
           0,
           GridBagConstraints.BASELINE_LEADING,
           GridBagConstraints.NONE,
           new Insets(0, 50, 0, 0),
           0,
           0));
   if (component instanceof JTextField) {
     JTextField field = (JTextField) component;
     field.setMinimumSize(field.getPreferredSize());
   }
   currentRow++;
 }
  public AddAdapterSupportDialog(
      @NotNull Project project,
      @NotNull PsiFile psiFileRequestor,
      @NotNull String assertionFrameworkName,
      @NotNull List<VirtualFile> adapterSourceFiles,
      @Nullable String adapterHomePageUrl) {
    super(project);
    myProject = project;
    myAssertFrameworkName = assertionFrameworkName;
    myAdapterSourceFiles = adapterSourceFiles;
    myFileRequestor = psiFileRequestor.getVirtualFile();

    setModal(true);
    setTitle("Add " + getAssertFrameworkAdapterName());

    myDirectoryTextField = new JTextField();
    VirtualFile initialDir = findInitialDir(psiFileRequestor);
    if (initialDir != null) {
      myDirectoryTextField.setText(FileUtil.toSystemDependentName(initialDir.getPath()));
    }
    // widen preferred size to fit dialog's title
    myDirectoryTextField.setPreferredSize(
        new Dimension(350, myDirectoryTextField.getPreferredSize().height));

    List<Component> components = Lists.newArrayList();
    components.add(createFilesViewPanel(adapterSourceFiles));
    components.add(Box.createVerticalStrut(10));
    components.add(createSelectDirectoryPanel(project, myDirectoryTextField));
    if (adapterHomePageUrl != null) {
      components.add(Box.createVerticalStrut(10));
      components.add(createInformationPanel(adapterHomePageUrl));
    }
    myContent = SwingHelper.newLeftAlignedVerticalPanel(components);

    setOKButtonText("Add");
    super.init();
  }
Пример #8
0
  /**
   * Méthode de création du panel de Connection
   *
   * @return
   */
  private JPanel createPanelConnect() {

    JPanel panAll = new JPanel(new BorderLayout());

    JPanel panPseudo = new JPanel();
    textPseudo = new JTextField("", 20);
    textPseudo.setMaximumSize(textPseudo.getPreferredSize());
    panPseudo.add(new JLabel("Pseudo: "));
    panPseudo.add(textPseudo);

    JPanel panConn = new JPanel();
    textServerIP = new JTextField("127.0.0.1", 15);
    panConn.add(new JLabel("Server IP: "));
    panConn.add(textServerIP);

    butConnect = new JButton("Connect");
    butConnect.addActionListener(this);

    panAll.add(panPseudo, BorderLayout.NORTH);
    panAll.add(panConn, BorderLayout.CENTER);
    panAll.add(butConnect, BorderLayout.SOUTH);

    return panAll;
  }
Пример #9
0
  /**
   * Méthode de création du panel de Jeu
   *
   * @return
   */
  private JPanel createPanelPlay() {

    JPanel panAll = new JPanel(new BorderLayout());

    textInfoParty = new JTextArea(20, 100);
    textInfoParty.setLineWrap(true);
    JScrollPane scroll =
        new JScrollPane(
            textInfoParty,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    JPanel panPlay = new JPanel();
    textPlay = new JTextField("", 5);
    textPlay.setMaximumSize(textPlay.getPreferredSize());
    butPlay = new JButton("Jouer");
    butPlay.addActionListener(this);
    panPlay.add(new JLabel("Ordre :  "));
    panPlay.add(textPlay);
    enableOrder(false);
    JPanel panRight = new JPanel(new BorderLayout());
    panRight.add(panPlay, BorderLayout.CENTER);
    panRight.add(butPlay, BorderLayout.SOUTH);

    JPanel panMain = new JPanel();
    panMain.add(scroll);
    panMain.add(panRight);

    butQuit = new JButton("Quitter");
    butQuit.addActionListener(this);

    panAll.add(panMain, BorderLayout.CENTER);
    panAll.add(butQuit, BorderLayout.SOUTH);

    return panAll;
  }
  protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new GridBagLayout());

    panel.add(
        new JLabel(myName),
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 5, 3, 5),
            0,
            0));
    panel.add(
        myTfUrl,
        new GridBagConstraints(
            0,
            1,
            2,
            1,
            1,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 5, 5, 5),
            0,
            0));

    myTfUrl.setPreferredSize(new Dimension(350, myTfUrl.getPreferredSize().height));

    if (myShowPath) {
      panel.add(
          new JLabel(myLocation),
          new GridBagConstraints(
              0,
              2,
              1,
              1,
              0,
              0,
              GridBagConstraints.WEST,
              GridBagConstraints.NONE,
              new Insets(0, 5, 3, 5),
              0,
              0));
      panel.add(
          myTfPath,
          new GridBagConstraints(
              0,
              3,
              1,
              1,
              1,
              0,
              GridBagConstraints.WEST,
              GridBagConstraints.HORIZONTAL,
              new Insets(0, 5, 10, 0),
              0,
              0));
      panel.add(
          myBtnBrowseLocalPath,
          new GridBagConstraints(
              1,
              3,
              1,
              1,
              0,
              0,
              GridBagConstraints.CENTER,
              GridBagConstraints.NONE,
              new Insets(0, 0, 10, 5),
              0,
              0));

      //
      TextFieldWithBrowseButton.MyDoClickAction.addTo(myBtnBrowseLocalPath, myTfPath);
      myBtnBrowseLocalPath.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ignored) {
              FileChooserDescriptor descriptor = getChooserDescriptor();
              VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null);
              if (file != null) {
                myTfPath.setText(file.getPath().replace('/', File.separatorChar));
              }
            }
          });
    }

    //

    return panel;
  }
Пример #11
0
  public LoginPanel(Image img, ActionListener listener) {
    super(null);
    this.listener = listener;
    if (img == null) {
      InputStream inData = getClass().getResourceAsStream("/resources/background.gif");
      BufferedImage back = null;
      if (inData != null)
        try {
          back = ImageIO.read(inData);
        } catch (IOException e) {
          loger.finest("LoginPanel class can't get the background image");
        }
      this.background = back;
    }

    setLayout(null);
    JPanel logingPanel = new JPanel();
    loginTitle = new JLabel("Autentificare");
    logingPanel.setSize(250, 150);
    logingPanel.setBorder(new javax.swing.border.LineBorder(Color.black, 2));
    logingPanel.setLayout(null);
    loginTitle.setBounds(3, 0, logingPanel.getWidth(), 20);
    logingPanel.add(loginTitle);
    JLabel loginUser = new JLabel("Utilizator");
    loginUser.setBounds(
        80 - loginUser.getPreferredSize().width,
        40,
        loginUser.getPreferredSize().width,
        loginUser.getPreferredSize().height);
    logingPanel.add(loginUser);
    user = new JTextField(10);
    user.setBounds(85, 40, user.getPreferredSize().width, user.getPreferredSize().height);
    // user.setText("test");
    // loginUser.setLabelFor(user);
    logingPanel.add(user);
    JLabel loginPass = new JLabel("Parola");
    loginPass.setBounds(
        80 - loginPass.getPreferredSize().width,
        80,
        loginPass.getPreferredSize().width,
        loginPass.getPreferredSize().height);
    logingPanel.add(loginPass);
    // JTextField pass = new JTextField(10);
    pass = new JPasswordField(10);
    pass.setBounds(85, 80, pass.getPreferredSize().width, pass.getPreferredSize().height);
    pass.addKeyListener(this);
    // pass.setText("test");
    // loginUser.setLabelFor(user);
    logingPanel.add(pass);
    JButton loginButton = new JButton("Start");
    loginButton.setActionCommand("LOGIN");
    loginButton.setBounds(
        60, 110, loginButton.getPreferredSize().width, loginButton.getPreferredSize().height);
    // loginButton.setOpaque(false);
    loginButton.setFocusPainted(false);
    // loginButton.setContentAreaFilled(false);
    // loginButton.setBorderPainted(false);
    loginButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    loginButton.addActionListener(listener);
    logingPanel.add(loginButton);

    add(logingPanel);
  }
Пример #12
0
  /**
   * Open the config dialog, send the config update to the robot, save it for future, and refresh
   * the preview tab.
   */
  public void UpdateConfig() {
    final JDialog driver = new JDialog(mainframe, "Configure Limits", true);
    driver.setLayout(new GridBagLayout());

    final JTextField mtop = new JTextField(String.valueOf(limit_top));
    final JTextField mbottom = new JTextField(String.valueOf(limit_bottom));
    final JTextField mleft = new JTextField(String.valueOf(limit_left));
    final JTextField mright = new JTextField(String.valueOf(limit_right));

    final JTextField ptop = new JTextField(String.valueOf(paper_top));
    final JTextField pbottom = new JTextField(String.valueOf(paper_bottom));
    final JTextField pleft = new JTextField(String.valueOf(paper_left));
    final JTextField pright = new JTextField(String.valueOf(paper_right));

    final JButton cancel = new JButton("Cancel");
    final JButton save = new JButton("Save");

    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 3;
    c.gridy = 0;
    driver.add(mtop, c);
    c.gridx = 3;
    c.gridy = 5;
    driver.add(mbottom, c);
    c.gridx = 0;
    c.gridy = 3;
    driver.add(mleft, c);
    c.gridx = 5;
    c.gridy = 3;
    driver.add(mright, c);

    c.gridx = 3;
    c.gridy = 1;
    driver.add(ptop, c);
    c.gridx = 3;
    c.gridy = 4;
    driver.add(pbottom, c);
    c.gridx = 1;
    c.gridy = 3;
    driver.add(pleft, c);
    c.gridx = 4;
    c.gridy = 3;
    driver.add(pright, c);

    c.gridx = 4;
    c.gridy = 6;
    driver.add(save, c);
    c.gridx = 5;
    c.gridy = 6;
    driver.add(cancel, c);

    Dimension s = ptop.getPreferredSize();
    s.width = 80;
    ptop.setPreferredSize(s);
    pbottom.setPreferredSize(s);
    pleft.setPreferredSize(s);
    pright.setPreferredSize(s);
    mtop.setPreferredSize(s);
    mbottom.setPreferredSize(s);
    mleft.setPreferredSize(s);
    mright.setPreferredSize(s);

    ActionListener driveButtons =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Object subject = e.getSource();
            if (subject == save) {
              paper_top = Float.valueOf(ptop.getText());
              paper_bottom = Float.valueOf(pbottom.getText());
              paper_right = Float.valueOf(pright.getText());
              paper_left = Float.valueOf(pleft.getText());
              limit_top = Float.valueOf(mtop.getText());
              limit_bottom = Float.valueOf(mbottom.getText());
              limit_right = Float.valueOf(mright.getText());
              limit_left = Float.valueOf(mleft.getText());
              previewPane.setMachineLimits(limit_top, limit_bottom, limit_left, limit_right);
              previewPane.setPaperSize(paper_top, paper_bottom, paper_left, paper_right);
              SetRecentPaperSize();
              SaveConfig();
              SendConfig();
              driver.dispose();
            }
            if (subject == cancel) {
              driver.dispose();
            }
          }
        };

    save.addActionListener(driveButtons);
    cancel.addActionListener(driveButtons);
    SendLineToRobot("M114"); // "where" command
    driver.pack();
    driver.setVisible(true);
  }
  public JComponent createComponent() {
    myPanel = new JPanel(new GridBagLayout());

    myStartIndex = new JTextField(5);
    myEndIndex = new JTextField(5);
    myEntriesLimit = new JTextField(5);

    final FontMetrics fontMetrics = myStartIndex.getFontMetrics(myStartIndex.getFont());
    final Dimension minSize = new Dimension(myStartIndex.getPreferredSize());
    //noinspection HardCodedStringLiteral
    minSize.width = fontMetrics.stringWidth("AAAAA");
    myStartIndex.setMinimumSize(minSize);
    myEndIndex.setMinimumSize(minSize);
    myEntriesLimit.setMinimumSize(minSize);

    JLabel startIndexLabel =
        new JLabel(DebuggerBundle.message("label.array.renderer.configurable.start.index"));
    startIndexLabel.setLabelFor(myStartIndex);

    JLabel endIndexLabel =
        new JLabel(DebuggerBundle.message("label.array.renderer.configurable.end.index"));
    endIndexLabel.setLabelFor(myEndIndex);

    JLabel entriesLimitLabel =
        new JLabel(DebuggerBundle.message("label.array.renderer.configurable.max.count1"));
    entriesLimitLabel.setLabelFor(myEntriesLimit);

    myPanel.add(
        startIndexLabel,
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 8),
            0,
            0));
    myPanel.add(
        myStartIndex,
        new GridBagConstraints(
            1,
            GridBagConstraints.RELATIVE,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 8),
            0,
            0));
    myPanel.add(
        endIndexLabel,
        new GridBagConstraints(
            2,
            GridBagConstraints.RELATIVE,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 8),
            0,
            0));
    myPanel.add(
        myEndIndex,
        new GridBagConstraints(
            3,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));

    myPanel.add(
        entriesLimitLabel,
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(4, 0, 0, 8),
            0,
            0));
    myPanel.add(
        myEntriesLimit,
        new GridBagConstraints(
            1,
            GridBagConstraints.RELATIVE,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(4, 0, 0, 8),
            0,
            0));
    myPanel.add(
        new JLabel(DebuggerBundle.message("label.array.renderer.configurable.max.count2")),
        new GridBagConstraints(
            2,
            GridBagConstraints.RELATIVE,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(4, 0, 0, 0),
            0,
            0));

    // push other components up
    myPanel.add(
        new JLabel(),
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            0.0,
            1.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));

    final DocumentListener listener =
        new DocumentListener() {
          private void updateEntriesLimit() {
            final boolean state = myIndexUpdateEnabled;
            myIndexUpdateEnabled = false;
            try {
              if (myEntriesLimitUpdateEnabled) {
                myEntriesLimit.setText(
                    String.valueOf(getInt(myEndIndex) - getInt(myStartIndex) + 1));
              }
            } finally {
              myIndexUpdateEnabled = state;
            }
          }

          public void changedUpdate(DocumentEvent e) {
            updateEntriesLimit();
          }

          public void insertUpdate(DocumentEvent e) {
            updateEntriesLimit();
          }

          public void removeUpdate(DocumentEvent e) {
            updateEntriesLimit();
          }
        };
    myStartIndex.getDocument().addDocumentListener(listener);
    myEndIndex.getDocument().addDocumentListener(listener);
    myEntriesLimit
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              private void updateEndIndex() {
                final boolean state = myEntriesLimitUpdateEnabled;
                myEntriesLimitUpdateEnabled = false;
                try {
                  if (myIndexUpdateEnabled) {
                    myEndIndex.setText(
                        String.valueOf(getInt(myEntriesLimit) + getInt(myStartIndex) - 1));
                  }
                } finally {
                  myEntriesLimitUpdateEnabled = state;
                }
              }

              public void insertUpdate(DocumentEvent e) {
                updateEndIndex();
              }

              public void removeUpdate(DocumentEvent e) {
                updateEndIndex();
              }

              public void changedUpdate(DocumentEvent e) {
                updateEndIndex();
              }
            });
    return myPanel;
  }
Пример #14
0
  private void initComponents() {

    panel1 = new JPanel();
    label1 = new JLabel();
    separator1 = new JSeparator();
    button3 = new JButton();
    button4 = new JButton();
    button5 = new JButton();
    scrollPane2 = new JScrollPane();
    tableModel1 = new DefaultTableModel();
    table1 = new JTable(tableModel1);
    panel2 = new JPanel();
    label5 = new JLabel();
    textField1 = new JTextField();
    label2 = new JLabel();
    label3 = new JLabel();
    textField2 = new JTextField();
    textField3 = new JTextField();
    button1 = new JButton();
    button2 = new JButton();

    // ======== this ========
    setResizable(false);
    Container contentPane = getContentPane();
    contentPane.setLayout(null);

    // ======== panel1 ========
    {
      panel1.setLayout(null);

      // ---- label1 ----
      label1.setText("Manage Vat %");
      panel1.add(label1);
      label1.setFont(new Font("Dialog", Font.BOLD | Font.ITALIC, 30));
      label1.setBounds(200, 10, 400, 50);

      panel1.add(separator1);
      separator1.setBounds(0, 100, 600, 5);

      // ======== panel2 ========
      {
        panel2.setBorder(UIManager.getBorder("TitledBorder.border"));
        panel2.setLayout(null);

        // ---- label3 ----
        label3.setText("<html>Year    : <font color='red'><b>*</b></font></html>");
        panel2.add(label3);
        label3.setBounds(new Rectangle(new Point(25, 25), label3.getPreferredSize()));

        panel2.add(textField1);
        textField1.setBounds(95, 25, 100, textField1.getPreferredSize().height);

        // ---- label5 ----
        label5.setText("<html>To  : <font color='red'><b>*</b></font></html>");
        panel2.add(label5);
        label5.setBounds(new Rectangle(new Point(250, 25), label5.getPreferredSize()));

        panel2.add(textField2);
        textField2.setBounds(310, 25, 100, textField2.getPreferredSize().height);

        // ---- label2 ----
        label2.setText("<html>Vat %  : <font color='red'><b>*</b></font></html>");
        panel2.add(label2);
        label2.setBounds(new Rectangle(new Point(25, 85), label2.getPreferredSize()));

        panel2.add(textField3);
        textField3.setBounds(95, 85, 315, textField3.getPreferredSize().height);

        // ---- button1 ----
        button1.setText("Add");
        panel2.add(button1);
        button1.setBounds(70, 150, 100, 30);
        button1.addActionListener(this);

        // ---- button2 ----
        button2.setText("Clear");
        panel2.add(button2);
        button2.setBounds(280, 150, 100, 30);
        button2.addActionListener(this);
      }
      panel1.add(panel2);
      panel2.setBounds(50, 125, 500, 200);

      tableModel1.addColumn("Sr. No.");
      tableModel1.addColumn("vat %");
      tableModel1.addColumn("Year From");
      tableModel1.addColumn("Year To");

      // ======== scrollPane2 ========
      {
        scrollPane2.setViewportView(table1);
      }
      panel1.add(scrollPane2);
      scrollPane2.setBounds(50, 340, 500, 250);

      // ---- button3 ----
      button3.setText("Delete");
      panel1.add(button3);
      button3.setBounds(50, 610, 150, 30);
      button3.addActionListener(this);

      // ---- button4 ----
      button4.setText("Update");
      panel1.add(button4);
      button4.setBounds(225, 610, 150, 30);
      button4.addActionListener(this);
      button4.setEnabled(false);

      // ---- button5 ----
      button5.setText("Refresh");
      panel1.add(button5);
      button5.setBounds(400, 610, 150, 30);
      button5.addActionListener(this);
    }
    contentPane.add(panel1);
    panel1.setBounds(0, 0, 600, 700);

    pack();
    setVisible(true);
    setLocation(200, 10);
    setSize(600, 700);
  }
Пример #15
0
  public DisplayDetailsPanel(int dn) {

    setBackground(varsOrange);
    JLabel stimJL = new JLabel("Stimulus" + dn + ":", JLabel.RIGHT);
    stimJL.setFont(f12b);
    String[] stims = {"word", "picture", "sound", "video", "blank"};
    stimtypeJCB = new JComboBox(stims);
    stimtypeJCB.setSelectedIndex(0);

    stimJTF = new JTextField("", 10);
    stimJTF.setMaximumSize(new Dimension(stimJTF.getPreferredSize()));

    String[] locs = {"center", "random", "position"};
    stimlocJCB = new JComboBox(locs);
    stimlocJCB.setSelectedIndex(0);

    JLabel xJL = new JLabel("x:  ", JLabel.RIGHT);
    xJL.setFont(f12b);
    xJTF = new JTextField("", 3);
    xJTF.setMaximumSize(new Dimension(xJTF.getPreferredSize()));
    xJTF.setEditable(false);
    JLabel yJL = new JLabel("y:  ", JLabel.RIGHT);
    yJL.setFont(f12b);
    yJTF = new JTextField("", 3);
    yJTF.setMaximumSize(new Dimension(yJTF.getPreferredSize()));
    yJTF.setEditable(false);
    AbstractAction stimlocJCBaction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent ae) {
            if (stimlocJCB.getSelectedIndex() == 2) {
              xJTF.setEditable(true);
              yJTF.setEditable(true);
            } else {
              xJTF.setText("");
              yJTF.setText("");
              xJTF.setEditable(false);
              yJTF.setEditable(false);
            }
          }
        };
    stimlocJCB.addActionListener(stimlocJCBaction);

    JLabel durJL = new JLabel("Duration(sec):", JLabel.RIGHT);
    durJTF = new JTextField("", 3);
    durJTF.setMaximumSize(new Dimension(durJTF.getPreferredSize()));
    AbstractAction stimtypeJCBaction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent ae) {
            if (stimtypeJCB.getSelectedIndex() == 3) {
              stimJTF.setText("");
              stimJTF.setEditable(false);
              stimlocJCB.setEnabled(false);
              xJTF.setText("");
              xJTF.setEditable(false);
              yJTF.setText("");
              yJTF.setEditable(false);
              durJTF.setEditable(true);
            } else {
              if (stimtypeJCB.getSelectedIndex() == 2) {
                stimJTF.setEditable(true);
                stimlocJCB.setEnabled(false);
                xJTF.setText("");
                xJTF.setEditable(false);
                yJTF.setText("");
                yJTF.setEditable(false);
                durJTF.setText("");
                durJTF.setEditable(false);
              } else {
                stimJTF.setEditable(true);
                stimlocJCB.setEnabled(true);
                durJTF.setEditable(true);
              }
            }
          }
        };
    stimtypeJCB.addActionListener(stimtypeJCBaction);

    ddhbox = Box.createHorizontalBox();
    ddhbox.add(Box.createHorizontalStrut(10));
    ddhbox.add(stimtypeJCB);
    ddhbox.add(Box.createHorizontalStrut(10));
    ddhbox.add(stimJTF);
    ddhbox.add(Box.createHorizontalStrut(10));
    ddhbox.add(stimlocJCB);
    ddhbox.add(Box.createHorizontalStrut(5));
    ddhbox.add(xJL);
    ddhbox.add(xJTF);
    ddhbox.add(Box.createHorizontalStrut(5));
    ddhbox.add(yJL);
    ddhbox.add(yJTF);
    ddhbox.add(Box.createHorizontalStrut(10));
    ddhbox.add(durJL);
    ddhbox.add(durJTF);

    ddvbox = Box.createVerticalBox();
    ddvbox.add(stimJL);
    stimJL.setAlignmentX(Component.LEFT_ALIGNMENT);
    ddvbox.add(Box.createVerticalStrut(5));
    ddvbox.add(ddhbox);
    ddhbox.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(ddvbox);
  }
Пример #16
0
  public Preferences() {

    // setup dialog for the prefs

    //dialog = new JDialog(editor, "Preferences", true);
    dialog = new JFrame(_("Preferences"));
    dialog.setResizable(false);

    Container pain = dialog.getContentPane();
    pain.setLayout(null);

    int top = GUI_BIG;
    int left = GUI_BIG;
    int right = 0;

    JLabel label;
    JButton button; //, button2;
    //JComboBox combo;
    Dimension d, d2; //, d3;
    int h, vmax;


    // Sketchbook location:
    // [...............................]  [ Browse ]

    label = new JLabel(_("Sketchbook location:"));
    pain.add(label);
    d = label.getPreferredSize();
    label.setBounds(left, top, d.width, d.height);
    top += d.height; // + GUI_SMALL;

    sketchbookLocationField = new JTextField(40);
    pain.add(sketchbookLocationField);
    d = sketchbookLocationField.getPreferredSize();

    button = new JButton(PROMPT_BROWSE);
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          File dflt = new File(sketchbookLocationField.getText());
          File file =
            Base.selectFolder(_("Select new sketchbook location"), dflt, dialog);
          if (file != null) {
            sketchbookLocationField.setText(file.getAbsolutePath());
          }
        }
      });
    pain.add(button);
    d2 = button.getPreferredSize();

    // take max height of all components to vertically align em
    vmax = Math.max(d.height, d2.height);
    sketchbookLocationField.setBounds(left, top + (vmax-d.height)/2,
                                      d.width, d.height);
    h = left + d.width + GUI_SMALL;
    button.setBounds(h, top + (vmax-d2.height)/2,
                     d2.width, d2.height);

    right = Math.max(right, h + d2.width + GUI_BIG);
    top += vmax + GUI_BETWEEN;


    // Preferred language: [        ] (requires restart of Arduino)
    Container box = Box.createHorizontalBox();
    label = new JLabel(_("Editor language: "));
    box.add(label);
    comboLanguage = new JComboBox(languages);
    comboLanguage.setSelectedIndex((Arrays.asList(languagesISO)).indexOf(Preferences.get("editor.languages.current")));
    box.add(comboLanguage);
    label = new JLabel(_("  (requires restart of Arduino)"));
    box.add(label);
    pain.add(box);
    d = box.getPreferredSize();
    box.setForeground(Color.gray);
    box.setBounds(left, top, d.width, d.height);
    right = Math.max(right, left + d.width);
    top += d.height + GUI_BETWEEN;

    // Editor font size [    ]

    box = Box.createHorizontalBox();
    label = new JLabel(_("Editor font size: "));
    box.add(label);
    fontSizeField = new JTextField(4);
    box.add(fontSizeField);
    label = new JLabel(_("  (requires restart of Arduino)"));
    box.add(label);
    pain.add(box);
    d = box.getPreferredSize();
    box.setBounds(left, top, d.width, d.height);
    Font editorFont = Preferences.getFont("editor.font");
    fontSizeField.setText(String.valueOf(editorFont.getSize()));
    top += d.height + GUI_BETWEEN;


    // Show verbose output during: [ ] compilation [ ] upload

    box = Box.createHorizontalBox();
    label = new JLabel(_("Show verbose output during: "));
    box.add(label);
    verboseCompilationBox = new JCheckBox(_("compilation "));
    box.add(verboseCompilationBox);
    verboseUploadBox = new JCheckBox(_("upload"));
    box.add(verboseUploadBox);
    pain.add(box);
    d = box.getPreferredSize();
    box.setBounds(left, top, d.width, d.height);
    top += d.height + GUI_BETWEEN;

    // [ ] Verify code after upload

    verifyUploadBox = new JCheckBox(_("Verify code after upload"));
    pain.add(verifyUploadBox);
    d = verifyUploadBox.getPreferredSize();
    verifyUploadBox.setBounds(left, top, d.width + 10, d.height);
    right = Math.max(right, left + d.width);
    top += d.height + GUI_BETWEEN;

    // [ ] Use external editor

    externalEditorBox = new JCheckBox(_("Use external editor"));
    pain.add(externalEditorBox);
    d = externalEditorBox.getPreferredSize();
    externalEditorBox.setBounds(left, top, d.width + 10, d.height);
    right = Math.max(right, left + d.width);
    top += d.height + GUI_BETWEEN;


    // [ ] Check for updates on startup

    checkUpdatesBox = new JCheckBox(_("Check for updates on startup"));
    pain.add(checkUpdatesBox);
    d = checkUpdatesBox.getPreferredSize();
    checkUpdatesBox.setBounds(left, top, d.width + 10, d.height);
    right = Math.max(right, left + d.width);
    top += d.height + GUI_BETWEEN;

    // [ ] Update sketch files to new extension on save (.pde -> .ino)

    updateExtensionBox = new JCheckBox(_("Update sketch files to new extension on save (.pde -> .ino)"));
    pain.add(updateExtensionBox);
    d = updateExtensionBox.getPreferredSize();
    updateExtensionBox.setBounds(left, top, d.width + 10, d.height);
    right = Math.max(right, left + d.width);
    top += d.height + GUI_BETWEEN;

    domainPortField= new JTextField();
    domainPortField.setColumns(30);
    Box domainBox = Box.createHorizontalBox();
    domainBox.add(new JLabel("Tftp upload Domain:"));
    domainBox.add(domainPortField);
    pain.add(domainBox);
    d = domainBox.getPreferredSize();
    domainBox.setBounds(left, top, d.width, d.height);
    top += d.height + GUI_BETWEEN;

    autoResetPortField= new JTextField();
    autoResetPortField.setColumns(8);
    Box resetBox = Box.createHorizontalBox();
    resetBox.add(new JLabel("Auto Reset Port:"));
    resetBox.add(autoResetPortField);
    pain.add(resetBox);
    d = resetBox.getPreferredSize();
    resetBox.setBounds(left, top, d.width, d.height);
    top += d.height + GUI_BETWEEN;


    tftpPassField = new JTextField();
    tftpPassField.setColumns(30);
    Box tftpBox = Box.createHorizontalBox();
    tftpBox.add(new JLabel("Tftp Secret Password:"******"Automatically associate .ino files with Arduino"));
      pain.add(autoAssociateBox);
      d = autoAssociateBox.getPreferredSize();
      autoAssociateBox.setBounds(left, top, d.width + 10, d.height);
      right = Math.max(right, left + d.width);
      top += d.height + GUI_BETWEEN;
    }

    // More preferences are in the ...

    label = new JLabel(_("More preferences can be edited directly in the file"));
    pain.add(label);
    d = label.getPreferredSize();
    label.setForeground(Color.gray);
    label.setBounds(left, top, d.width, d.height);
    right = Math.max(right, left + d.width);
    top += d.height; // + GUI_SMALL;

    label = new JLabel(preferencesFile.getAbsolutePath());
    final JLabel clickable = label;
    label.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
          Base.openFolder(Base.getSettingsFolder());
        }

        public void mouseEntered(MouseEvent e) {
          clickable.setForeground(new Color(0, 0, 140));
        }

        public void mouseExited(MouseEvent e) {
          clickable.setForeground(Color.BLACK);
        }
      });
    pain.add(label);
    d = label.getPreferredSize();
    label.setBounds(left, top, d.width, d.height);
    right = Math.max(right, left + d.width);
    top += d.height;

    label = new JLabel(_("(edit only when Arduino is not running)"));
    pain.add(label);
    d = label.getPreferredSize();
    label.setForeground(Color.gray);
    label.setBounds(left, top, d.width, d.height);
    right = Math.max(right, left + d.width);
    top += d.height; // + GUI_SMALL;


    // [  OK  ] [ Cancel ]  maybe these should be next to the message?

    button = new JButton(PROMPT_OK);
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          applyFrame();
          disposeFrame();
        }
      });
    pain.add(button);
    d2 = button.getPreferredSize();
    BUTTON_HEIGHT = d2.height;

    h = right - (BUTTON_WIDTH + GUI_SMALL + BUTTON_WIDTH);
    button.setBounds(h, top, BUTTON_WIDTH, BUTTON_HEIGHT);
    h += BUTTON_WIDTH + GUI_SMALL;

    button = new JButton(PROMPT_CANCEL);
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          disposeFrame();
        }
      });
    pain.add(button);
    button.setBounds(h, top, BUTTON_WIDTH, BUTTON_HEIGHT);

    top += BUTTON_HEIGHT + GUI_BETWEEN;


    // finish up

    wide = right + GUI_BIG;
    high = top + GUI_SMALL;


    // closing the window is same as hitting cancel button

    dialog.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          disposeFrame();
        }
      });

    ActionListener disposer = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
          disposeFrame();
        }
      };
    Base.registerWindowCloseKeys(dialog.getRootPane(), disposer);
    Base.setIcon(dialog);

    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    dialog.setLocation((screen.width - wide) / 2,
                      (screen.height - high) / 2);

    dialog.pack(); // get insets
    Insets insets = dialog.getInsets();
    dialog.setSize(wide + insets.left + insets.right,
                  high + insets.top + insets.bottom);


    // handle window closing commands for ctrl/cmd-W or hitting ESC.

    pain.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent e) {
          //System.out.println(e);
          KeyStroke wc = Editor.WINDOW_CLOSE_KEYSTROKE;
          if ((e.getKeyCode() == KeyEvent.VK_ESCAPE) ||
              (KeyStroke.getKeyStrokeForEvent(e).equals(wc))) {
            disposeFrame();
          }
        }
      });
  }
 public void setShowInternalMessage(String message) {
   if (message == null) {
     myTopPanel.removeAll();
     myTopPanel.add(
         new JLabel(IdeBundle.message("label.name")),
         new GridBagConstraints(
             0,
             0,
             1,
             1,
             0.0,
             0.0,
             GridBagConstraints.CENTER,
             GridBagConstraints.NONE,
             new Insets(0, 0, 0, 2),
             0,
             0));
     myTopPanel.add(
         myNameField,
         new GridBagConstraints(
             1,
             0,
             1,
             1,
             1.0,
             0.0,
             GridBagConstraints.CENTER,
             GridBagConstraints.HORIZONTAL,
             new Insets(0, 2, 0, 2),
             0,
             0));
     myTopPanel.add(
         new JLabel(IdeBundle.message("label.extension")),
         new GridBagConstraints(
             2,
             0,
             1,
             1,
             0.0,
             0.0,
             GridBagConstraints.CENTER,
             GridBagConstraints.NONE,
             new Insets(0, 2, 0, 2),
             0,
             0));
     myTopPanel.add(
         myExtensionField,
         new GridBagConstraints(
             3,
             0,
             1,
             1,
             .3,
             0.0,
             GridBagConstraints.CENTER,
             GridBagConstraints.HORIZONTAL,
             new Insets(0, 2, 0, 0),
             0,
             0));
     myExtensionField.setColumns(7);
   } else {
     myTopPanel.removeAll();
     myTopPanel.add(
         new JLabel(message),
         new GridBagConstraints(
             0,
             0,
             4,
             1,
             1.0,
             0.0,
             GridBagConstraints.WEST,
             GridBagConstraints.HORIZONTAL,
             new Insets(0, 0, 0, 0),
             0,
             0));
     myTopPanel.add(
         Box.createVerticalStrut(myNameField.getPreferredSize().height),
         new GridBagConstraints(
             4,
             0,
             1,
             1,
             0.0,
             0.0,
             GridBagConstraints.WEST,
             GridBagConstraints.HORIZONTAL,
             new Insets(0, 0, 0, 0),
             0,
             0));
   }
   myMainPanel.revalidate();
   myTopPanel.repaint();
 }
Пример #18
0
  /** Create and layout the visual components. */
  private void initComponents() {
    setTitle("Chart Settings");
    setSize(new Dimension(450, 375));
    setResizable(false);

    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog(evt);
          }
        });

    Box mainView = new Box(VERTICAL);
    getContentPane().add(mainView);

    Box row;

    Box yAxisView = new Box(VERTICAL);
    yAxisView.setBorder(border);
    mainView.add(yAxisView);

    yAutoScaleCheckbox = new JCheckBox("Auto Scale");
    yAutoScaleCheckbox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            yAutoScaleCheckboxActionPerformed(evt);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(yAutoScaleCheckbox);
    yAxisView.add(row);

    yAxisMinValueField = new JTextField(10);
    yAxisMinValueField.setMaximumSize(yAxisMinValueField.getPreferredSize());
    yAxisMinValueField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
    yAxisMinValueField.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent event) {
            yAxisMinValueField.selectAll();
          }

          public void focusLost(FocusEvent event) {
            yAxisMinValueField.setCaretPosition(0);
            yAxisMinValueField.moveCaretPosition(0);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(new JLabel("Min:"));
    row.add(yAxisMinValueField);
    yAxisView.add(row);

    yAxisMaxValueField = new JTextField(10);
    yAxisMaxValueField.setMaximumSize(yAxisMaxValueField.getPreferredSize());
    yAxisMaxValueField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
    yAxisMaxValueField.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent event) {
            yAxisMaxValueField.selectAll();
          }

          public void focusLost(FocusEvent event) {
            yAxisMaxValueField.setCaretPosition(0);
            yAxisMaxValueField.moveCaretPosition(0);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(new JLabel("Max:"));
    row.add(yAxisMaxValueField);
    yAxisView.add(row);

    yAxisDivisionsField = new JTextField(10);
    yAxisDivisionsField.setMaximumSize(yAxisDivisionsField.getPreferredSize());
    yAxisDivisionsField.setHorizontalAlignment(JTextField.RIGHT);
    yAxisDivisionsField.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent event) {
            yAxisDivisionsField.selectAll();
          }

          public void focusLost(FocusEvent event) {
            yAxisDivisionsField.setCaretPosition(0);
            yAxisDivisionsField.moveCaretPosition(0);
          }
        });
    row = new Box(HORIZONTAL);
    row.add(Box.createHorizontalGlue());
    row.add(new JLabel("Major Divisions:"));
    row.add(yAxisDivisionsField);
    yAxisView.add(row);

    Box buttonView = new Box(HORIZONTAL);
    mainView.add(buttonView);
    buttonView.add(Box.createHorizontalGlue());

    JButton revertButton = new JButton("Revert");
    revertButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            revertButtonActionPerformed(event);
          }
        });
    buttonView.add(revertButton);

    JButton applyButton = new JButton("Apply");
    applyButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            applyButtonActionPerformed(event);
          }
        });
    buttonView.add(applyButton);

    pack();
  }
Пример #19
0
  public ChatClient() {
    super(APPNAME);

    JPanel topPanel = new JPanel();
    JPanel leftPanel = new JPanel();
    JPanel buttomPanel = new JPanel();

    JPanel roomPanel = new JPanel();
    JPanel userPanel = new JPanel();

    roomList = new JList();
    userList = new JList();
    msgTextArea = new JTextArea();
    msgTextField = new JTextField();
    nameTextField = new JTextField();
    submitButton = new JButton("送信");
    renameButton = new JButton("名前の変更");
    addRoomButton = new JButton("部屋を追加");
    enterRoomButton = new JButton("入室");

    submitButton.addActionListener(this);
    submitButton.setActionCommand("submit");

    renameButton.addActionListener(this);
    renameButton.setActionCommand("rename");

    addRoomButton.addActionListener(this);
    addRoomButton.setActionCommand("addRoom");

    enterRoomButton.addActionListener(this);
    enterRoomButton.setActionCommand("enterRoom");

    roomPanel.setLayout(new BorderLayout());
    roomPanel.add(new JLabel("チャットルーム"), BorderLayout.NORTH);
    roomPanel.add(new JScrollPane(roomList), BorderLayout.CENTER);
    roomPanel.add(enterRoomButton, BorderLayout.SOUTH);

    userPanel.setLayout(new BorderLayout());
    userPanel.add(new JLabel("参加ユーザー"), BorderLayout.NORTH);
    userPanel.add(new JScrollPane(userList), BorderLayout.CENTER);

    topPanel.setLayout(new FlowLayout());
    topPanel.add(new JLabel("名前"));
    topPanel.add(nameTextField);
    topPanel.add(renameButton);
    topPanel.add(addRoomButton);

    nameTextField.setPreferredSize(new Dimension(200, nameTextField.getPreferredSize().height));

    leftPanel.setLayout(new GridLayout(2, 1));
    leftPanel.add(roomPanel);
    leftPanel.add(userPanel);

    buttomPanel.setLayout(new BorderLayout());
    buttomPanel.add(msgTextField, BorderLayout.CENTER);
    buttomPanel.add(submitButton, BorderLayout.EAST);

    // テキストエリアはメッセージを表示するだけなので編集不可に設定
    msgTextArea.setEditable(false);

    // コンポーネントの状態を退室状態で初期化
    exitedRoom();

    this.getContentPane().add(new JScrollPane(msgTextArea), BorderLayout.CENTER);
    this.getContentPane().add(topPanel, BorderLayout.NORTH);
    this.getContentPane().add(leftPanel, BorderLayout.WEST);
    this.getContentPane().add(buttomPanel, BorderLayout.SOUTH);

    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            try {
              close();
            } catch (Exception err) {
            }
          }
        });
    connectServer();

    // メッセージ受信監視用のスレッドを生成してスタートさせる
    thread = new Thread(this);
    thread.start();

    // 現在の部屋を取得する
    sendMessage("getRooms");
  }