JTable HTML like colspan
I wonder if it is possible to have functionallity in a JTable similar to HTML's colspan for formatting JTable's contents in a speciall way ...
OK ... thanks a lot.
It seems that the sources were written for Java 1.2. Do you have any idea of what changes to make for it to be 1.4 compliant ? ... (the MultiSpanCellTableExample throws a StackOverFlowException) ....
... thanks again !
Similar Messages
-
How to merge cells in tables if SmartForms like colspan/rowspan in HTML
Hi!
Is it possible to merge cells in a tables in SmartForms like colspan/rowspan parameters in HTML?
Both horisontal and vertical merging needed both in header and in body of the table.
Thanks!No it is not possible.
For merging purpose we have to create seperate windows for that col or rows. -
In my Mac Mail Version 4.5, I am not received email pdf attachement. It is shown in some html like form in message content. Please help
Erdygirl please be aware you are posting to a public forum. I have removed your personal information from your previous post.
Please check your account at http://www.adobe.com/ to locate your serial number. You can find more information on how to locate your serial number at Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html. -
Less strict version of tidy, to indent html-like code?
Hello,
When using Copy as HTML in the DOM tree that Chrome's developer tools show, you get the whole thing as one single line (or a few. It is one line when copying a specific element, even if it has many nested elements inside of it). For looking at this, diffing it, and so on, it is of course way handier to have it as nicely indented HTML code instead.
I tried using tidy -i for this, but by default tidy is very strict. For example the fact that if you want to indent a sub section of an html page, there's no <html> tags is already a problem for tidy.
I tried the following way to solve the html tag problem:
tidy -xml -i file.txt
But then it sometimes outputs just a small part of the whole thing.
Basically, tidy seems not to work very well for semi-correct things that you just want to indent.
Does there exist a utility that's designed to indent any part of xml-like or html-like code into nice separate lines with indentation where possible, even if some tags might be missing or not closed or whatever? Or a command line flag of tidy that I might have missed
Thanks!
Last edited by aardwolf (2012-03-22 17:59:46)You can try xmllint. (It's probably already installed on your system. If not, it's part of libxml2 i.e. $ pacman -S libxml2)
$ xmllint --format in.html >out.html -
How to wrap JTable cell like EXCEL sheet??
Hi All,
I am using JTable and i want to wrap cell of that table like excel sheet whtn text length is more .
i m using jdk 1.4.2 & jre 1.4
can any body help me on that??
== gavinSearch this forum on "wrap text in table cell" I got a ton of hits.
Cheers
DB -
Implementing frozen rows/columns in a JTable layout like MS Excel
I am trying to develop a complex application in which I have a JTable defined, the column names are Name, Admin status , slot id , ipaddress
as per the query to the database this JTable is populated with the data, now I have a button called freeze pane on this panel (let say it admin panel) , I need to implement a feature where if I select a row from JTable and click on the freeze pane button then all the rows above this selected row should be locked , and when I do scrolling only the rows below this selected row should scroll, the upper rows should be fix, this implementation is similar to that of feature " freeze pane " in microsoft excel. Kindly let me know if it's possible and if yes can you provide me with a sample of code.
Thanx in advance.Even I was searching for some help on implementing the freeze/unfreeze functionality in the JTable. If you have come across any solution, pls provide me with the approach.
-
HTML rowspans and colspans...good or bad?
Okay, so I gathered pretty early on that the layout mode in
Dreamweaver was messy...however I never really understood why.
My HTML theory was learned through Dreamweaver not old school
hard coding.
Then I found a nice little posting on the use of Spans:
http://apptools.com/rants/spans.php
I believe this is the major flaw in the use of the Layout
mode, am I correct in this summation?
The poster suggests using nested Tables to securely lock down
the width and height of your tables/cells.
My question is, which poses the greater problems: having Rows
explode or Columns? I always thought HTML likes to "grow"
horizontally if it needs to, and that height could be "locked" down
fairly easily.
Secondly, should the merge/split cell feature in standard
mode be avoided as well? I gather this introduces the same issues
with Rowspan and Colspan.
So finally, is it ever wise to use Rowspan and Colspan? One
can overdue it with nested tables as well I imagine?> I believe this is the major flaw in the use of the
Layout mode, am I
> correct
> in this summation?
Yes.
> My question is, which poses the greater problems: having
Rows explode or
> Columns? I always thought HTML likes to "grow"
horizontally if it needs
> to, and
> that height could be "locked" down fairly easily.
That's incorrect. Table height is invalid HTML - always has
been.
> Secondly, should the merge/split cell feature in
standard mode be avoided
> as
> well?
Yes, unless it's used very sparingly to accomplish a specific
task.
> So finally, is it ever wise to use Rowspan and Colspan?
I could say no, but there are times were merging adjacent
cells can be
useful. However, I generally say this -
Instead of merging cells horizontally, terminate your table
and start a new
one. Instead of splitting cells horizontally/vertically, nest
a new table
with the desired structure.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"stickers11" <[email protected]> wrote in
message
news:[email protected]...
> Okay, so I gathered pretty early on that the layout mode
in Dreamweaver
> was
> messy...however I never really understood why.
> My HTML theory was learned through Dreamweaver not old
school hard coding.
> Then I found a nice little posting on the use of Spans:
>
http://apptools.com/rants/spans.php
> I believe this is the major flaw in the use of the
Layout mode, am I
> correct
> in this summation?
> The poster suggests using nested Tables to securely lock
down the width
> and
> height of your tables/cells.
> My question is, which poses the greater problems: having
Rows explode or
> Columns? I always thought HTML likes to "grow"
horizontally if it needs
> to, and
> that height could be "locked" down fairly easily.
> Secondly, should the merge/split cell feature in
standard mode be avoided
> as
> well? I gather this introduces the same issues with
Rowspan and Colspan.
> So finally, is it ever wise to use Rowspan and Colspan?
One can overdue it
> with nested tables as well I imagine?
>
> -
I found the jconsole(jmx moniting application in jdk5) 's table is just good.
but failed to implement it by myself using jtable,
how can I found some code ?
thanks :)Maybe try setRowSelectionInterval:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTable.html#setRowSelectionInterval(int,%20int) -
Enter key to act like tab key in JTable
I have programmed a JTable application. I want that if I press 'Enter' key in the JTable cell, the cell at right side may be selected after validating input. Similarly, when I press 'Enter' in the right most cell, the first cell of the next row may be selected after validating input.
In other words, I like 'Enter' key to behave as forward navigational key in JTable cells like 'Tab' key, however, after validating input.
The following is the piece of code which is not working for me. Though, it changes selection border to the next cell on pressing enter, but the focus is not shifted and editing remains in the current cell.
//voucherTable is a JTable object with three columns.
Action moveForward = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
int r=voucherTable.getSelectedRow();
int c=voucherTable.getSelectedColumn();
if(c==2){
c=-1;
r+=1;
voucherTable.changeSelection(r,c+1,false,false);
voucherTable.getInputMap().put(KeyStroke.getKeyStroke
(KeyEvent.VK_ENTER,0),"moveForward");
voucherTable.getActionMap().put("moveForward",
moveForward);
Kindly advise me to solve the problem.
Thanks.
MujjahidKeyStroke tab = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
InputMap im = table.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
im.put(enter, im.get(tab)); -
How to select a specific cell in a JTable?
Hi there,
in a JTable, I would like to select a specific cell (to highlight it) from a JButton.
Here a sample code...
Who could help me to fill it?
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
public class TableSelection{
public static void main (String args[]) {
JFrame frame = new MyFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
class MyFrame extends JFrame{
public MyFrame(){
setTitle("TableSelection");
setSize(WIDTH,HEIGHT);
DefaultTableModel myModel = new DefaultTableModel(2,2);
JTable myTable = new JTable(myModel);
myTable.setCellSelectionEnabled(true);
JButton button00 = new JButton("select 0,0");
button00.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
System.out.println("selection of cell (0,0)");
//--- what code is required to select the cell(0,0)?
JButton button11 = new JButton("select 1,1");
button11.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
System.out.println("selection of cell (1,1)");
//--- what code is required to select the cell(1,1)?
Box myBox = new Box(BoxLayout.Y_AXIS);
myBox.add(new JScrollPane(myTable));
myBox.add(button00);
myBox.add(button11);
getContentPane().add(myBox, BorderLayout.CENTER);
private static final int WIDTH=200;
private static final int HEIGHT=200;
}Thanks a lot for your help.
DenisUse the addColumnSelectionInterval(int index1, int index2)method ~ http://java.sun.com/j2se/1.4/docs/api/javax/swing/JTable.html#addColumnSelectionInterval(int,%20int)
and the addRowSelectionInterval(int index1, int index2) method ~ http://java.sun.com/j2se/1.4/docs/api/javax/swing/JTable.html#addRowSelectionInterval(int,%20int)
Hope that helped.
afotoglidis -
HTML Coding Issues with Dynamic Sites
I am trying to create a button using the sliding doors technique and I think I have the correct css, but the issue comes with the HTML.
Here is the CSS:
.Button
/* Sliding right image */
background: transparent url('../Images/button_right_02.png') no-repeat scroll top right;
display: block;
float: left;
height: 38px;
margin-right: 6px;
padding-right: 20px;
text-decoration: none;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size:12px;
font-weight:bold;
.button span {
/* Background left image */
background: transparent url('../Images/button_left_02.png') no-repeat;
display: inline;
line-height: 22px; /* CHANGE THIS VALUE ACCORDING TO BUTTONG HEIGHT */
padding: 7px 0 5px 18px;
.button:hover span{
text-decoration:underline;
However the HTML is a little bit tricky. I only get the right side of the image to show up on the button. Here is the HTML:
<td colspan=2 ALIGN=center class="button">
<table BORDER=0 CELLPADDING=3>
<tr>
<td align=center><input name="Button" type=button class="Button" OnClick=submitScreen("AccountSummary") value="Back to Summary"></td>
</tr>
</table>
</td>
This is what I am ending up with:
This is what I am trying to get to:
The latter image I am able to get to with my own HTML that looks like this:
<body>
<a class="button" href="button2.css"><span>Account Summary</span></a>
</body>
But I need to incorporate that so it works in the above HTML (incorporated with an external database)
Your help is appreciated.Dude I git you ... my template in html is giving me issues also ....
how come I build it then a moth later it wont allow me to nuild pages from the template???
also how do I add my picture logo to my account?? -
Having trouble with multiple lines of text in a JTable
Hello,
I am trying to use a JTable rather like a table in Word so that as I type text into a cell that row of cells grows in height to accomodate the text typed.
I used custom cell editors and renderers to put a JTextField (I think it was) into each cell. These allow the entry of more than one line but the row height is still wrong. So I interceot every key press and work out the height of the custom editor, and set the row height to the max of the cells in the row on each key depression. However, this is a very clunky solution and also does not cope with cell resizing.
I can't believe that it is this hard to get cells/rows that resize in response to typing. So I'd be grateful if someone knows of a better way of doing this.
Many thanks in advance...
GaryI've never tried it buy you can read the Swing tutorial on "How to Use HTML is Swing Components":
http://java.sun.com/docs/books/tutorial/uiswing/TOC.html -
Only allow x rows to be selected in a jtable
hi all,
i want to only allow a user to select x rows. where x is set in the code.
for example if i only allow 2 rows to be selected....and the rows are:
a
b
c
d
e
then if the user selects a then b then c the selection is first ab, then bc (ie a is deselected when c is selected). kind of like a first in first out thing.
so if the user then selected e, then you have c and e as the selected rows.
any ideas of how i can do this...thanks everyone.
Message was edited by:
sand_samuraiA JTable's row selection is handled by a ListSelectionModel object:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTable.html#selectionModel
You should be able to either use manipulate that object, or subclass it to implement you custom selection logic and assign your subclass to the table's selectionmodel.
As far as implementing the logic, keep a queue of the selected rows. When a new row is selected, add it to the queue, and then reset the selection to the first x rows in the queue. -
I have a JTable in JScrollPane which has about 116000 rows of data. I would like to get a status count of what rows are displayed at a time when I move down the scollPane. This is to keep a running track of rows displayed in status message when moving down the scrollpane.
SAY : Displaying rows 10 to 40 of 116000 rows. Is there anyway to get this count.I would use a combination of:
[JScrollPane.getViewport().getViewRect()|http://java.sun.com/javase/6/docs/api/javax/swing/JViewport.html#getViewRect%28%29]
and
[JTable.rowAtPoint()|http://java.sun.com/javase/6/docs/api/javax/swing/JTable.html#rowAtPoint%28java.awt.Point%29] -
Does anyone know how to prevent ellipsis (...) in the data of a JTable? What I want is for each column to be wide enough to display the longest string in the column without the use of ellipsis.
Thanks so much,
JasonHi Jason,
By default, "JTable" makes each column the same width and tries to make each column wide enough so that all of the columns are visible on the screen.
The resize behaviour is determined by the "autoResizeMode". See the javadoc for more details.
http://java.sun.com/j2se/1.4.1/docs/api/javax/swing/JTable.html
To change the behaviour, you can use the "setAutoResizeMode()" method. Again, the javadoc explains what options are available and what they do.
How you determine the largest size of the column depends on what type of data you are displaying in the column and what "JComponent" you are using to display it, so I can't really answer that based on the information you have provided.
However, you need to set the preferred width for each column. You do this via the "setPreferredWidth()" method in class "javax.swing.table.TableColumn". You would probably require code something like this (note:- untested):
JTable table = new JTable();
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
TableColumnModel tcm = table.getColumnModel();
for (int i = 0; i < tcm.getColumnCount(); i++) {
TableColumn tc = tcm.getColumn(i);
tc.setPreferredWidth(99);
}Hope this helps.
Good Luck,
Avi.
Maybe you are looking for
-
How do I print envelopes using Address Book?
I am having trouble getting envelopes to print properly from Address Book in Lion. I have specified size #10 envelpes. When I print them, the text printed on successive envelopes moves further and further down the page until the address drops off o
-
How to change the position of a notation from treble to bass clef?
hi there, i am trying to print out a score from GB '08 that looks more like a piano score (with red hand notes on the treble clef and left hand notes on the bass clef) but can't seem to find a way to do it. can anyone help? thanks!
-
Firefox says that I have a firewall that prevents me from connecting to Internet?
I´ve used Firefox for a while now and I was really happy until now it just won´t work any more. When i try to connect to Internet with firefox I get a message "Connection failed" My firewall is preventing me from connecting according Firefox. But I´v
-
How can i clean up the "other" taking up space on my ipod touch?
How can i clean it up?
-
TS2771 Ipod Touch 4th Gen Camera doest function despite using troubleshooting steps?
I have tried using the troubleshooting steps outlined on this site but the camera fails to open, or switch between the front & rear cameras? Can tis be repaired, if so what is the estimated cost? My son's Ipod has the latest updates.