Insert « JTextArea « Java Swing Q&A





2. How to use insert() with JTextArea    coderanch.com

import java.awt.*; import java.awt.event.*; import javax.swing.border.Border; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class TillPanel extends JPanel implements ActionListener { static String choices[]= { "Draught beer","Bottled beer","Spirits", "Alco pop","Wine","Soft drinks","Snacks" }; TillPanel() { Font f=new Font("Helvetica",Font.BOLD,32); GridBagLayout gridbag=new GridBagLayout(); setBackground(Color.blue); GridBagConstraints constraints=new GridBagConstraints(); setLayout(gridbag); buildConstraints(constraints,0,3,1,1,1,1); constraints.fill=GridBagConstraints.NONE; JTextArea t=new JTextArea(5,20); for(int i=0;i

3. JTextArea insert problem    coderanch.com

4. Insertion in JTextArea    coderanch.com

import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; public class TextInsertion { static Point p; public static void main(String[] args) { final JTextArea textArea = new JTextArea(); textArea.setText("Cricket\nFootBall\nTennis"); textArea.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { p = e.getPoint(); } }); JButton insert = new JButton("insert text"); insert.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(p != null) { int offset ...

5. help with textarea insertion    coderanch.com

hello all, i m new to swings........ kindly help me insertin a textarea in which i want to display the String stored in data.. i have problem addin the panel to the frame.. shud i make a new frame object and then add panel to it(frame1) i want my String(here named as data) to be displayed in a GUI window or ...

6. insert image into JTExtArea???    forums.oracle.com

You've been asked before to post Swing related questions in the Swing forum. Did you search the Swing forum before posting this question? You've also been told to use the JTextPane in previous postings and have been given a link to the Swing tutorial. Did you bother to read the other posting and read the tutorial?