Results 1 to 5 of 5
Thread: JTextArea
- 01-10-2011, 07:17 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 11
- Rep Power
- 0
JTextArea
My program has trouble showing the entire JTextArea. In my program I have a JPanel, that I've also drawn on using the paint method, and a jTextArea (all within one jframe). My JTextArea dimensions are 200, 500, however there is only a small white area which expands when typing. Ideally, I want both my drawing within the jpanel, and the jtextarea next to it and completely white to the specifications 200,500. Help please!!!!
-
It's hard to know what your problem is based on the description you give, but guesses include incorrect use of layout managers and incorrect painting (e.g., why are you painting in paint, not in paintComponent?). For more specific help, consider creating and posting an SSCCE (see link below) and giving us more information about the problem.
Much luck.
- 01-10-2011, 08:39 PM #3
Member
- Join Date
- Jan 2011
- Posts
- 11
- Rep Power
- 0
Sorry I've not been correct, it's a line graph and I have a constructor consisting of...
{
super(true);
canvas = new JPanel(true);
text = new JTextArea();
canvas.setPreferredSize(new Dimension(500, 500));
text.setPreferredSize(new Dimension(200, 500));
canvas.setBorder(BorderFactory.createLineBorder(Co lor.black));
text.setBorder(BorderFactory.createLineBorder(Colo r.black));
add(canvas); add(stats);
}
and a paint method...
{
g.drawRect(50, 50, 400, 400);
int xy = 70;
for(int i = 0; i < 20; i++)
{
g.drawLine(xy, 50, xy, 450);
g.drawLine(50, xy, 450, xy);
xy+=20;
}
g.setColor(Color.red);
g.drawLine(90, 50, 90, 450);
}
it also has a main method
-
Again, I'm not sure what's going on based on the information provided. Again, please read the link about creating and posting an SSCCE (it's in my signature links below). Also please check the link on how to use code tags. Luck.
- 01-11-2011, 05:44 PM #5
Similar Threads
-
JTextArea
By PhQ in forum AWT / SwingReplies: 10Last Post: 03-28-2010, 06:17 PM -
JTextArea on PopUp -JTextArea isn't editable
By Richy76 in forum AWT / SwingReplies: 3Last Post: 02-01-2010, 07:51 PM -
Tab key in JTextArea
By KristoZ in forum New To JavaReplies: 1Last Post: 09-25-2009, 07:27 PM -
About JTEXTAREA
By makpandian in forum AWT / SwingReplies: 4Last Post: 03-19-2009, 06:53 AM -
JTextArea
By saytri in forum New To JavaReplies: 0Last Post: 01-13-2008, 01:07 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks