Solved

JTable and JTextArea

Posted on 2002-06-13
8
667 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 300 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
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

751 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