Jump to content

Search the Community

Showing results for tags 'jtextarea'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RuneLocus
    • News & Announcements
    • Information Booth
    • Website Support
    • Introductions
    • Chat
    • Forum Games
  • RuneScape Development
    • RSPS General
    • RuneScape Private Server (RS2)
    • RuneScape Private Server (503+)
    • RuneScape Private Server (EoC 742+)
  • Other
    • Digital Art
    • Gaming
    • Webdevelopment
    • Computers
  • Marketplace
    • RuneScape Market
    • RSPS Market
    • Others Market
    • Freelance Middleman Services
  • Super Secret Club's Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. Okay, my problem is that I have GUI and I want to have a method that I can use that'll update the JTextArea with the new string. But I keep getting this error [code] Exception in thread "main" java.lang.NullPointerException at text.gui.GUI.updateTextArea(GUI.java:138) at text.game.Test.intro(Test.java:10) at text.gui.GUI.main(GUI.java:50) [/code] Here's all the code I have that involves the text area, am I missing something, I don't know what's wrong. [code]private JTextArea textArea;[/code] [code] public static void main(String[] args) { /*try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch(Throwable e) { e.printStackTrace(); } EventQueue.invokeLater(new Runnable() { public void run() { GUI frame = new GUI(); Test.intro(); } });*/ GUI frame = new GUI(); frame.setVisible(true); Test.intro(); }[/code] [code] final JTextArea textArea = new JTextArea(); textArea.setBackground(new Color(176, 224, 230)); scrollPane.setViewportView(textArea); textArea.setEditable(false);[/code] [code] textField.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER) { inputString = textField.getText(); textArea.append(inputString+"\n"); textField.setText(""); } } });[/code] [code] public void updateTextArea(String message) { textArea.append(textArea.getText() + message + "\n"); textArea.selectAll(); int x = textArea.getSelectionEnd(); textArea.select(x, x); }[/code] [code]public class Test { static GUI frame = new GUI(); public static void intro() { frame.updateTextArea("Testing"); } }[/code] :confused:
×