List of usage examples for javax.swing JTextArea JTextArea
public JTextArea(Document doc)
From source file:JTextAreaI18N.java
public JTextAreaI18N() { GraphicsEnvironment.getLocalGraphicsEnvironment(); JTextArea textArea = new JTextArea(davidMessage); textArea.setFont(new Font("LucidaSans", Font.PLAIN, 40)); this.getContentPane().add(textArea); textArea.setVisible(true);//from w w w .j av a 2 s .c om }
From source file:MainClass.java
public MainClass() { super("Simple SplitPane Frame"); setSize(450, 200);// w ww .j a v a 2 s . c o m setDefaultCloseOperation(EXIT_ON_CLOSE); JTextArea jt1 = new JTextArea(sometext); JTextArea jt2 = new JTextArea(sometext); jt1.setLineWrap(true); jt2.setLineWrap(true); jt1.setMinimumSize(new Dimension(150, 150)); jt2.setMinimumSize(new Dimension(150, 150)); jt1.setPreferredSize(new Dimension(250, 200)); JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jt1, jt2); getContentPane().add(sp, BorderLayout.CENTER); }
From source file:JTextAreaDemo.java
public JTextAreaDemo() { super("JTextAreaDemo"); GraphicsEnvironment.getLocalGraphicsEnvironment(); Font font = new Font("LucidaSans", Font.PLAIN, 40); JTextArea textArea = new JTextArea(davidMessage + andyMessage); textArea.setFont(font);/* w ww . j av a 2 s. c o m*/ this.getContentPane().add(textArea); textArea.show(); }
From source file:SimpleSplitPane.java
public SimpleSplitPane() { super("Simple SplitPane Frame"); setSize(450, 200);/*from w w w . ja v a 2s.c o m*/ setDefaultCloseOperation(EXIT_ON_CLOSE); JTextArea jt1 = new JTextArea(sometext); JTextArea jt2 = new JTextArea(sometext); // Make sure our text boxes do line wrapping and have reasonable // minimum sizes. jt1.setLineWrap(true); jt2.setLineWrap(true); jt1.setMinimumSize(new Dimension(150, 150)); jt2.setMinimumSize(new Dimension(150, 150)); jt1.setPreferredSize(new Dimension(250, 200)); JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jt1, jt2); getContentPane().add(sp, BorderLayout.CENTER); }
From source file:my.jabbr.app.ftpclient.ui.install.ProductLicenseInstallationPanel.java
private void initComponents() { try {// w w w .j ava2 s . com String licenseStr = FileUtils.readFileToString(new File(ConfigManager.GPL_LICENSE_FILE)); licenseText = new JTextArea(licenseStr); licenseText.setColumns(20); licenseText.setRows(15); licenseText.setBorder(BorderFactory.createLineBorder(UIAccessories.BORDER_GRAY)); licenseText.setBackground(UIAccessories.WHITE); licenseText.setEditable(false); JScrollPane scrollPane = new JScrollPane(licenseText); scrollPane.setBorder(null); scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.getViewport().setBorder(null); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); setLayout(new BorderLayout(20, 20)); add(createTransparentFillerPanel(), BorderLayout.NORTH); add(scrollPane, BorderLayout.CENTER); } catch (IOException e) { e.printStackTrace(); } this.setOpaque(false); }
From source file:SysConfig.java
public SysConfig() { super("JTabbedPane & BoxLayout Demonstration"); setSize(500, 300);/* ww w .ja va 2 s.co m*/ setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel configPane = new JPanel(); configPane.setLayout(new BoxLayout(configPane, BoxLayout.Y_AXIS)); JTextArea question = new JTextArea("Which of the following options\n" + "do you have installed?"); // Ok, now configure the textarea to show up properly inside the box. // This is part of the "high art" of Swing... question.setEditable(false); question.setMaximumSize(new Dimension(300, 50)); question.setAlignmentX(0.0f); question.setBackground(configPane.getBackground()); JCheckBox audioCB = new JCheckBox("Sound Card", true); JCheckBox nicCB = new JCheckBox("Ethernet Card", true); JCheckBox tvCB = new JCheckBox("Video Out", false); configPane.add(Box.createVerticalGlue()); configPane.add(question); configPane.add(audioCB); configPane.add(nicCB); configPane.add(tvCB); configPane.add(Box.createVerticalGlue()); JLabel audioPane = new JLabel("Audio stuff"); JLabel nicPane = new JLabel("Networking stuff"); JLabel tvPane = new JLabel("Video stuff"); JLabel helpPane = new JLabel("Help information"); audioCB.addItemListener(new TabManager(audioPane)); nicCB.addItemListener(new TabManager(nicPane)); tvCB.addItemListener(new TabManager(tvPane)); config.addTab("System", null, configPane, "Choose Installed Options"); config.addTab("Audio", null, audioPane, "Audio system configuration"); config.addTab("Networking", null, nicPane, "Networking configuration"); config.addTab("Video", null, tvPane, "Video system configuration"); config.addTab("Help", null, helpPane, "How Do I..."); getContentPane().add(config, BorderLayout.CENTER); }
From source file:ar.com.zauber.commons.spring.mail.SwingMailSender.java
/** @see SimpleMailMessage[]) */ public final void send(final SimpleMailMessage[] simpleMessages) throws MailException { final JTextArea area = new JTextArea(AbstractMailSender.toString(simpleMessages)); area.setLineWrap(true);// w ww . j a v a2 s . c o m final JFrame frame = new JFrame("email sent"); frame.getContentPane().add(new JScrollPane(area, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)); final int frameWidth = 640; final int frameHeight = 480; frame.setPreferredSize(new Dimension(frameWidth, frameHeight)); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public Main() { UIManager.put("TabbedPane.contentBorderInsets", new InsetsUIResource(1, 0, 0, 0)); UIManager.put("TabbedPane.contentAreaColor", new ColorUIResource(Color.GREEN)); UIManager.put("TabbedPane.focus", new ColorUIResource(Color.ORANGE)); UIManager.put("TabbedPane.selected", new ColorUIResource(Color.YELLOW)); UIManager.put("TabbedPane.darkShadow", new ColorUIResource(Color.DARK_GRAY)); UIManager.put("TabbedPane.borderHightlightColor", new ColorUIResource(Color.LIGHT_GRAY)); UIManager.put("TabbedPane.light", new ColorUIResource(Color.WHITE)); UIManager.put("TabbedPane.tabAreaBackground", new ColorUIResource(Color.CYAN)); UIManager.put("ToolTip.background", Color.WHITE); UIManager.put("ToolTip.border", new BorderUIResource(new LineBorder(Color.BLACK))); this.updateUI(); this.setBackground(Color.BLUE); JPanel testPanel = new JPanel(); testPanel.setLayout(new BorderLayout()); testPanel.add(new JLabel("Hello World"), BorderLayout.NORTH); testPanel.add(new JTextArea("Looks nice out there :)"), BorderLayout.CENTER); JPanel testPanel2 = new JPanel(); testPanel2.setLayout(new BorderLayout()); testPanel2.add(new JLabel("Good Bye World"), BorderLayout.NORTH); testPanel2.add(new JTextArea("OK"), BorderLayout.CENTER); this.addTab("Hello World", testPanel); this.addTab("World", testPanel2); }
From source file:TextEditor.java
private void createTextArea() { textArea = new JTextArea("some text"); textArea.setLineWrap(true);//from w ww .jav a 2s. c o m textArea.setWrapStyleWord(true); JScrollPane areaScrollPane = new JScrollPane(textArea); areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); areaScrollPane.setPreferredSize(new Dimension(450, 250)); add(areaScrollPane); }
From source file:com.googlecode.logVisualizer.chart.AreaListChartMouseEventListener.java
public void chartMouseClicked(final ChartMouseEvent e) { if (e.getEntity() instanceof CategoryItemEntity) { final CategoryItemEntity entity = (CategoryItemEntity) e.getEntity(); final String areaName = (String) entity.getColumnKey(); final StringBuilder str = new StringBuilder(100); for (final TurnInterval ti : logData.getTurnIntervalsSpent()) if (ti.getAreaName().equals(areaName)) str.append(ti + "\n"); final JScrollPane text = new JScrollPane(new JTextArea(str.toString())); text.setPreferredSize(new Dimension(450, 200)); JOptionPane.showMessageDialog(null, text, "Occurences of turns spent at " + areaName, JOptionPane.INFORMATION_MESSAGE); }/*from w w w. j a va 2s .com*/ }