Hi Guys,
I have two jtext area boxes, is it possible to have 1 vertical scroll bar to scroll both of them at the same time. I have looked over the net and cant really find anything , can you guys help me.
Thankyou
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Hi Guys,
I have two jtext area boxes, is it possible to have 1 vertical scroll bar to scroll both of them at the same time. I have looked over the net and cant really find anything , can you guys help me.
Thankyou
There are several ways to do this. You could just set put one of the JTextAreas in the JScrollPane, add a listener to the JScrollPane or the vertical scroll bar, and call scrollRectToVisible() when that listener fires. Or you put a JScrollPane on both of them, then have those JScrollPanes share either models or vertical scroll bars.
Try googling "java fixed JTable column" or "fixedtable", something like that. Let me know if you're still having issues after that.
Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
right i have jtextarea2 in a jScrollPane and jtextarea1 on its own, however i cant work out how to get the jtextarea1 to "scrollRectToVisible() ". Currently when jtextarea1 gets filled up with text and more is added the box length is extended
right ignore what i said, I have decided to use a Table instead of two text areas, it will work out better
Heh, okay. Note that you can actually use JTextAreas as the renderer for the cells of a JTable.
Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
my knowledge at java is rather baisc,
Im using netbeans to create the table (GUI builder) and what i have done is create a table(3 cols, 2 rows) and now what i am trying to do is have a button you can press and it will add a blank row allowing data to be put in it, however im getting no where.
Ive read that a simple command like jTable1.addRow(new Object[]{null,null,null}); would do the job, however i think because im using netbeans to create the table im getting problems it does not like the addRow bit saying it cannont find the symbol
I also think this may be casuing the prob two
" jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] { "
Last edited by fortune2k; March 4th, 2011 at 01:27 PM.
If you want an honest answer, I urge you to ditch the GUI builder immediately.
Without seeing the actual code (in SSCCE form, which means no GUI-builder code) and the actual Exception and stack trace, I can't really comment on what you're doing wrong. But the line you posted is definitely incorrect syntax- at the very least, you need to close the opening parenthesis of the constructor for DefaultTableModel.
Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
lol, right ive gone back to the original idea because its simple and i can kinda understand it at the moment
EDIT: I have given up and left the project I think im going to get someone to make the program for me
Last edited by fortune2k; March 4th, 2011 at 02:00 PM.
That's a shame. You were probably really close to the solution. If you post an SSCCE, I'd love to help you through it.
Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!