List of usage examples for javax.swing JTextArea JTextArea
public JTextArea(int rows, int columns)
From source file:Main.java
public void build() { setSize(600, 600);/* w ww . ja va2s . c om*/ JTextPane textPane = new JTextPane(); JScrollPane scrollPane = new JScrollPane(textPane); scrollPane.setPreferredSize(new Dimension(300, 300)); JTextArea changeLog = new JTextArea(5, 30); changeLog.setEditable(false); JScrollPane scrollPaneForLog = new JScrollPane(changeLog); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane, scrollPaneForLog); splitPane.setOneTouchExpandable(true); JPanel statusPane = new JPanel(new GridLayout(1, 1)); JLabel caretListenerLabel = new JLabel("Caret Status"); statusPane.add(caretListenerLabel); JToolBar toolBar = new JToolBar(); toolBar.add(new JButton("Btn1")); toolBar.add(new JButton("Btn2")); toolBar.add(new JButton("Btn3")); toolBar.add(new JButton("Btn4")); getContentPane().add(toolBar, BorderLayout.PAGE_START); getContentPane().add(splitPane, BorderLayout.CENTER); getContentPane().add(statusPane, BorderLayout.PAGE_END); JMenu editMenu = new JMenu("test"); JMenu styleMenu = new JMenu("test"); JMenuBar mb = new JMenuBar(); mb.add(editMenu); mb.add(styleMenu); setJMenuBar(mb); }
From source file:Main.java
private JTextArea getJTextArea_content() { if (jTextArea_content == null) { jTextArea_content = new JTextArea(3, 30); jTextArea_content.setBounds(new Rectangle(75, 224, 678, 47)); }/*from www . ja va2 s . c o m*/ return jTextArea_content; }
From source file:CombinedLayoutManager.java
protected JComponent getTextArea() { return new JTextArea(10, 10); }
From source file:PlotsBuilding.PlotPanel.java
public PlotPanel(ArrayList<PlotsData> plotscollection, Plotcr frame) { pointsPanel = new JPanel(); pointsPanel.setLayout(new BoxLayout(pointsPanel, BoxLayout.X_AXIS)); cursorInfo = new JTextArea(2, 10); cursorInfo.setVisible(true);// ww w .java 2s .c om chartPanel = new ChartPanel(fillCollection(plotscollection)); chartPanel.addChartMouseListener(new MyChartMouseListener()); chartPanel.setPreferredSize(new Dimension(800, 450)); pointsPanel.setMaximumSize(new Dimension(chartPanel.getWidth(), 70)); pointsPanel.add(cursorInfo); chartPanel.setBackground(Color.WHITE); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(chartPanel); add(pointsPanel); }
From source file:FileChooserDemo2.java
public FileChooserDemo2() { super(new BorderLayout()); // Create the log first, because the action listener // needs to refer to it. log = new JTextArea(5, 20); log.setMargin(new Insets(5, 5, 5, 5)); log.setEditable(false);//from w ww .j a v a 2s . c om JScrollPane logScrollPane = new JScrollPane(log); JButton sendButton = new JButton("Attach..."); sendButton.addActionListener(this); add(sendButton, BorderLayout.PAGE_START); add(logScrollPane, BorderLayout.CENTER); }
From source file:components.TextDemo.java
public TextDemo() { super(new GridBagLayout()); textField = new JTextField(20); textField.addActionListener(this); textArea = new JTextArea(5, 20); textArea.setEditable(false);/*w w w . j ava 2s. c o m*/ JScrollPane scrollPane = new JScrollPane(textArea); //Add Components to this panel. GridBagConstraints c = new GridBagConstraints(); c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; add(textField, c); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; add(scrollPane, c); }
From source file:JWSFileChooserDemo.java
public JWSFileChooserDemo() { super(new BorderLayout()); //Create the log first, because the action listeners //need to refer to it. log = new JTextArea(5, 20); log.setMargin(new Insets(5, 5, 5, 5)); log.setEditable(false);/*w ww. j a v a 2s . com*/ JScrollPane logScrollPane = new JScrollPane(log); //Create the open button. We use the image from the JLF //Graphics Repository (but we extracted it from the jar). openButton = new JButton("Open a File...", createImageIcon("images/Open16.gif")); openButton.addActionListener(this); //Create the save button. We use the image from the JLF //Graphics Repository (but we extracted it from the jar). saveButton = new JButton("Save a File...", createImageIcon("images/Save16.gif")); //PENDING: removed the Save button action listener //so that people won't overwrite existing files. //See bug 4761577. //saveButton.addActionListener(this); saveButton.setEnabled(false); //For layout purposes, put the buttons in a separate panel JPanel buttonPanel = new JPanel(); buttonPanel.add(openButton); buttonPanel.add(saveButton); //Add the buttons and the log to this panel. add(buttonPanel, BorderLayout.PAGE_START); add(logScrollPane, BorderLayout.CENTER); }
From source file:flow.visibility.tapping.OpenDayLightUtils.java
/** Creating the Pane for Flow Entry */ public OpenDayLightUtils() { super("Installed Flow"); FlowtextArea = new JTextArea(50, 10); FlowtextArea.setEditable(false);//from www.j a v a 2 s.c om FlowtextArea.setFont(new Font("Courier New", Font.BOLD, 12)); PrintStream FlowprintStream = new PrintStream(new CustomOutputStream(FlowtextArea)); // re-assigns standard output stream and error output stream System.setOut(FlowprintStream); System.setErr(FlowprintStream); // creates the GUI setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.insets = new Insets(10, 10, 10, 10); constraints.anchor = GridBagConstraints.WEST; constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1.0; constraints.weighty = 1.0; /** Adding the Pane into Frame */ scrollPane = new JScrollPane(FlowtextArea); this.add(scrollPane, constraints); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(400, 600); setLocationRelativeTo(null); // centers on screen }
From source file:components.FileChooserDemo.java
public FileChooserDemo() { super(new BorderLayout()); //Create the log first, because the action listeners //need to refer to it. log = new JTextArea(5, 20); log.setMargin(new Insets(5, 5, 5, 5)); log.setEditable(false);/*from ww w.j a v a2 s . c o m*/ JScrollPane logScrollPane = new JScrollPane(log); //Create a file chooser fc = new JFileChooser(); //Uncomment one of the following lines to try a different //file selection mode. The first allows just directories //to be selected (and, at least in the Java look and feel, //shown). The second allows both files and directories //to be selected. If you leave these lines commented out, //then the default mode (FILES_ONLY) will be used. // //fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); //fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); //Create the open button. We use the image from the JLF //Graphics Repository (but we extracted it from the jar). openButton = new JButton("Open a File...", createImageIcon("images/Open16.gif")); openButton.addActionListener(this); //Create the save button. We use the image from the JLF //Graphics Repository (but we extracted it from the jar). saveButton = new JButton("Save a File...", createImageIcon("images/Save16.gif")); saveButton.addActionListener(this); //For layout purposes, put the buttons in a separate panel JPanel buttonPanel = new JPanel(); //use FlowLayout buttonPanel.add(openButton); buttonPanel.add(saveButton); //Add the buttons and the log to this panel. add(buttonPanel, BorderLayout.PAGE_START); add(logScrollPane, BorderLayout.CENTER); }
From source file:TextComponentTest.java
public TextComponentFrame() { setTitle("TextComponentTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); final JTextField textField = new JTextField(); final JPasswordField passwordField = new JPasswordField(); JPanel northPanel = new JPanel(); northPanel.setLayout(new GridLayout(2, 2)); northPanel.add(new JLabel("User name: ", SwingConstants.RIGHT)); northPanel.add(textField);//from w w w . j a v a 2 s .c o m northPanel.add(new JLabel("Password: ", SwingConstants.RIGHT)); northPanel.add(passwordField); add(northPanel, BorderLayout.NORTH); final JTextArea textArea = new JTextArea(8, 40); JScrollPane scrollPane = new JScrollPane(textArea); add(scrollPane, BorderLayout.CENTER); // add button to append text into the text area JPanel southPanel = new JPanel(); JButton insertButton = new JButton("Insert"); southPanel.add(insertButton); insertButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { textArea.append("User name: " + textField.getText() + " Password: " + new String(passwordField.getPassword()) + "\n"); } }); add(southPanel, BorderLayout.SOUTH); // add a text area with scroll bars }