public void initComponents() { /** ******************** The main container *************************** */ Container container = this.getContentPane(); container.setLayout(new BorderLayout()); container.setBackground(Color.black); this.setSize(650, 600); this.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) {} }); /** ************************* MAIN PANEL ******************************* */ mainPanel = new JPanel(); // If put to False: we see the container's background mainPanel.setOpaque(false); mainPanel.setLayout(new BorderLayout()); container.add(mainPanel, BorderLayout.CENTER); allmessagesTextArea = new TextArea(); allmessagesTextArea.setEditable(false); allmessagesTextArea.setFont(new Font("Dialog", 1, 12)); allmessagesTextArea.setForeground(Color.black); allmessagesTextArea.append("Select a session in the list to view its messages"); mainPanel.add(allmessagesTextArea, BorderLayout.CENTER); sessionsList = new List(); sessionsList.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { showMessages(e); } }); sessionsList.setForeground(Color.black); sessionsList.setFont(new Font("Dialog", 1, 14)); mainPanel.add(sessionsList, BorderLayout.WEST); okButton = new JButton(" OK "); okButton.setToolTipText("Returns to the main frame"); okButton.setFont(new Font("Dialog", 1, 16)); okButton.setFocusPainted(false); okButton.setBackground(Color.lightGray); okButton.setBorder(new BevelBorder(BevelBorder.RAISED)); okButton.setVerticalAlignment(SwingConstants.CENTER); okButton.setHorizontalAlignment(SwingConstants.CENTER); container.add(okButton, BorderLayout.SOUTH); okButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { setVisible(false); } }); }
public AppExport() { JLabel label = new JLabel("Choose Dashboard's Web directory: "); add(label); JButton go = new JButton("Browse..."); go.addActionListener(this); add(go); textArea = new TextArea("", 20, 100, TextArea.SCROLLBARS_NONE); textArea.setEditable(false); add(textArea); }
public VertexInfoDialog(Vertex vertex) { v = vertex; setTitle("Vertex: " + v.getName()); Container cp = getContentPane(); JPanel p = new JPanel(); p.setLayout(new GridLayout(1, 1)); opis = new TextArea(v.getInfo()); opis.setEditable(false); p.add(opis, new FlowLayout()); cp.add(p); setSize(200, 300); setDefaultCloseOperation(DISPOSE_ON_CLOSE); }
public void addComponentsToPane() { testfield = new JTextField("", 33); testfield.addKeyListener(this); testtextarea = new TextArea(buffer, 15, 33, TextArea.SCROLLBARS_VERTICAL_ONLY); testtextarea.setEditable(false); JScrollPane scrollPane = new JScrollPane(testtextarea); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setPreferredSize(new Dimension(600, 200)); getContentPane().add(testfield, BorderLayout.PAGE_END); getContentPane().add(testtextarea, BorderLayout.CENTER); }