-
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.
-
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.
-
Can you provide a couple screenshots? Like, one of the spec, and one of what you're getting and then explain the discrepancy?