Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Creating an text area  (Read 1720 times)
0 Members and 1 Guest are viewing this topic.
Offline hotmail590

Junior Newbie





« Posted 2005-07-22 21:56:31 »

I would like to create a simple window that has a text area
where people cannot edit text area, and there should be a scroll bar for it also.
On the top right corner above the text area should be a button that says "Print Out Config"

the result is just a simple widow that has a blank text area with a scroll bar next  to it, a button somewhere that says Print Out Config.

I have tried the following, but nothing shows up when I run the program.

so far this is what I have came up with

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.JPanel;
import java.awt.BorderLayout;

public class ConfigTester {
   
   private static final int FRAME_WIDTH = 800;
   private static final int FRAME_HEIGHT = 600;
   

   
   public static void main(String[] args) {
     
      JFrame myFrame = new JFrame("Config Editor 1.0");
     
     
      myFrame.setBounds(0,0,FRAME_WIDTH,FRAME_HEIGHT);
      myFrame.setVisible(true);
     
      myFrame.addWindowListener( new WindowAdapter() {public void windowClosing(WindowEvent e) {System.exit(0);}   });
     
      final int AREA_ROWS = 10;
      final int AREA_COLUMNS= 30;
     
     
      final JTextArea resultsArea = new JTextArea(AREA_ROWS, AREA_COLUMNS);
      JScrollPane scrollPane = new JScrollPane(resultsArea);
     
      resultsArea.setEditable(false);
     

     
      JButton printAllButton = new JButton("Print Out Config");
     
      JPanel northPanel = new JPanel();
      northPanel.add(printAllButton);
     
      myFrame.add(northPanel, BorderLayout.NORTH);
      myFrame.add(scrollPane);
     
     
     
     
   }
}
8: Undefined index: online
File: /home/jgo/public_html/Themes/default/Display.template.php (main sub template - eval?)
Line: 161