Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JTable and JTextArea

Posted on 2002-06-13
8
Medium Priority
?
669 Views
Last Modified: 2008-02-01
Currently i have a JTextArea embedded in a table cell.  BUT i don't want the row height to be the height of the text area.  what i want to have happen is that when a user clicks into the given cell it expands (the text area, not the table row) similar to how combo box does.

what would be the best way to do this?
0
Comment
Question by:bobbit31
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 7

Accepted Solution

by:
tomboshell earned 1200 total points
ID: 7077528
Oh, it sounds like you want to activate a pop-up when the cell is activated.  That would be my suggestion.  Let me try a talk-through first.  1. Create a new class (maybe a JDialog) that would handle the text entry (a get/set method, loose focus method for activating the close.), implement the TableCellEditor interface.  2. create an instance of that class and register it as a cell editor for that column.

public class MyTEdit extends JDialog implements TableCellEditor {...}
...
.
.
//in the table creation area
TableColumn textColumn = table.GetColumn("TextArea");
textColumn.setCellEditor(new MyTEdit());


That should roughly do it.  Gives you a little something to play with, but I hope that the idea is clear enough.

Tom

0
 
LVL 18

Author Comment

by:bobbit31
ID: 7078334
yeah, that's kind of how i was thinking i had to do it... i thought there might be a different way where i didn't have to use JDialog but rather just use JTextArea.

i'll leave this open for a while to see if anyone else has some input.
0
 
LVL 4

Expert Comment

by:kylar
ID: 7084510
JComboBox uses a popup as well to display it's list when you click it.. It's about the only way to do what you want (that I can think of.)

Cheers,
Kylar
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 18

Author Comment

by:bobbit31
ID: 7097392
ok, sorry for the delay, i was working on another issue.

Ok, i have it set up more or less as shown above...

is it possible to get rid of the "Java Applet Window" in the status bar of the JDialog? If not, are there any suggestions as to what I should do to work around it (i don't want it there)...
0
 
LVL 92

Expert Comment

by:objects
ID: 7097485
You'll need to sign your applet.
0
 
LVL 18

Author Comment

by:bobbit31
ID: 7099047
can anyone tell me how to get the damn location of the current table cell relative to the screen!!!

ie:
in my table cell i'm storing a JTextArea.

so in my getTableCellEditorComponent(...)
i do something like this:

JTextArea jta = (JTextArea) value;

jta.getX() returns 0
jta.getY() returns 0

jta.getLocationOnScreen().getX() returns error
"Component must be showing on the screen ..."

same for jta.getLocationOnScreen().getY()

i'm sure this isn't as difficult as i'm making it... i'm not all there this morning!
0
 
LVL 18

Author Comment

by:bobbit31
ID: 7099162
forget that last comment... i needed to use table.getCellRect()

anyway, thanks to all!
0
 
LVL 7

Expert Comment

by:tomboshell
ID: 7099480
Thank you and glad to help,
Tom
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues undeā€¦
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilationā€¦
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question